jcp-gateway: a task's exchanges and an interim result's retry are decided as continuations of the call #336
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/jcp-gateway-gates-tasks-and-mrtr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was open
MCP 2026-07-28 lets a gated call answer before its work is done. Both ways it does that bypassed the gateway:
resultType: "task").tasks/get,tasks/updateandtasks/cancelpassed through as discovery.resultType: "input_required"). The retry carries the client's answers ininputResponses, but onlyargumentswere folded. An answer carrying a value from an untrusted read reached the server past the flow ceiling.What this changes
Each task exchange is a continuation of the call.
A task closes once. The
tasks/getthat brings the outcome seals a zero-cost result frame (tool-result,data) over the content address of a closing record. The record names:Partialbecause the server works between exchanges, outside any span;The record and its receipt come back in
_meta.Unknown or closed task ids are refused. The refusal is sealed and never reaches the server.
Retries are flow-checked and chained. A retry's answers are flow-checked with its arguments. Its sealed payload commits to the receipt of the interim result it answers.
Server-minted handles are exempt only as exact echoes. A task id, a request key or a
requestStateskips the flow check only when it matches exactly what the gateway saw the server mint. Otherwise a UUID handle (36 bytes, against a 16-byte scan window) would taint every poll under a ceiling. A handle the client made up is checked.server/discovercarries the advertisement, asinitializedoes. It lists the task methods andcontinuations: 1.Bounds. Open tasks and pending interim results are capped at 1024 each, oldest task dropped first.
SPEC. §6.1 states the rule in protocol-neutral terms, and §10 gains a row for it.
Known limits (stated in the code)
notifications/tasksfall outside the request/response relay.Not in this PR
For every gated method,
paramsfields other than the payload (_meta, unknown keys) are still forwarded unscanned. Task methods are now rebuilt and so are covered.tools/call,resources/readandprompts/getare not. That gap predates this PR and needs its own decision about which fields to forward.Verification (build host)
cargo test -p jcp-gateway --lib: 47 pass, 12 of them new, all against scripted upstreams.🤖 Generated with Claude Code