Repository navigation
Description
Symptom
For every tool except ripr_list_gaps, a success document whose double-carry envelope exceeds the 128-KiB response bound ships as content[0].text only — structuredContent is silently dropped, with no in-band signal that it is absent — even though each of these tools advertises an outputSchema, which per the MCP contract is what structuredContent is for. Only the tool descriptions' own text hints nothing about this conditional absence.
Evidence
Read-only audit at 243a8548b (origin/main).
crates/ripr/src/mcp/protocol.rs:266-289—tool_resultbuilds{content, structuredContent, isError: false}; when it measures overMAX_RESPONSE_BYTESit falls back to a text-only envelope{content, isError: false}and returns it without any marker (comment at :256-265 states this is by design).crates/ripr/src/mcp/workspace.rs:555-557,601-616—ripr_list_gapsis the only tool that pins "a tool that advertises an outputSchema always returns a structured result" and fails closed withresult_too_largewhen even one summary cannot fit the structured envelope.- All other tools (
ripr_workspace_status,ripr_refresh,ripr_get_gap,ripr_prepare_repair,ripr_get_repair_attempt,ripr_get_receipt_status,ripr_get_repair_card) route throughbounded_tool_result→tool_result, so their large documents losestructuredContentsilently.
Probe: a ripr_refresh on a scratch repository returned a success envelope whose structuredContent was present (small document); the code path above is taken only past the bound, which no small fixture reaches — the drop is exercised in-crate (e.g. the #6021 envelope tests) rather than observable on a tiny repo.
Description check: GET_GAP_TOOL_DESCRIPTION (crates/ripr/src/mcp/protocol.rs:72) promises "one canonical item's complete bounded evidence" and names result_too_large for over-bound items, but says nothing about structuredContent being absent for items that fit as text yet not as double-carry; same for the repair-attempt / receipt / repair-card descriptions. Only the repo's own docs disclose it: docs/interop/mcp.md:163-166 — "structuredContent repeats it only while the complete envelope stays under the response bound."
Why it frustrates
An agent (or host framework) that consumes structuredContent as the schema-bearing representation — the MCP-recommended way to consume tools that advertise outputSchema — parses a large-but-legal gap or repair-attempt document and finds the field missing with no error and no explanation. Reasonable but wrong inferences: the server is buggy, the document was truncated, or the tool contract changed. The agent then either re-calls the same tool (same outcome), falls back to regex-parsing content[0].text (works, but silently abandons the schema contract), or discards the evidence. The failure mode is indistinguishable from success unless the client defensively checks for structuredContent on every call — exactly the kind of undocumented edge that costs an agent several wasted turns on a large repository, where it is most likely to trigger.
Suggested direction
Cheapest honest fix: state the conditional absence in each affected tool description (one clause: "when the document fits the response bound only as compact text, structuredContent is omitted; parse content[0].text as JSON"). Stronger: carry a small marker (e.g. structuredContent: null plus a limitations entry, or a typed structured_content_omitted flag) so the omission is machine-detectable, mirroring how result_too_large is typed rather than implied.
Classification
verified_current — code path and description gap confirmed against HEAD source (243a8548b); live trigger requires a document near the 128-KiB bound. Confidence: medium (impact depends on whether the consuming host reads structuredContent preferentially).
Activity
EffortlessSteven commentedon Oct 15, 2026
Bounded implementation continuation: Draft PR #8043 (#8043) now owns the empty
ripr_list_gapsstructured-envelope repair. Published head383f2ece7088f1b59447ed2f2594bcdf82709785preserves exact executed/reviewed tree3b3e722650c4419a88a0ab4ad8b6fd6c7b7530cb; original head856a26111d41ed489815eb461459f74b58219908and tests-first6ec976646cc71b9a844dd47f8bff44e1da707874map to new remote commit envelopes in the PR body. All six blobs/modes and both complete trees were verified. The existing source task remains the retained evidence owner; no parallel implementation was created.The same real-stdio regression was RED on the original test-only tree and GREEN unchanged after repair. SDK 4/4, stdio 18/18, selected workspace 24/24, workspace/all-target Clippy and direct policy/contract checks passed on the original exact source. Full independent review and proof identities are retained in #8043 (comment).
Independent published-head source/oracle review binding is complete with no new scoped blocker: #8043 (review). Keep Draft: genuine-base
check-fast/precommitselectors and required hosted/integration qualification remain NOT_PROVEN. No Ready transition, Cargo rerun, release or merge occurred in publication. Parent owns those next judgments. This slice checks empty pages with the existing tool-envelope authority and typed refusal, preserving schemas, nonempty paging and recovery; it does not close #7768. Other tool cases and the independently reproduced inherited outer JSON-RPC/request-ID budget edge remain open.fix(mcp): keep empty gap pages structured (#7768) (#8043)
fix(mcp): assert the structured copy on the wire and cover resource r…
fix(mcp): refuse oversized responses typed against the id-aware wire …
EffortlessSteven commentedon Oct 15, 2026
Outer JSON-RPC/request-ID budget slice landed: PR #8103 squash-merged as
bb4295e97dbea37145c6b8832e93cfc9d3a13f54(verified onmainvia ls-remote; PR state MERGED at 2026-10-15T09:31:51Z; requiredRipr Rust Small Resultsuccess on head0133287ef). Part of #7768 — the issue stays open for its remaining acceptance item.What landed. Every MCP tool and resource producer now measures against one id-aware response budget —
MAX_RESPONSE_BYTESminus the JSON-serialized request id of the call being answered minus a fixedOUTER_RESPONSE_OVERHEAD_BYTES = 128reserve for the JSON-RPC frame fields and the modernresultTypefield — threaded throughtool_result,structured_envelope_overflows(list-gaps structured fit and bisect),bounded_tool_envelope,resource_result, and the newly measured status-resource read (crates/ripr/src/mcp/mod.rs,protocol.rs,server.rs,workspace.rs).ripr_list_repair_attemptskeeps its existing id-aware ceiling, now fed from the shared helper. An envelope that passes the budget provably fits the writer cap whatever id the client sent; oversized results return the typedresult_too_largerefusal with recovery instead of the correlated generic-32603fallback. The writer backstop and theMCP output limittermination remain the documented last resort for ids so large that even the typed refusal cannot fit;docs/interop/mcp.mdand RIPR-SPEC-0211 now describe the reservation (the previous "fails closed ... before the wire cap" claim was false for large ids).RED witness. The retained stdio regression
long_request_ids_refuse_typed_before_the_wire_capdrove a legal escaping-heavy request id sized from envelopes measured on the live wire: on the pre-fix tree the call answered the correlated-32603MCP response exceeds the configured byte limit(native test failure, noresult, no typed refusal); after the repair the same call returns the typedresult_too_largerefusal with the snapshot-bound recovery, a fit id one notch lower still ships a structured page, and the resource-read arm covers the same refusal/fit pair forripr://workspace/status. Mutation check: disabling the id-aware reservation fails the stdio regression and the server boundary test; restored, both pass.Boundary coverage. Exact budget-1/budget/budget+1 flips (
tool_result_fits_and_refuses_at_the_id_aware_envelope_budget); quote/backslash/control/non-ASCII escaping multipliers charged exactly against the real encoder (request_id_escaping_is_charged_exactly_by_the_outer_budget,outer_envelope_budget_reserves_the_escaped_request_id); pinned rmcp 3.5.1 overhead measured at 33 payload bytes legacy / 57 modern, inside the 128 reserve for both negotiated shapes (pinned_sdk_wraps_the_measured_envelope_within_the_outer_reserve); id-aware pager refusal and bisection (list_gaps_honors_the_id_aware_envelope_budget); long-id typed refusal end-to-end throughbounded_tool_result(long_request_id_refuses_typed_at_the_id_aware_boundary). Local proof on0133287ef: fmt --check, clippy-p ripr --all-targets -D warnings, stdio 19/19 + SDK 4/4 + workspace-config 6/6 and libmcp::156/156 (single-threaded; the parallel lib-suite flake is the recorded host issue, not fixed here),goldens checkexit 0, and the policy cascade (no-panic, process, allow-attributes, static-language, executable-files, network, lint, traceability, covered-by, spec-format, spec-numbering, file-policy) all exit 0. Required hosted qualification ran on the published head:Routed Rust Smallruns 38703368857 (f4f9e32) and 38707248517 (0133287), both success; all PR checks green at merge.Review. Six review threads on #8103, all addressed or refuted with replies and read back resolved=true: two fixed (the Debug-rendering oracle could not catch a text-only regression — now asserts the serialized wire shape; resource reads lacked wire-level coverage — added), two refuted as the pre-existing pinned #5254-item-4/#6291 status pattern (typed refusal after the wrapper adds recovery text; demotion remains the parent residual), two refuted as pre-existing measurement style (counting-writer refactor out of scope).
Remaining acceptance item. The issue's original symptom — a document that fits only as compact text silently loses
structuredContenton the non-listing tools (and on listing tools past the envelope budget) — remains the documented #6021/#7768 fallback behavior; that typed-marker-or-description residual is the next owner's claim. The writer backstop ladder (typed refusal → correlated fallback →MCP output limittermination) is unchanged and documented.docs(changelog): carry the #7768 entry as a changelog.d fragment (#8167…
fix(mcp): refuse the structuredContent drop typed at the envelope bou…
EffortlessSteven commentedon Oct 16, 2026
Final slice landed: PR #8167 squash-merged as
97cc171257fd76a1b3b9e79cc41ad949e0ecc861(verified onmainvia ls-remote; PR state MERGED at 2026-10-16T03:56:58Z). This claimed the remaining acceptance item recorded in the #8103 reconciliation (comment 6189000150) — the issue's ORIGINAL symptom — so with #8043 (empty pages) and #8103 (outer id-aware budget) the acceptance set is complete and the issue closes.What landed. The text-only success fallback in
protocol::tool_resultis removed. A success document whose complete double-carry envelope cannot fit the caller's id-aware response budget now fails closed with the typedresult_too_largerefusal naming both sizes, the budget, the bound, and the dropped field, and every caller maps it to its per-tool recovery route — the same answer the two pagers already give past their paging envelope budget. Every tool that advertises anoutputSchemanow either shipsstructuredContentor refuses typed; silent absence is no longer a representable wire state.Why removal, not a marker or a description clause. The reachability re-read on current main found the fallback live on every non-paging tool:
ripr_workspace_status/ripr_refreshhad no structured pre-check at all, and the single-item tools'bounded_documentguard sits at the raw 128-KiB cap whiletool_resultmeasures the ~2× double-carry envelope — a silent window at roughly (65.5 KiB, 131 KiB] of document bytes. A marker would have kept the degraded response; a description clause would have documented the loss. Removal makes code, spec (RIPR-SPEC-0211),docs/interop/mcp.mdanddocs/OUTPUT_SCHEMA.mdstate one contract.Evidence. RED on the pre-fix tree (
20022bbfe) at five discriminating sites — the flipped #6021 double-envelope unit arms, a structured-overflow/compact-fits window arm in the server long-id boundary test, a new window-sizedripr_get_gapdispatch test asserting the serialized wire shape, and a new raw-stdio regression whose legal escaping-heavy request id is sized from the measuredripr_workspace_statusenvelope so the id-aware budget sits inside the refusal window (fit control one notch below). GREEN after: libmcp::157/157 (single-threaded), stdio 20/20, SDK 4/4,goldens checkpass, fmt/clippy/policy cascade exit 0. Local full proof and review-thread resolution (one Devin thread: changelog entry moved tochangelog.d/8167-mcp-envelope-refuses-typed.mdper policy, resolved with reply, read back resolved=true) are recorded on the PR.Routed separately (not this issue's scope). Hosted
cargo-denyis red repo-wide since ~03:32Z: crates.io yanked the entirezip8.x line whileCargo.lockpins 8.6.0 anddeny.tomlsetsyanked = "deny"; xtask'szip = "^8"has no non-yanked 8.x (cargo update -p zip --dry-runlists 8.0.0–8.6.0 all yanked). It passed on this PR's first head and the branch's lockfile is byte-identical to main's — an inherited dependency decision (major bump, un-yank, or policy exception) for the owner, documented in the PR body.Non-claims: no analyzer classification change, no pager or writer-backstop change, no release/package qualification.
EffortlessSteven commentedon Oct 16, 2026
Closing: the original symptom — the silent text-only drop of structuredContent on every non-paging tool — is repaired by #8167 (merge 97cc171), the last open acceptance item after #8043 and #8103. Reconciliation in comment 6207745567.
fix(mcp): reject request ids over 16 KiB without ending the session (#…
docs(mcp): document the 16 KiB request-id rejection and pin the sessi…