Repository navigation
fix(mcp): name the filter, not the snapshot route, for a filter-driven gap-list overflow (#9895) - #9970
Conversation
…n gap-list overflow (#9895) A huge list_gaps filter value (for example a long file path) can push the empty-page shell past the response bound on its own, where the old recovery pointed at the ripr://snapshot/{snapshot_id} identity route — advice that cannot fix an echo-driven overflow. The session now probes the same shell with an empty filter echo: when the echo is the difference between fitting and overflowing, the typed refusal names the filter as the shrinkable bound; only overflow that filtering cannot cause keeps the identity route (#9895). Salvaged from #9959, whose argument-message half was superseded by #9945 while it queued; this is the independently valuable workspace half, rebased onto current main. RIPR-SPEC-0211 behavior + test mapping updated and the new test registered in .ripr/traceability.toml.
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 56 minutes. View limit details
Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the list_gaps error recovery logic to distinguish between filter-driven and shell-driven overflows, returning a more specific recovery suggestion depending on the cause. Feedback on the changes highlights an inconsistency in recovery_for_document, where the check for shell_bytes exceeding the document ceiling does not account for the reserve margin, unlike the other checks and the page budget calculation.
|
Independent exact-head review of
The parser composition itself is correct: server.rs retains landed #9945 blob At13:20 required39958881635/producer120431910956 and companionCI39958881163 were running. Preserve those admitted runs and inspect outcomes before deciding successor qualification; no duplicate run is requested. Author-focused claims remain author-reported here. No source change, compilation, installation, dispatch, external-agent contact or merge was performed by the independent review. Terminal execution follow-through, 2026-10-23 14:03 UTC: required producer120431910956 executed merge |
|
Current exact-head review: REPAIR_REQUIRED for documentation; preserve the active qualification. Canonical #9970 is now Existing writer's next action: apply only the four-file documentation/traceability/changelog patch below to the existing candidate, preserving any concurrently advanced work. It applies cleanly to exact a746745 and reconstructs tree This remaining correction finishes the stale interop313–316 paragraph, describes the metadata boundary accurately, maps/registers the existing reserve unit, corrects the stdio evidence description ( Fresh real stdio proof was bound separately to clean canonical17edddf producer, actual Cargo executable SHA-256 CI transition evidence: required39997538215/producer120565282928 actually checked merge d0e46a7 = main-basis3d9ce73 + head17edddf and failed101 at manual_div_ceil before required tests; later stages were not passed. Companion39997538129 on that same merge succeeded and directly passed the named attribution/reserve/effective-bound/stdout tests. Before proposing repair, exact current-main observation d84b8be passed Preserve active current-head required40003373337/producer120585390535 and companionCI40003372927. Observed remote merge subject83ed8910e0252d4f4285e45ea410fc0df9e61676 joins main-basis f63a722 with a746745 (tree0300ad5ef4559cf00955c239836eb694d32d0a9f); confirm the actual executing checkout beneath the run. No merge clearance follows from an active or green wrapper. After terminal outcomes, compose/review the documentation successor and obtain its normal current-head required proof. Normal protected expected-head squash remains authorized only after the documented contract, current review, required checks and integration judgment are satisfied; read back actual landing/main ancestry. #9895 remains a broader partial sweep. Protection/configuration read limits (independent of the source repair): connected classic-branch-protection GET All local drivers are terminal: canonical producer build/client runs0; strict main baseline0; strict b159c34 proposal check0; focused b159c34 reserve unit0; intended old-producer negative control101 with canonical producer restored/rehashed. Brief exec-server transport loss after the main baseline did not change that recovered terminal0; the selected environment is available again and all retained exit receipts were verified. Native evidence/identity handoff is Fresh canonical17edddf external-client stdout, checked b159c34 unit result, and new old-producer negative controlThe reserve-unit executable actually consumed for b159c34 is SHA-256 Portable residual patch (only these four files remain unadopted): diff --git a/.ripr/traceability.toml b/.ripr/traceability.toml
--- a/.ripr/traceability.toml
+++ b/.ripr/traceability.toml
@@ -14351,6 +14351,7 @@
"crates/ripr/src/mcp/server_tests.rs::outer_envelope_budget_reserves_the_escaped_request_id",
"crates/ripr/src/mcp/workspace.rs::tests::list_gaps_honors_the_id_aware_envelope_budget",
"crates/ripr/src/mcp/workspace.rs::tests::list_gaps_overflow_recovery_names_the_shrinkable_cause",
+ "crates/ripr/src/mcp/workspace.rs::tests::document_branch_attribution_charges_the_page_metadata_reserve",
"crates/ripr/src/mcp/writer.rs::tests::pinned_sdk_wraps_the_measured_envelope_within_the_outer_reserve",
"crates/ripr/src/mcp/writer.rs::tests::request_id_escaping_is_charged_exactly_by_the_outer_budget",
"crates/ripr/src/mcp/workspace.rs::tests::gap_list_summaries_project_readiness_matching_get_gap",
diff --git a/docs/interop/mcp.md b/docs/interop/mcp.md
--- a/docs/interop/mcp.md
+++ b/docs/interop/mcp.md
@@ -311,9 +311,12 @@
can overflow the structured envelope while the raw document still fits.
Those pages return the existing typed `result_too_large` refusal with the
current snapshot identity. Only a listing that cannot fit even one
-page — an omission disclosure alone over the ceiling — fails closed with
-`result_too_large` naming `ripr://snapshot/{snapshot_id}` as the identity
-route. Other tool responses carry the document once at full fidelity:
+page fails closed with `result_too_large`: when the echoed filter causes
+the overflow, including final page metadata crossing the document ceiling,
+the recovery says to narrow the filter and retry `ripr_list_gaps`. Other
+non-pageable overflows — for example an omission disclosure alone over the
+ceiling — name `ripr://snapshot/{snapshot_id}` as the identity route.
+Other tool responses carry the document once at full fidelity:
`content[0].text` is the compact JSON serialization, and
`structuredContent` repeats it in every successful response. Each tool
advertises an `outputSchema`, so a success never ships without its
diff --git a/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md b/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
--- a/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
+++ b/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
@@ -206,8 +206,9 @@
a refresh between pages fails closed with `stale_snapshot` instead of
mixing snapshots. Only a listing that cannot fit even one page fails
closed with `result_too_large`: when the echoed filter value itself is
- what pushes the shell past the bound — the same shell with an empty
- filter echo fits — the refusal names the filter as the shrinkable bound,
+ what pushes the page past the bound, including its final metadata — the
+ same shell with an empty filter echo fits — the refusal names the filter
+ as the shrinkable bound,
because the snapshot identity route cannot fix a filter-driven overflow;
for every other non-pageable disclosure (for example an omission
disclosure alone over the ceiling) the refusal names
@@ -445,12 +446,15 @@
- `crates/ripr/tests/mcp_stdio.rs::empty_gap_pages_keep_structured_outcomes_at_the_response_bound`
— real committed analysis with nonempty subjects before filtering, fitting
empty pages, independently sized structured-envelope overflow below the
- raw-document ceiling, raw-document overflow, the `file` and `language` filters,
- typed refusals bound to the current snapshot, echo-driven refusals naming
+ raw-document ceiling, oversized echoes, the `file` filter, typed refusals
+ bound to the current snapshot, echo-driven refusals naming
the filter rather than the snapshot identity route, and same-session recovery.
- `crates/ripr/src/mcp/workspace.rs::tests::list_gaps_overflow_recovery_names_the_shrinkable_cause`
— filter-driven shell overflow names the filter; shell-driven overflow
keeps the snapshot identity route.
+- `crates/ripr/src/mcp/workspace.rs::tests::document_branch_attribution_charges_the_page_metadata_reserve`
+ — raw-document overflow from final offset metadata names the filter;
+ reserve exhaustion alone still serves a fitting document.
- `crates/ripr/tests/mcp_stdio.rs::oversized_request_id_is_rejected_with_null_id_and_the_session_survives`
— a request id whose serialized form exceeds 16384 bytes (including one
that fits the input cap but not the output cap) is answered with a
diff --git a/changelog.d/9970-mcp-filter-overflow-recovery.md b/changelog.d/9970-mcp-filter-overflow-recovery.md
new file mode 100644
--- /dev/null
+++ b/changelog.d/9970-mcp-filter-overflow-recovery.md
@@ -0,0 +1,4 @@
+<!-- section: Fixed -->
+- MCP `ripr_list_gaps` overflow recovery now names the echoed filter when
+ narrowing it can restore a fitting page, including overflow caused by
+ final page metadata at the document ceiling (#9970).Canonical17edddf source/proof, joined b159c34 proposal, original18ff49a receipts and earlier coordination (historical subjects retained)Current canonical follow-through (supersedes the old proposal-selection request below): #9970 is at The parent handoff6370689737 remains applicable: interop313–316 still omits the filter recovery. Latest review5632150081 also correctly identifies the missing reserve-unit spec mapping. The joined residual-repair proposal below is Focused proposal checks: Owner action: finish this already-diagnosed docs correction through the existing canonical writer; record the independently implemented/adopted and superseded proposal pieces. If documentation repair is already active, keep that owner and use this only as a comparison. Required39997538215/producer120565282928 and companionCI39997538129 were preserved through terminal results. The required producer failed strict Clippy, native101, at the newly added New independent exact-canonical execution: clean Fresh client results: Gate classification recorded before source repair: candidate-introduced. Integration observation: actual fetched main From b159c34c54cfa41933635c403cfb2f2f420d64aa Mon Sep 17 00:00:00 2001
From: Codex <codex@openai.com>
Date: Fri, 23 Oct 2026 18:11:27 +0000
Subject: [PATCH] fix(mcp): complete canonical recovery docs and boundary-test
lint repair
Bounded owner-adoption proposal based on canonical #9970 head 17edddf0a. Preserve its production implementation and stdio oracle. Replace only the new unit search midpoint with div_ceil to satisfy the observed required Clippy gate; register and document that unit, reconcile interop filter recovery and add the filter-only changelog fragment. No canonical branch push or hosted qualification is requested by this local commit.
---
.ripr/traceability.toml | 1 +
changelog.d/9970-mcp-filter-overflow-recovery.md | 4 ++++
crates/ripr/src/mcp/workspace.rs | 2 +-
docs/interop/mcp.md | 9 ++++++---
.../RIPR-SPEC-0211-mcp-workspace-session-evidence.md | 12 ++++++++----
5 files changed, 20 insertions(+), 8 deletions(-)
create mode 100644 changelog.d/9970-mcp-filter-overflow-recovery.md
diff --git a/.ripr/traceability.toml b/.ripr/traceability.toml
index 5fd5ecd66..3b41963fb 100644
--- a/.ripr/traceability.toml
+++ b/.ripr/traceability.toml
@@ -14351,6 +14351,7 @@ tests = [
"crates/ripr/src/mcp/server_tests.rs::outer_envelope_budget_reserves_the_escaped_request_id",
"crates/ripr/src/mcp/workspace.rs::tests::list_gaps_honors_the_id_aware_envelope_budget",
"crates/ripr/src/mcp/workspace.rs::tests::list_gaps_overflow_recovery_names_the_shrinkable_cause",
+ "crates/ripr/src/mcp/workspace.rs::tests::document_branch_attribution_charges_the_page_metadata_reserve",
"crates/ripr/src/mcp/writer.rs::tests::pinned_sdk_wraps_the_measured_envelope_within_the_outer_reserve",
"crates/ripr/src/mcp/writer.rs::tests::request_id_escaping_is_charged_exactly_by_the_outer_budget",
"crates/ripr/src/mcp/workspace.rs::tests::gap_list_summaries_project_readiness_matching_get_gap",
diff --git a/changelog.d/9970-mcp-filter-overflow-recovery.md b/changelog.d/9970-mcp-filter-overflow-recovery.md
new file mode 100644
index 000000000..ed60ad257
--- /dev/null
+++ b/changelog.d/9970-mcp-filter-overflow-recovery.md
@@ -0,0 +1,4 @@
+<!-- section: Fixed -->
+- MCP `ripr_list_gaps` overflow recovery now names the echoed filter when
+ narrowing it can restore a fitting page, including overflow caused by
+ final page metadata at the document ceiling (#9970).
diff --git a/crates/ripr/src/mcp/workspace.rs b/crates/ripr/src/mcp/workspace.rs
index 64b2634cb..63103f06e 100644
--- a/crates/ripr/src/mcp/workspace.rs
+++ b/crates/ripr/src/mcp/workspace.rs
@@ -2770,7 +2770,7 @@ mod tests {
// sits exactly at the document ceiling.
let (mut low, mut high) = (0usize, 70_000usize);
while low < high {
- let mid = (low + high + 1) / 2;
+ let mid = (low + high).div_ceil(2);
if refuses_at_offset_zero(mid)? {
high = mid - 1;
} else {
diff --git a/docs/interop/mcp.md b/docs/interop/mcp.md
index e54c9726f..c663e4290 100644
--- a/docs/interop/mcp.md
+++ b/docs/interop/mcp.md
@@ -311,9 +311,12 @@ under the 128-KiB response bound, including empty pages whose echoed filters
can overflow the structured envelope while the raw document still fits.
Those pages return the existing typed `result_too_large` refusal with the
current snapshot identity. Only a listing that cannot fit even one
-page — an omission disclosure alone over the ceiling — fails closed with
-`result_too_large` naming `ripr://snapshot/{snapshot_id}` as the identity
-route. Other tool responses carry the document once at full fidelity:
+page fails closed with `result_too_large`: when the echoed filter causes
+the overflow, including final page metadata crossing the document ceiling,
+the recovery says to narrow the filter and retry `ripr_list_gaps`. Other
+non-pageable overflows — for example an omission disclosure alone over the
+ceiling — name `ripr://snapshot/{snapshot_id}` as the identity route.
+Other tool responses carry the document once at full fidelity:
`content[0].text` is the compact JSON serialization, and
`structuredContent` repeats it in every successful response. Each tool
advertises an `outputSchema`, so a success never ships without its
diff --git a/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md b/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
index d0a304184..3cd3c2bcf 100644
--- a/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
+++ b/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
@@ -206,8 +206,9 @@ official SDK transport:
a refresh between pages fails closed with `stale_snapshot` instead of
mixing snapshots. Only a listing that cannot fit even one page fails
closed with `result_too_large`: when the echoed filter value itself is
- what pushes the shell past the bound — the same shell with an empty
- filter echo fits — the refusal names the filter as the shrinkable bound,
+ what pushes the page past the bound, including its final metadata — the
+ same shell with an empty filter echo fits — the refusal names the filter
+ as the shrinkable bound,
because the snapshot identity route cannot fix a filter-driven overflow;
for every other non-pageable disclosure (for example an omission
disclosure alone over the ceiling) the refusal names
@@ -445,12 +446,15 @@ is not evidence that a resource with a particular identity exists.
- `crates/ripr/tests/mcp_stdio.rs::empty_gap_pages_keep_structured_outcomes_at_the_response_bound`
— real committed analysis with nonempty subjects before filtering, fitting
empty pages, independently sized structured-envelope overflow below the
- raw-document ceiling, raw-document overflow, the `file` and `language` filters,
- typed refusals bound to the current snapshot, echo-driven refusals naming
+ raw-document ceiling, oversized echoes, the `file` filter, typed refusals
+ bound to the current snapshot, echo-driven refusals naming
the filter rather than the snapshot identity route, and same-session recovery.
- `crates/ripr/src/mcp/workspace.rs::tests::list_gaps_overflow_recovery_names_the_shrinkable_cause`
— filter-driven shell overflow names the filter; shell-driven overflow
keeps the snapshot identity route.
+- `crates/ripr/src/mcp/workspace.rs::tests::document_branch_attribution_charges_the_page_metadata_reserve`
+ — raw-document overflow from final offset metadata names the filter;
+ reserve exhaustion alone still serves a fitting document.
- `crates/ripr/tests/mcp_stdio.rs::oversized_request_id_is_rejected_with_null_id_and_the_session_survives`
— a request id whose serialized form exceeds 16384 bytes (including one
that fits the input cap but not the output cap) is answered with a
--
2.52.0
Historical proposal18ff49a, original receipts and earlier coordination (not canonical17edddf qualification)Owner / governing claim: existing Candidate: #9970 remains Draft at Isolated adoption proposal: commit Observed focused proof (Rust1.95.0, x86_64 Linux, two jobs, debug0/incremental off, explicit Baseline classification candidate: on exact current-main observation Further observed proof: explicit Coordination update 2026-10-23 16:12 UTC: private contribution b61daf8 appeared while the unit proof ran. Its statement about this comment lacking exact patch identity preceded the completed 16:06 publication: the full exact patch, base/head/tree/hash and native stdio receipts are now present below and were read back byte-for-byte. An isolated index application to Exact proposed file identities for comparison:
Remaining evidence: old-guard mutation control and actual native combined-main execution for this proposal are unestablished here. The private contribution's corresponding results remain reported until raw artifacts/source applicability are inspected; they are not relabeled as this proposal's execution. Next canonical action / resume condition: existing canonical owner obtains both contributions' exact source identities and selects or reconciles ONE repair before adoption, any source push, or successor CI. Contribution6368843134 is now fully identified as Final delivery observation, 2026-10-23 16:17 UTC: #9970 is still Draft, head The explicit selection/adoption action is pending, not attempted or denied: obtain the private contribution's patch/bundle and raw receipts through its owning context, compare with the exact artifact below, and select/reconcile one repair through the canonical writer. Then refresh affected exact-successor proof/review, verify and disposition the actual repaired reserve thread, obtain required qualification once, and perform normal protected expected-head squash only when eligible; verify the actual landing on main. This proposal has not closed the canonical findings, and its completion is not adoption. No Ready transition, source push, successor CI request, merge, release, deployment, settings or access change occurred. All owned native drivers are terminal. Main inspection worktree was removed after preserving reports. Clean Raw focused native stdout receipts (proposal18ff49a; Rust-only, not required qualification)Commands: the actual Cargo-produced integration test artifact Portable proposal (save the complete fenced contents as an From 18ff49a3342b65cc5d0a6219c1ae23926d9658c6 Mon Sep 17 00:00:00 2001
From: Codex <codex@openai.com>
Date: Fri, 23 Oct 2026 15:59:19 +0000
Subject: [PATCH] fix(mcp): compose filter overflow recovery review repairs
Isolated proposal for adoption into #9970; canonical branch custody remains with its existing writer. Attribute raw-document overflow using the metadata reserve only after the actual document guard refuses. Correct the escaped-filter stdio oracle and add independently sized raw-boundary, reserve-only, snapshot/session and process-exit controls. Reconcile interop/spec prose and add the missing filter-only changelog entry; preserve #9945 parser bytes.
---
.../9970-mcp-filter-overflow-recovery.md | 4 +
crates/ripr/src/mcp/workspace.rs | 5 +-
crates/ripr/tests/mcp_stdio.rs | 154 +++++++++++++++++-
docs/interop/mcp.md | 9 +-
...PEC-0211-mcp-workspace-session-evidence.md | 10 +-
5 files changed, 171 insertions(+), 11 deletions(-)
create mode 100644 changelog.d/9970-mcp-filter-overflow-recovery.md
diff --git a/changelog.d/9970-mcp-filter-overflow-recovery.md b/changelog.d/9970-mcp-filter-overflow-recovery.md
new file mode 100644
index 000000000..ed60ad257
--- /dev/null
+++ b/changelog.d/9970-mcp-filter-overflow-recovery.md
@@ -0,0 +1,4 @@
+<!-- section: Fixed -->
+- MCP `ripr_list_gaps` overflow recovery now names the echoed filter when
+ narrowing it can restore a fitting page, including overflow caused by
+ final page metadata at the document ceiling (#9970).
diff --git a/crates/ripr/src/mcp/workspace.rs b/crates/ripr/src/mcp/workspace.rs
index a3d7b2730..aa83e5490 100644
--- a/crates/ripr/src/mcp/workspace.rs
+++ b/crates/ripr/src/mcp/workspace.rs
@@ -725,7 +725,10 @@ impl WorkspaceSession {
}
};
let recovery_for_document = || -> &'static str {
- if shell_bytes > super::MAX_TOOL_DOCUMENT_BYTES
+ // The final document guard already established overflow. Include
+ // the metadata reserve when attributing it: a zero-page shell
+ // can fit while the caller's final offset pushes it over.
+ if shell_bytes.saturating_add(reserve) > super::MAX_TOOL_DOCUMENT_BYTES
&& shell_without_filter_bytes.saturating_add(reserve)
<= super::MAX_TOOL_DOCUMENT_BYTES
{
diff --git a/crates/ripr/tests/mcp_stdio.rs b/crates/ripr/tests/mcp_stdio.rs
index d0d4ab94c..aa1b364ed 100644
--- a/crates/ripr/tests/mcp_stdio.rs
+++ b/crates/ripr/tests/mcp_stdio.rs
@@ -2358,6 +2358,13 @@ fn empty_gap_pages_keep_structured_outcomes_at_the_response_bound() -> Result<()
);
let mut session = SequentialStdio::spawn(&root)?;
let discovery = session.call("empty-discover", "server/discover", json!({}), timeout)?;
+ let fixture_tree =
+ common::fixture_git::fixture_git_output(&root, &["rev-parse", "HEAD^{tree}"])?;
+ eprintln!(
+ "empty-page fixture_tree={} server_pid={}",
+ fixture_tree.trim(),
+ session.child.id()
+ );
if discovery.get("result").is_none() {
return Err("empty-page fixture failed discovery".into());
}
@@ -2461,23 +2468,164 @@ fn empty_gap_pages_keep_structured_outcomes_at_the_response_bound() -> Result<()
.pointer("/result/structuredContent/failure/recovery")
.and_then(Value::as_str)
.ok_or("empty-page refusal omitted recovery")?;
- if !recovery.contains("ripr://snapshot/{snapshot_id}")
- || !recovery.contains("ripr_get_gap")
+ if !recovery.contains("echoed filter value")
+ || !recovery.contains("narrow the file/class/language filter")
+ || !recovery.contains("retry ripr_list_gaps")
+ || recovery.contains("ripr://snapshot")
|| serde_json::to_vec(&refused)
.map_err(|error| error.to_string())?
.len()
> RESPONSE_BOUND
{
return Err(format!(
- "empty {field} refusal lost its bounded identity recovery"
+ "empty {field} refusal lost its bounded filter recovery: {recovery}"
+ ));
+ }
+ }
+ }
+ // Independently size ordinary ASCII echoes around the raw-document
+ // ceiling. These envelopes still fit, so a refusal reaches the raw
+ // document guard rather than the structured-envelope guard.
+ const DOCUMENT_BOUND: usize = RESPONSE_BOUND / 2 - 256;
+ let seed = session.call_tool("raw-seed", "ripr_list_gaps", json!({"file": "x"}), timeout)?;
+ let seed = structured_tool_success(&seed, "raw-boundary seed")?;
+ if seed["items"] != json!([])
+ || seed["filtered"] != 0
+ || seed["selected"] != all["selected"]
+ || seed["snapshot_id"] != snapshot_id
+ {
+ return Err("raw-boundary seed lost its nonempty selection or empty page".into());
+ }
+ let seed_bytes = serde_json::to_vec(&seed)
+ .map_err(|error| error.to_string())?
+ .len();
+ let offset_growth = usize::MAX.to_string().len() - 1;
+ for (label, shell_bytes, offset, must_refuse) in [
+ ("reserve-only", DOCUMENT_BOUND - 255, 0, false),
+ ("exact-ceiling", DOCUMENT_BOUND, 0, false),
+ (
+ "metadata-exact-ceiling",
+ DOCUMENT_BOUND - offset_growth,
+ usize::MAX,
+ false,
+ ),
+ ("metadata-overflow", DOCUMENT_BOUND, 10, true),
+ (
+ "wide-offset-overflow",
+ DOCUMENT_BOUND - offset_growth + 1,
+ usize::MAX,
+ true,
+ ),
+ ("shell-overflow", DOCUMENT_BOUND + 1, 0, true),
+ ] {
+ let filler_len = shell_bytes
+ .checked_sub(seed_bytes)
+ .and_then(|difference| difference.checked_add(1))
+ .ok_or("raw-boundary fixture shell already exceeds the target")?;
+ let filter = "x".repeat(filler_len);
+ let mut expected = seed.clone();
+ expected["filters"]["file"] = json!(filter);
+ expected["page"]["offset"] = json!(offset);
+ let text = serde_json::to_string(&expected).map_err(|error| error.to_string())?;
+ let final_bytes = text.len();
+ let envelope = json!({
+ "content": [{"type": "text", "text": text}],
+ "structuredContent": expected,
+ "isError": false,
+ });
+ let envelope_bytes = serde_json::to_vec(&envelope)
+ .map_err(|error| error.to_string())?
+ .len();
+ let id_bytes = serde_json::to_vec("raw-boundary")
+ .map_err(|error| error.to_string())?
+ .len();
+ let envelope_budget = RESPONSE_BOUND - 128 - id_bytes;
+ let mut without_filter = seed.clone();
+ without_filter["filters"]["file"] = Value::Null;
+ let without_filter_bytes = serde_json::to_vec(&without_filter)
+ .map_err(|error| error.to_string())?
+ .len();
+ if envelope_bytes > envelope_budget
+ || (final_bytes > DOCUMENT_BOUND) != must_refuse
+ || without_filter_bytes + 256 > DOCUMENT_BOUND
+ {
+ return Err(format!(
+ "{label} missed raw-only interval: shell={shell_bytes}, final={final_bytes}, envelope={envelope_bytes}/{envelope_budget}, no-filter={without_filter_bytes}"
+ ));
+ }
+ eprintln!(
+ "raw {label}: shell={shell_bytes} final={final_bytes} envelope={envelope_bytes}/{envelope_budget} no-filter={without_filter_bytes}"
+ );
+ let response = session.call_tool(
+ "raw-boundary",
+ "ripr_list_gaps",
+ json!({"file": filter, "offset": offset}),
+ timeout,
+ )?;
+ if serde_json::to_vec(&response)
+ .map_err(|error| error.to_string())?
+ .len()
+ > RESPONSE_BOUND
+ {
+ return Err(format!("{label} exceeded the wire bound"));
+ }
+ if must_refuse {
+ let failure = response
+ .pointer("/result/structuredContent/failure")
+ .ok_or_else(|| format!("{label} omitted typed refusal"))?;
+ let recovery = failure["recovery"]
+ .as_str()
+ .ok_or("raw-boundary refusal omitted recovery")?;
+ if response.get("error").is_some()
+ || response.pointer("/result/isError") != Some(&json!(true))
+ || response.pointer("/result/structuredContent/schema_version")
+ != Some(&json!("ripr-mcp-gap-list-v3"))
+ || failure["code"] != "result_too_large"
+ || failure["data"]["current_snapshot_id"] != snapshot_id
+ || !failure["detail"]
+ .as_str()
+ .is_some_and(|detail| detail.contains("page ceiling"))
+ || !recovery.contains("echoed filter value")
+ || !recovery.contains("retry ripr_list_gaps")
+ || recovery.contains("ripr://snapshot")
+ {
+ return Err(format!(
+ "{label} lost raw-document filter recovery: {failure}"
));
}
+ } else if structured_tool_success(&response, label)? != expected {
+ return Err(format!(
+ "{label} changed the independently sized fitting document"
+ ));
}
}
let recovered = session.call_tool("empty-recovered", "ripr_list_gaps", json!({}), timeout)?;
if structured_tool_success(&recovered, "same-session recovery")? != all {
return Err("empty-page refusals changed the completed snapshot or selection".into());
}
+ eprintln!(
+ "empty-page healthy recovery snapshot={snapshot_id} selected={}",
+ all["selected"]
+ );
+ session.stdin = None;
+ let deadline = Instant::now() + timeout;
+ let status = loop {
+ if let Some(status) = session
+ .child
+ .try_wait()
+ .map_err(|error| error.to_string())?
+ {
+ break status;
+ }
+ if Instant::now() >= deadline {
+ return Err("empty-page server did not exit after input closed".into());
+ }
+ std::thread::sleep(Duration::from_millis(10));
+ };
+ eprintln!("empty-page server_pid={} exit={status}", session.child.id());
+ if !status.success() {
+ return Err(format!("empty-page server exited unsuccessfully: {status}"));
+ }
Ok(())
}
diff --git a/docs/interop/mcp.md b/docs/interop/mcp.md
index e54c9726f..c663e4290 100644
--- a/docs/interop/mcp.md
+++ b/docs/interop/mcp.md
@@ -311,9 +311,12 @@ under the 128-KiB response bound, including empty pages whose echoed filters
can overflow the structured envelope while the raw document still fits.
Those pages return the existing typed `result_too_large` refusal with the
current snapshot identity. Only a listing that cannot fit even one
-page — an omission disclosure alone over the ceiling — fails closed with
-`result_too_large` naming `ripr://snapshot/{snapshot_id}` as the identity
-route. Other tool responses carry the document once at full fidelity:
+page fails closed with `result_too_large`: when the echoed filter causes
+the overflow, including final page metadata crossing the document ceiling,
+the recovery says to narrow the filter and retry `ripr_list_gaps`. Other
+non-pageable overflows — for example an omission disclosure alone over the
+ceiling — name `ripr://snapshot/{snapshot_id}` as the identity route.
+Other tool responses carry the document once at full fidelity:
`content[0].text` is the compact JSON serialization, and
`structuredContent` repeats it in every successful response. Each tool
advertises an `outputSchema`, so a success never ships without its
diff --git a/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md b/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
index 747c71e40..09cc95921 100644
--- a/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
+++ b/docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
@@ -206,8 +206,9 @@ official SDK transport:
a refresh between pages fails closed with `stale_snapshot` instead of
mixing snapshots. Only a listing that cannot fit even one page fails
closed with `result_too_large`: when the echoed filter value itself is
- what pushes the shell past the bound — the same shell with an empty
- filter echo fits — the refusal names the filter as the shrinkable bound,
+ what pushes the page past the bound, including its final metadata — the
+ same shell with an empty filter echo fits — the refusal names the filter
+ as the shrinkable bound,
because the snapshot identity route cannot fix a filter-driven overflow;
for every other non-pageable disclosure (for example an omission
disclosure alone over the ceiling) the refusal names
@@ -445,8 +446,9 @@ is not evidence that a resource with a particular identity exists.
- `crates/ripr/tests/mcp_stdio.rs::empty_gap_pages_keep_structured_outcomes_at_the_response_bound`
— real committed analysis with nonempty subjects before filtering, fitting
empty pages, independently sized structured-envelope overflow below the
- raw-document ceiling, raw-document overflow, the `file` and `language` filters,
- typed refusals bound to the current snapshot, and same-session recovery.
+ raw-document ceiling, the `file` filter, raw-document metadata overflow,
+ reserve-only and exact-ceiling success controls, typed refusals bound to
+ the current snapshot, same-session recovery, and a clean server exit.
- `crates/ripr/src/mcp/workspace.rs::tests::list_gaps_overflow_recovery_names_the_shrinkable_cause`
— filter-driven shell overflow names the filter; shell-driven overflow
keeps the snapshot identity route.
--
2.52.0
|
|
Private contribution offered for canonical-owner selection: Bounded evidence: the extended real-stdio test failed at the intended metadata-overflow assertion on test-only The isolated proposal in coordination6368843134 has the same stated repair intent but supplies no exact patch identity. Byte equivalence and conflicts remain unverified. Canonical custody stays with |
…e refusal (#9895) The discrimination in this slice names the shrinkable cause: when the echoed filter value is what pushes the empty-page shell past the structured-envelope bound, the refusal recovery must name the filter and retrying ripr_list_gaps - not the snapshot identity route, which the same echo would overflow again. The pre-existing stdio witness still expected the historical identity-route recovery for that exact stimulus; align it (and the spec test mapping) with the unit-pinned rule.
…rflow attribution (#9895) recovery_for_document compared the raw shell against the ceiling while the page budget and the rendered document both carry the reserve: a shell that fits raw but overflows once the echoed window gains a digit was attributed to the snapshot identity route even though dropping the echo leaves a fitting shell. Charge the reserve on the overflow side (exact-head review, empirically confirmed with a real binary) and pin the boundary with a unit test: the edge echo refuses at offset ten with the filter-named recovery, and the reserve-only control (shell within 255 bytes of the ceiling, widest window echo) still ships.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Canonical-successor follow-through at 17edddf: the stdio assertion and reserve attribution repairs are now present, but the interop documentation finding from review 6365864695 remains in docs/interop/mcp.md lines 313–316. That text still describes omission-only overflow and snapshot identity rather than the filter-driven exception/recovery. Please finish this already-diagnosed documentation correction in the existing candidate and record which proposed repairs were adopted or superseded. The current canonical patch is not either complete five-file proposal (18ff49a or b61daf8), so their native receipts must retain their original source identities. Reuse the genuine stdio controls on the actual adopted raw-document boundary, then refresh affected exact-head review and required qualification. No new parallel writer, build or CI request was started by this audit. Source fixes are acknowledged; complete repair/merge clearance is not yet established. |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm the stdio oracle verifies the filter recovery and bounded refusal, but not the retained identity-route fallback or the raw-document branch.
- Confirm the specification maps only the primary unit oracle and omits the added reserve-boundary unit from its listed evidence.
- Confirm the raw-document recovery closure charges the reserve consistently with page-budget arithmetic, but its final rendered-document refusal can occur after the envelope probe has already accepted the shell.
Refuted
- The filterless counterfactual probe could extend or alias the borrowed filter beyond its valid scope and create a native lifetime violation.; refuted because: The probe replaces the filter with GapListFilter::default() and immediately constructs an owned GapListScope; no reference to the original filter is stored, and no unsafe code is involved.
- The new attribution could reuse a stale shell length after the active response view changes.; refuted because: No shared mutable buffer or typed-array view exists in the changed Rust path; each relevant shell is rendered and measured into an owned byte count before the decision.
- The new empty-filter counterfactual could race with, detach from, or be invalidated by the original filter before attribution.; refuted because: No worker handoff, async await, callback, FFI, GC handle, or transfer operation occurs between borrowing the filter and serializing the probe documents; both probes use the same synchronous session state and scope lifetime.
- The change needs a broader architectural refactor or unrelated changes to remain correct.; refuted because: The diff confines behavior to two list_gaps refusal branches, adds two named recovery constants, and updates focused unit, stdio, spec, and traceability surfaces. The complete patch shown also includes the previously required stdio oracle and reserve-aware fix.
Evidence gaps
- Full native compilation and test execution remain pending because the ripr sensor failed and cargo-test is scheduled late.
- Model proof intent was rejected by deterministic validation.
- The PR body claims both structured-envelope and raw-document paths are fixed, but the spec mapping names only the newer unit test and does not explicitly document the reserve-aware document-boundary control.
|
Terminal successor qualification finding, canonical head17edddf0a9f17454f4841ee0ef248110d72688a3; existing writer retains repair custody. Required39997538215 producer120565282928 and Result120571253285 are FAILURE. Actual producer checkoutd0e46a77a379b75921413ff6b6edb1c59ee8b4ef merges this head into3d9ce73d181087e99637e7da519e8b01468dca78. Strict workspace Clippy exited101 before required Rust tests: crates/ripr/src/mcp/workspace.rs:2773, new boundary-test binary search This is additional to already-recorded interop-doc correction6370689737 and adopted-source proof/proposal disposition. Join those repairs in the existing candidate, then affected exact-head review and normal successor qualification. No unchanged rerun, competing source patch/build, duplicate qualification or ownership transfer was initiated here. The proposal-native receipts keep their original subjects; they are not this failed successor's workspace proof. |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Exact-current-head review: REPAIR_REQUIRED for documentation; required qualification remains active.
The one-line Clippy repair is adopted in a746745 (tree55bea9fa44ee2817cf19193d5af6eb0bea2b825e). Its complete delta from17edddf is the unit's (low + high).div_ceil(2). No production-code/budget/parser change or weakened lint/oracle was introduced.
The already-recorded blocking contract finding in handoff6370689737 is still present: docs/interop/mcp.md313–316 remains omission-only and unconditionally names snapshot identity, despite the served filter recovery. This head changes no documentation. The spec also still omits the reserve unit and overstates this stdio test's language/raw-branch coverage; the existing continuation contains the precise bounded correction and changelog disposition. Please finish the documentation through the existing writer before treating this PR as merge-ready. Do not apply the whole b159c34 patch again: its midpoint is already adopted. The original docs-only c3337635 patch applies cleanly to a746745 and reconstructs tree1cbfb5fdfef468e71107af7c15653f351a1b69d2.
Observed proof and applicability: clean current-main d84b8be strict impacted-package/all-target Clippy passed0, establishing the17edddf lint as candidate-introduced. Isolated b159c34 passed the same strict Clippy0, changed-file Rustfmt0 and the actual reserve unit1/10,995 filtered. All Rust sources/build manifests/configs are byte-identical between b159c34 and canonical a746745; the difference is only the four documentation/traceability/changelog files above. These are b159c34 executions with explicit unaffected-scope applicability, not relabeled a746745 executions.
Fresh genuine stdio execution was separately bound to canonical17edddf producer SHA256e255ba3d8a4a2514ecb83b8c9fac39f8dd33eab8855b33d6bd27539dd68c5167, with inspected immutable external client26e42063 (source18ff49a, client role only). All six independently sized raw-boundary controls and same-session healthy recovery passed; serverPID17012 exited0/reaped. A newly executed old-main97df producer negative control (SHA256711e08d1) failed101 at the intended obsolete identity hint, after which the canonical17edddf producer was restored and rehashed. No18ff49a result is transferred to a different canonical patch. The17edddf→a746745 delta is confined to cfg(test) midpoint arithmetic; no changed production runtime dimension was identified.
Preserve active required40003373337/producer120585390535 and companionCI40003372927; no cancellation, Draft toggle, label reapplication, source push or new qualification was performed. Inspect their actual checkout/parents, terminal stages and complete denominators before final review. No canonical documentation adoption, full successor qualification, current-main native pass or merge is claimed. Current source author retains repair custody; reviewed normal merge is authorized only after documentation disposition, current-head review and required checks.
EffortlessSteven
left a comment
There was a problem hiding this comment.
New executable review finding on current head a746745: REPAIR_REQUIRED — final page metadata can also cross the id-aware structured-envelope bound, leaving the wrong snapshot-route recovery.
At crates/ripr/src/mcp/workspace.rs:708–728, recovery_for_envelope still attributes using the zero-page shell. structured_fit later measures the requested page window. A valid large request ID makes this boundary reachable below the raw-document ceiling. The reserve fix in17edddf repairs the raw-document branch only.
Fresh real-stdio experiment (18:59:11 UTC), same committed B4 fixture tree4a29ac90ca6d3a4db4317738c9c8c1670b0452e7, one selected subject, producerPID20441, current snapshot933153e594467557273af1f20999c45cfdb712860509d96fb89ef033099f5dd8:
- ASCII ID length16,000, serialized16,002 (<16,384 admission ceiling): id-aware budget114,942.
- ASCII file filter length55,714, offset0: raw57,380, structured envelope114,942; actual success, reply131,001 bytes.
- SAME ID/filter, offset10: raw57,381 (<65,280), structured114,944; typed result_too_large returns read identities through ripr://snapshot/{snapshot_id} ..., the wrong hint. Offset9,999,999 reproduces it (structured114,954).
- Paired filterless disclosures at those requested windows would fit:3,518/3,528 bytes. Actually narrowing the filter to "x" at offset10 succeeds in the SAME server/snapshot. A following unfiltered listing exactly matches the initial nonempty listing.
- All replies id-correlated, bounded and schema-checked; producer exited0/reaped; fixture removed. The client exited2 specifically for the two wrong-recovery controls, not a transport failure.
Execution identity stays 17edddf, immutable producer SHA256e255ba3d8a4a2514ecb83b8c9fac39f8dd33eab8855b33d6bd27539dd68c5167. This is a new execution, not transferred18ff49a proof. Source comparison shows a746745's sole delta is cfg(test) midpoint arithmetic; the affected production closure is byte-identical. The old proof is not mislabeled as an a746745 executable.
Existing author retains custody. Please repair the envelope attribution using paired with/without-filter MINIMUM pages rendered with the SAME requested final page fields, preserving filtered counts and the identity fallback for a non-fitting item/disclosure. Simply removing shell_envelope_overflows would misattribute first-item overflow. I am preparing an isolated owner-readable contribution for this newly proven gap, joined with the pending documentation correction; no canonical branch push, CI rerun or build duplication is authorized by this review. Preserve active required40003373337/producer120585390535. Even a successful existing run cannot close this untested boundary.
|
Post-merge reconciliation — implementation landed, acceptance remains unresolved. Existing owner merged unchangeda746745cddb9ea9d854a7c9c09b4cb63a14c017b at19:44:16UTC asabc13531e4ffdf837b5f54d99c19ee0a9c972c23. Retained integration lead did not merge it. Fetched main4607426e5b5f5ab288d501b52751bc49d24bbe4c contains the squash. Actual parent409081896131b596643a11a795acbecab8c0270b +candidate composes to landed tree71d2187443c59cc6b164e06a9808c6be19911005. This verifies landing/composition, not closure of the blocking reviews. Two outstanding findings are preserved:
Review5633165539 says an isolated owner-readable contribution is being prepared for the envelope gap joined with docs. Bounded open follow-up PR lookup naming9970 found none. Existing semantic/source custody remains; no takeover or third patch is created. Next accepted-owner step is consume/select that retained contribution and publish a bounded follow-up against actual main, preserving requested-window counterfactuals, non-fitting-item/disclosure identity fallback and original byte/selection controls, then exact-source independent review and normal admitted proof/qualification. A new source-bound follow-up is needed; do not replay the whole obsolete proposal, retry unchanged qualification, weaken bounds or auto-revert. Original green qualification below retains its actual executed subject and does not disprove this untested boundary. No later owner review disposition resolves either finding in the inspected records. No source edit, CI request, revert, access change, release or deployment was made by this reconciliation. Historical pre-merge terminal receipt (its open/Ready wording records that earlier observation): Terminal current-head qualification receipt; REPAIR_REQUIRED for documentation remains. Canonical head stilla746745cddb9ea9d854a7c9c09b4cb63a14c017b, open/Ready/unmerged; existing source writer retains custody. This green result does not adopt docs-only c3337635 or grant merge clearance. Required40003373337 producer120585390535 and Result120611128858 completed SUCCESS; Result app15368 binds exact head. Direct logs plus Git object verify physical checkout83ed8910e0252d4f4285e45ea410fc0df9e61676, tree0300ad5ef4559cf00955c239836eb694d32d0a9f, ordered parentsf63a722a243bcd9574288ccf28ba1ec63f41d549 +candidate.20,252nextest passed/5skipped; doctests2passed/1ignored; strictClippy, policy, goldens, fixture contracts, all4corpora,PR evidence and Schema sweep passed. Schema names the same merge, rows digest8ac8aa8a70df72736f7b64dcf9c4b6e729a4482d4735c65d50902db23520edda. Scratch/optional advisory operations skipped, not additional passes. Named discriminators actually PASS in this run: list_gaps_overflow_recovery_names_the_shrinkable_cause; document_branch_attribution_charges_the_page_metadata_reserve; empty_gap_pages_keep_structured_outcomes_at_the_response_bound. The canonical runtime-proof uncertainty is separately resolved by exact-current review5632881552 and its genuine canonical17edddf six-control execution/old-main negative with explicit production applicability to a746745. Those original focused proof subjects are preserved; no obsolete adopted-source runtime gap is repeated here. Remaining blocker: interop/spec/test-mapping/traceability/changelog correction documented in5632881552 is unadopted. Existing docs-only c3337635 applies to this head; do not replay the already-adopted midpoint repair or overwrite production. Canonical writer must adopt/disposition that narrow documentation repair, then refresh affected exact-head review and normal successor gates. This receipt does not claim latest-main composition execution, final integration approval, native32-bit behavior or acceptance of a future head. No unchanged rerun, new CI/build, source push, custody transfer, denied-artifact read, release/deploy/access change or merge was initiated. |
Governing issue or accepted claim: #9895 (MCP sweep: a huge list_gaps filter produces a wrong recovery hint)
Acceptance delta (one sentence): when the echoed filter value is what pushes the empty-page shell past the response bound, the typed result_too_large refusal now names the filter as the shrinkable bound instead of pointing at the ripr://snapshot/{snapshot_id} identity route, which cannot fix an echo-driven overflow.
Context
This slice was salvaged from #9959 (closed as superseded): its argument-message half landed more comprehensively via #9945 while #9959 queued and went conflicted, but that half never touched this workspace-side recovery. This PR is the independently valuable remainder, rebased onto current main.
What was wrong
list_gaps measures a zeroed-page shell document to size the page budget. A huge filter echo (e.g. a very long file path) can make even that shell exceed the bound. The old recovery for that refusal always named the snapshot identity route — advice that is truthful for omission-driven overflow but useless here: narrowing ripr://snapshot reads cannot shrink the caller's filter echo.
Fix
Evidence
Rollback
Revert; overflow recovery returns to always naming the snapshot identity route.
Non-goals: argument parsing messages (owned by #9945); the remaining #9895 items (SIGTERM git child, resource URI trailing slash, host path in next_command).