Skip to content

Add stateless backend-scoped task handles - #97

Open
lucarlig wants to merge 3 commits into
mainfrom
user/luca/issue-6185-task-handles
Open

Add stateless backend-scoped task handles#97
lucarlig wants to merge 3 commits into
mainfrom
user/luca/issue-6185-task-handles

Conversation

@lucarlig

@lucarlig lucarlig commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the versioned cfth1 stateless task-handle codec for modern MCP Tasks
  • protect upstream task routes with misuse-resistant AES-256-GCM-SIV and replica-safe random nonces
  • bind handles to typed, trusted authorization-context, virtual-host, configuration-revision, backend, and backend-generation identities
  • decode the shared key once into fixed-size zeroizing storage and zeroize protected task payloads after use
  • require current effective-configuration validation on decode and return indistinguishable invalid-task errors without exposing upstream IDs
  • keep handler wiring and runtime key configuration out until the Tasks lifecycle handlers are implemented

Why this is needed

Modern MCP Tasks return identifiers that clients later reuse with tasks/get, tasks/update, and tasks/cancel. Those identifiers are backend-specific and may behave like bearer tokens. Returning them directly would expose upstream details and would not safely preserve which backend owns a task.

The future dataplane is horizontally scaled and stateless. A process-local task map would require session affinity, while a Redis task map would add hot-path state, expiry, and cleanup. An encrypted routing handle carries only the routing context and can be decoded by any replica sharing the key.

Binding the handle to trusted typed identities prevents accidental use of caller-controlled strings, cross-tenant or cross-policy replay, and routing after backend removal or reassignment. Lifecycle requests must still validate the JWT, load effective configuration, enforce scope/RBAC policy, and verify the backend generation before making an upstream call.

This PR provides the security and routing primitive only. It does not expose Tasks methods or add unused runtime configuration ahead of the handlers that will consume it.

Stack

This is the top layer of native GitHub stack #100, above the independent test-listener stabilization in PR #95. Its review diff against #95 is limited to task-handle code, dependencies, and matching architecture documentation.

This supersedes #84. During correction of an earlier stack order, GitHub recorded #84 as merged into PR #95's branch; it was not merged into main.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • cargo nextest run --locked --workspace — 231 passed
  • cargo deny check
  • cargo build --locked --workspace
  • cargo shear --check-test-targets --deny-warnings --locked
  • mdbook build _context/wiki
  • mdbook test _context/wiki
  • git diff --check user/luca/stabilize-gateway-test-ports...HEAD

Closes IBM/mcp-context-forge#6185

@lucarlig
lucarlig force-pushed the user/luca/issue-6185-task-handles branch 2 times, most recently from 797be0f to 1e26c44 Compare August 18, 2026 09:24
@lucarlig
lucarlig changed the base branch from main to user/luca/stabilize-gateway-test-ports August 18, 2026 09:24
Base automatically changed from user/luca/stabilize-gateway-test-ports to main August 18, 2026 09:25
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig force-pushed the user/luca/issue-6185-task-handles branch from 1e26c44 to e8cc86c Compare August 18, 2026 09:25
@lucarlig
lucarlig requested a review from dawid-nowak August 18, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE][CF-DATAPLANE][TASKS]: Add stateless backend-scoped task handles

2 participants