Repository navigation
fix(mcp): conjoin the shared repair gate into MCP repair readiness (#8717) - #9105
Conversation
…8717) ripr_prepare_repair, ripr_list_gaps and ripr_get_gap projected repair readiness from finding-level producer facts alone, so an item whose seam `ripr repair` refuses (for example a match arm its existing tests already grip) came back repair_packet_ready:true with an awaiting_edit attempt. The refresh now resolves every committed finding through the same resolver `ripr repair <finding-id>` uses (resolve_repair_subject_in, extracted from resolve_repair_subject_outcome) over its diff-scoped seam inventory, and the verdict is a conjunct of readiness projected before the snapshot identity is computed. A refused item returns repair_packet_ready:false, no attempt, and a typed seam_already_gripped / seam_gate_refused / seam_ambiguous / seam_not_found reason carrying the validator's own explanation. Real-stdio parity controls compare MCP against `ripr repair` in both directions. The gap-filter fixture pinned two exposed items as repair-ready (the inverted gate); it now uses the B4 three-input shape that the shared validator admits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 27 minutes. View limit details
Comment |
|
Red/green recorded on the new control: with the seam verdict neutralized ( Generated by Claude Code |
Resolve the mcp_stdio.rs test-append conflict by keeping both the #8717 repair-parity test and the #8847 pre-cap related-test totals test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Status on head Known limits, not fixed here:
I'll file the first as a follow-up issue so it isn't lost. Generated by Claude Code |
…gate parity tests (#8717) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo
|
Rust-only feature lane on head
Neither has a fix on main yet, because #9069 owns both. I'm leaving Generated by Claude Code |
There was a problem hiding this comment.
Confirmed findings
- Doc parity:
docs/interop/mcp.mdis not updated with the four new typed codes (seam_already_gripped,seam_gate_refused,seam_ambiguous,seam_not_found); the spec is updated, but caller-facing interop doc lists codes externally. - docs/interop/mcp.md was not updated to enumerate the four new typed seam reasons (seam_already_gripped, seam_gate_refused, seam_ambiguous, seam_not_found), so external MCP integrators have no canonical reference. Author flagged this as a known limit and committed only the SPEC-0214 update.
Verification questions
- Confirm shared resolver is reused and verdict is conjunct; RefusalKind mapping covers the grip case but every non-grip Ineligible collapses to seam_gate_refused, losing visibility into route-not-ready vs policy omission in the readiness block.
- Confirm
mcp_readiness_never_exceeds_the_cli_repair_gatecompares three MCP surfaces (list, get_gap, prepare) against CLI stdout/stderr strings. The CLI comparison parses human prose ('not repair-eligible', 'already grip'); if CLI text changes unrelatedly the test breaks despite parity holding. - Confirm gap filter fixture renames test fns to match B4 boundary shape; this could leak across sessions via
temp_dir()/ripr-mcp-journey-pricing-*if dedup stamp drifts. - Confirm negative parity control proves refusal implies not-ready, but not that every MCP refusal is a CLI refusal.
- Confirm negative parity test asserts cli_refusals>=2; fixture may pass via non-arm items, masking arm-specific regressions if items change.
Refuted
- Fixture weakened to pass the new test; refuted because: Fixture rewrite adds B4 three-input shape (below/boundary/far-above), which is the exact shape the shared validator admits on a weak boundary; pre-existing filter assertions are preserved.
- Extracting the shared resolver could silently change CLI route behavior.; refuted because: The CLI wrapper now calls the extracted core, and
translate_agent_repair_seam_idretains the same seam id and reason; only the typed refusal kind was added. - MCP repair readiness runs a parallel validator that diverges from the CLI gate; refuted because: The diff extracts resolve_repair_subject_in (same logic, no behavior change for the CLI), threads a SeamInventory once per refresh through both SeamAdmission::evaluate and bind_snapshot_card_producers, and projects the verdict as a conjunct before snapshot id — there is no parallel validator; remaining scope surface (diff-scoped inventory vs repo-wide) is documented as a known limit, not a second gate.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- Diff-scoped MCP resolution may conservatively refuse an item admitted by the CLI's full inventory, contradicting the issue's parity claim but not the stated fail-closed limit.
There was a problem hiding this comment.
Confirmed findings
- crates/ripr/src/mcp/repair_card.rs:119 —
inventory_changed_filesre-derives changed files fromFinding::probe.location.fileviafinding_location_text, decoding the stable wire spelling. The previous caller passedGapItem.file(already decoded). Diff scope now depends on the producer'sprobe.location.fileonly; an item whoseprobe.location.fileis empty or normalized differently loses its changed-file match and silently produces an empty candidate_seam inventory, yielding a fail-closed SEAM_NOT_FOUND for what the CLI gate would call seam-eligible. - RIPR-SPEC-0214 lists the four new refusal codes but the changelog fragment (
changelog.d/8717-mcp-readiness-seam-gate-parity.md) enumerates only the four MCP reasons without naming the snapshot identity dependency added in workspace.rs:1336-1345 (inventory now feeds identity before snapshot id). Documentation parity drift between spec, interop doc, changelog, and source.
Verification questions
- Confirm pre-existing control
refreshed_gap_filters_narrow_real_stdio_...had its fixture mutated to B4 three-input shape so the shared validator admits the seams; the assertion list was preserved. Confirm the fix is fixture-only (no asset weakening). mcp_stdio fixture now writes pricing.rs with three pinned inputs per function; verify that no other control reading pricing.rs exhausts the new shape.
Refuted
- The new controls are absent from the machine-readable spec-to-test graph.; refuted because: The RIGHT-side traceability diff adds all four new controls, and the spec now names the two real-stdio parity tests.
- Finding-level readiness block and snapshot identity could disagree because seam verdict is folded after the hash bind point.; refuted because: Diff structures projection so seam verdict is conjoined into the RepairReadiness object used by gap_evidence_core before serialized_evidence_identity produces sha256; readiness detail drives the readiness block. Identity and readiness stay one decision.
Evidence gaps
- Traceability registered both new parity stdio tests plus two gaps.rs unit tests under RIPR-SPEC-0214 in 6084c28; check-traceability not run locally so hosted CI is first execution.
- Hosted execution of the Rust integration lane remains the final trust-affecting proof because the local mcp_stdio run was compile-only.
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- Caller-facing MCP interop documentation omits four newly emitted typed ineligibility codes.
- MCP diff-scoped inventory can diverge from the CLI repository-wide inventory when that inventory is truncated or large.
- Author admits RepairStartGate start-time checks (
recommended_test_is_repair_edit_target,held_inline_target) and repo-wide seam truncation are not applied in MCP admission. Probe-id ambiguity only runs over diff-scoped inventory, smaller than CLI's repo-wide inventory. - Residual risk: MCP uses diff-scoped seam inventory while CLI uses repo-wide; author flagged known limit but didn't fix. For repos near the seam limit, MCP could resolve an item ambiguously that CLI pins uniquely. ARCHITECTURE-level: bounded diff-scoped inventory is intentional freshness scope, not an unbounded surface omission.
There was a problem hiding this comment.
Confirmed findings
- crates/ripr/src/mcp/repair_card.rs:119 — inventory_changed_files now re-decodes Finding::probe.location.file via finding_location_text while the previous caller used GapItem.file (already decoded and the documented wire spelling). This widens the input dependency from GapItem to Finding; if probe.location.file is empty or differs from the item's wire file, diff scope silently narrows. Worth a one-line invariant comment or asserting the two strings agree.
- The evaluated-admission fail-closed default (
SEAM_NOT_FOUNDwhenby_findinglacks the key) is only reachable from production if a finding is ever passed toverdict()outside theevaluate()map.from_output_admittedandGapItem::from_finding_admittedalways feed the same&[Finding], so this rule guards a hypothetical non-refresh caller only. Document that explicitly, or remove theevaluatedflag and theunevaluated()test-only path so production cannot call into a partially-evaluated admission. (crates/ripr/src/mcp/repair_admission.rs:102). - Documentation parity drift between RIPR-SPEC-0214 (updated), the changelog (only seams, omits snapshot-identity dependency), and the interop doc (unmentioned). Already in seeded reviews; not blocking for this PR.
- docs/interop/mcp.md is not updated with the four new typed seam codes; SPEC-0214 and changelog are. Author flagged this as a known limit and committed only the SPEC-0214 update. External MCP integrators lack a canonical reference for the new refusal codes.
- crates/ripr/src/mcp/gaps.rs:1202 — evaluated_admission_refuses_an_uncovered_finding only covers the empty-findings fallback. Add a case where evaluate() is called with a non-empty findings slice and verdict() is queried for a finding id not in by_finding; this is the production-shaped uncovered path and the only one the snapshot commit can hit when the inventory is non-empty.
- verdict_for collapses every non-AlreadyGripped RefusalKind into SEAM_GATE_REFUSED. Callers can distinguish grip from gate-refusal but cannot distinguish route-not-ready from cross-language-visibility from policy omission within gate refusals. The PR narrative acknowledges the gate's typed coverage but the four-code contract is coarser than the underlying RefusalKind. Consider adding a sub-detail or per-kind mapping if external integrators need it. (crates/ripr/src/mcp/repair_admission.rs:114).
Verification questions
- Confirm the positive parity test mcp_ready_item_is_the_item_the_cli_repair_gate_admits requires install_b4_repair_ready_fixture which is referenced but not in the diff; if that fixture is no longer in tree on the served head, the green proof depends on a pre-existing surface. Lane is not blocked — PR body says it is — but a hosted-CI proof receipt is missing for it.
- Confirm mcp_readiness_never_exceeds_the_cli_repair_gate asserts the gripped arm refusal text contains both 'not repair-eligible' and 'already grip'. These are CLI prose fragments; any unrelated CLI reword makes the test fail despite parity still holding, breaking the proof's smallest-scope guarantee. Assert against the typed seam_already_gripped code and exit code only, or assert against a stable string constant. (crates/ripr/tests/mcp_stdio.rs:3540).
- Confirm crates/ripr/src/mcp/gaps.rs:1145 —
evaluated_admission_refuses_an_uncovered_findingconstructsAgentBriefPolicy::from_config(&RiprConfig::default())and assertsverdict("probe:uncovered")returnsSEAM_NOT_FOUND. The fail-closed path throughverdict()requiresevaluated == trueand a missing key; with an emptyfindingsslice,by_findingis empty and the missing-key branch fires. This proves the missing-key branch but does not proveresolve_repair_subject_inreturnsUnknownfor an arbitrary finding id over an empty inventory. Add an assertion that an empty inventory plus a finding whose id matches no seam yields the same code, to lock the route the production case actually exercises. - Confirm positive parity test asserts
prepare["attempt"]["finding_id"]is the very id the CLI repair tool admits, but theattemptobject schema is aRepairAttemptprojection. Iffinding_idwas renamed when serializing the attempt (e.g. the attempt uses the canonical gap id), the comparison silently falls through and the test passes against the wrong id. The negative parity test does not cross-check the attempt id. - Confirm evaluated_admission_refuses_an_uncovered_finding exercises a finding id the evaluate() loop never produced, proving the lookup fallback. It does not exercise a non-empty inventory with a finding id absent from inventory.
- Confirm
inventory_changed_filesnow usesfinding.probe.location.file(decoded once) instead of already-decodedGapItem.file. If the producer leaves the file empty or uses a different relative spelling, the diff-scope becomes empty and admission becomesSEAM_NOT_FOUNDfail-closed even when the seam exists in the workspace. The pre-existing test covers the in-root and encoded cases but not the empty/wrong-spelling case.
Resolve the squash-merge of #9105 by taking main's versions of the overlapping MCP files and reapplying the #9108 truncation delta. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo
Requested by Steven · project thread
Governing issue or accepted claim: #8717
Acceptance delta (one sentence):
ripr_prepare_repair,ripr_list_gapsandripr_get_gapnever report an item repair-ready (or create anawaiting_editattempt) when the shared repair gate behindripr repair <finding-id>refuses its seam, and return a typed refusal withrepair_packet_ready: falseinstead.Problem (reproduced on current main, binary built from
00c92f9c7)Corpus shaped like the probe (
c2:match k { Kind::A => 1, ... }changed on a branch,tests/t.rsassertingprice(Kind::A) == 1):ripr_prepare_repairforgap:rust:src/lib.rs:price:match_arm:match_arm:kind_arepair_packet_ready: true, attemptawaiting_editripr repair probe:src_lib.rs:match_arm:c3088e73ripr checkripr_get_repair_cardseam_not_foundRoot cause
mcp::gaps::RepairReadiness::from_findingdecides readiness from finding-level producer facts only (candidate actionability, discriminator, a strong related test on a test surface). The CLI gate is a seam-level decision:ripr repair <item>resolves the item to one seam and applies the repair-admission gate (repair_refusal: headline-eligible class, cross-language visibility, route readiness, brief policy). The producer's finding class (weakly_exposed) and the seam classifier (StronglyGripped) can disagree, and MCP never asked the seam validator, so it was a parallel and weaker authority.get_gapalso contradicted itself (readiness block "established" versus the unconfirmed discriminator text) because both read the same finding-only projection.Change
app::task_first: extractresolve_repair_subject_in(classified, policy, item)fromresolve_repair_subject_outcome(same logic, no behaviour change for the CLI);RepairSubjectOutcome::Ineligiblealso carries the gate'sRefusalKind.mcp/repair_admission.rs: at refresh, run that resolver once per committed finding over the refresh's diff-scoped seam inventory (gathered once and shared with the repair-card binder, so no second analysis) and produce aSeamVerdictper finding.RepairReadiness::with_seam_verdict: the verdict is a conjunct of readiness, projected before the snapshot identity is computed, so list summary,get_gapreadiness block,prepare_repairand the snapshot id carry one decision. Finding-level refusals remain the first failing gate. New typed reasons:seam_already_gripped,seam_gate_refused,seam_ambiguous,seam_not_found, each carrying the validator's own explanation. An evaluated admission fails closed for an uncovered finding.ripr_prepare_repairfor a refused item returns the existingisError: falsedocument withrepair_packet_ready: false, the typedineligibility.reason/detail, andattempt: null.Relation to #8638
Re-driven on the same build:
ripr_get_repair_carddoes not reproduceseam_not_foundfor repair-start seams on current main (theis_adultcorpus binds both items: the card forgap:rust:src/lib.rs:is_adult:return_value:...returns seamf52426b80ce2c527). The remainingseam_not_foundis for items whose seam is not headline-eligible (no canonical gap id, hence no card binding), which is the same fact the CLI states ("no seam ... binds this finding"). The shared root cause is MCP advertising readiness the seam layer does not support; after this change such an item is no longer called ready, so the two surfaces agree. Not closing #8638; it should be re-evaluated against the fixed behaviour. Also relates to #8717's proposed inversion fix: this PR addresses its exposed-item-is-ready half through the shared validator; the weak-item-with-named-missing-discriminator half (finding-level gates 2 and 3) is unchanged and still open there.Evidence
tools/p1.pydriver on the base build over the c2 corpus:price ... kind_apreparerepair_packet_ready: True, CLI refusal as above. After: same corpus returnsrepair_packet_ready: False,ineligibility.reason: seam_already_gripped, detail "the shared repair gate (ripr repair) names seam1ae02bb5ec445012... already grip it",attempt: null; theis_adultreturn-value item flips toseam_gate_refused("repair route not ready"), matchingripr repairexit 3.crates/ripr/tests/mcp_stdio.rs:mcp_readiness_never_exceeds_the_cli_repair_gate(negative parity: every MCP item thatripr repairrefuses is not ready on list, get_gap and prepare, with identical typed reason and no attempt; the gripped arm pinsseam_already_grippedand the CLI text) andmcp_ready_item_is_the_item_the_cli_repair_gate_admits(positive parity on B4).seam_verdict_is_a_conjunct_of_repair_readiness,evaluated_admission_refuses_an_uncovered_finding.refreshed_gap_filters_narrow_real_stdio_...pinned twoexposeditems as repair-ready;ripr repairrefuses both (exit 3, "repair route not ready"), i.e. it pinned the inverted gate. Its fixture now gives each function the B4 three-input shape that the shared validator admits, keeping the filter assertions intact.CARGO_BUILD_JOBS=2, shared target):cargo test -p ripr --lib mcp::171 passed;cargo test -p ripr --test mcp_stdio24 passed;mcp_sdk4,agentic_bench_mcp15 passed (before the fixture tweak, product code unchanged since);cargo xtask precommitexit 0 (after two retries where thecovered_byinstrument hit its 300 s timeout under cargo-lock contention; infrastructure, not a gate failure).Not done / limits
probe:id with unchanged twin seams could resolve more ambiguously under the CLI's full inventory than here.Generated by Claude Code