Skip to content

fix(mcp): ripr_refresh base argument, Git precondition in status, accurate attempt_not_found - #9075

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/mcp-refresh-recovery
Oct 21, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/mcp-refresh-recovery

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread
Governing issue or accepted claim: #9018
Acceptance delta (one sentence): An MCP agent on a non-main-default-branch repository can recover ripr_refresh through a working base argument, and status/not-found/cache wording no longer overstates what the server can do.

What changed

  • F3a: ripr_refresh accepts optional base (non-empty, <=256 bytes; validated by the shared base resolver, so --prefixed or unresolvable bases fail the attempt closed). Failure recovery for base_unresolvable now names the base argument instead of an unreachable CLI --base; the check failure stays typed through a new check_workspace_with_config_typed. Each refresh states its own base (omitted = default branch). Surfaced as requested_base on the refresh document, current_desired_input.base/base_revision in status, and scope.analyzed ("committed diff against base X"). No ripr mcp --base flag: a launch-time base would be a second, unchangeable source of truth.
  • F3b: status adds workspace.root.git_work_tree (detected/not_detected) plus a limitation; workspace_state keeps meaning "root discovered". Refresh on such a root recovers with a restart-inside-a-Git-work-tree route.
  • F4: behavior unchanged. The probe corpora lacked a .gitignore; the cache lives under target/ripr/. Documented in the refresh tool description, ripr mcp --help and docs/interop/mcp.md.
  • F10: attempt_not_found wording says session transactions are in-memory and never in the durable store.

Not changed: a failed refresh still returns isError:false (existing documented typed-document design).

Verification

  • Wire tests over real stdio (crates/ripr/tests/mcp_stdio.rs): trunk journey (fail -> recovery names base -> base:"trunk" completes with findings, status shows explicit base; --output=... and unknown refs fail closed without reaching Git as an option; bad argument shapes are -32602), no-Git-work-tree status, not-found wording. Existing scope/pre-call contract tests updated for the new schema. The tests could not pass on main by construction (argument rejected, no git_work_tree).
  • cargo test -p ripr --test mcp_stdio: 25 passed; cargo test -p ripr --lib mcp::: 169 passed; workspace_status lib tests: 25 passed.
  • cargo xtask precommit: first run failed only on a missing issue pointer in the changelog fragment (fixed) and a check-file-policy covered_by instrument timeout under shared-cargo-lock contention (infrastructure, not source); rerun result in a follow-up comment.

Generated by Claude Code

…urate attempt_not_found (#9018)

ripr_refresh gains an optional `base` revision so a repository whose default
branch is not main/master has a recovery route reachable from MCP; failure
recovery names it. Status reports root.git_work_tree and the requested base,
attempt_not_found no longer implies a durable store held session transactions,
and the target/ripr cache location is documented.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 84 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: a73d45f0-425f-4e93-8fc1-c03e074de786
📥 Commits

Reviewing files that changed from the base of the PR and between d5ede76 and ac628a2.

📒 Files selected for processing: 14
  • changelog.d/9018-mcp-refresh-base-and-status-honesty.md
  • crates/ripr/src/app.rs
  • crates/ripr/src/app/check.rs
  • crates/ripr/src/mcp/mod.rs
  • crates/ripr/src/mcp/protocol.rs
  • crates/ripr/src/mcp/repair.rs
  • crates/ripr/src/mcp/repair_card.rs
  • crates/ripr/src/mcp/server.rs
  • crates/ripr/src/mcp/workspace.rs
  • crates/ripr/src/workspace_status.rs
  • crates/ripr/tests/mcp_stdio.rs
  • crates/ripr/tests/support/mcp_scope_contract.rs
  • docs/interop/mcp.md
  • docs/specs/RIPR-SPEC-0211-mcp-workspace-session-evidence.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 21, 2026 06:19

EffortlessSteven commented Oct 21, 2026 •

Copy link
Copy Markdown
Member Author

Independent fresh-agent source review of head f06fbc8 found no blocking issues. It traced base validation, the check_failure projection, the git_work_tree probe and the not-found wording on the production path. The review ran no tests.

Optional items I'm leaving for a follow-up:

  • The failure detail still embeds the resolver's "Pass --base <ref>" CLI advice, next to the correct "base argument" recovery.
  • The warm-cache wording ignores RIPR_CACHE_DIR.
  • repository_root_unusable recovery text fits only the not-a-work-tree case.
  • A few docs still say "default-branch diff": the INSTRUCTIONS and STATUS_TOOL_DESCRIPTION strings in protocol.rs, RIPR-SPEC-0211, LLM_OPERATOR_GUIDE.md and the mcp.md prose.
  • snapshot_id doesn't hash base. The evidence is identical in that case, so it's harmless today.
  • There is no wire test for a base over 256 bytes.

The branch currently conflicts with main. I'm resolving that with a merge commit before applying merge-ready.


Generated by Claude Code

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed findings

  • A failed explicit-base refresh overwrites current_desired_input while the retained snapshot remains the previous default-base analysis.
  • analyzed_label interpolates the user-supplied base into a human-facing string without sanitization. The 256-byte cap and the JSON encoding make this safe on the wire, but a base containing backticks or unusual characters produces an awkward committed diff against base \weird`` label. Not a security or schema issue; cosmetic only.
  • crates/ripr/src/mcp/protocol.rs:66 — Update STATUS_TOOL_DESCRIPTION to state that current desired input uses the resolved default branch or the explicit refresh base, including base_revision when present. The current description contradicts the new explicit-base status document.
  • The workspace-status tool description remains stale for explicit-base sessions: it says current desired input is a diff against the default branch, while runtime can report base=explicit and base_revision=.

Verification questions

  • Confirm explicit unresolvable bases are tested for a failed attempt and retained last-known-good snapshot, but not for the specific recovery text expected by the implementation.
  • Confirm no wire test exercises the 256-byte upper bound on base; only minLength=1, wrong type, and unknown-property negative paths are covered.
  • Confirm the explicit-base wire test verifies status runtime fields but not that STATUS_TOOL_DESCRIPTION remains consistent with those fields.
  • Confirm the max 256-byte base limit is implemented but the added wire test covers empty, numeric, and unknown arguments only; no over-limit argument is sent.
  • Confirm a repository-wide sweep for remaining default-branch-only MCP wording is still warranted; this packet only exposes the changed protocol, workspace, tests, and documentation surfaces.

Refuted

  • The missing-Git status probe is an authoritative runtime check and therefore portable across all Git layouts.; refuted because: That stronger claim was not needed: the code explicitly presents it as a marker probe that may under-report exotic GIT_DIR layouts, while refresh remains authoritative.
  • The missing-Git-work-tree helper needs a broader unsafe/native helper-path review for this change.; refuted because: The helper only performs a bounded ancestor existence probe and does not invoke native code or alter memory ownership; unsafe-review reported no new gaps, while refresh remains authoritative.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 potential issues.

Devin Review

Comment thread crates/ripr/src/workspace_status.rs Resolved
Comment thread crates/ripr/src/mcp/protocol.rs Resolved
Comment thread crates/ripr/src/mcp/workspace.rs Resolved
…llers, number changelog fragment (#9018)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo
Resolve workspace.rs and mcp_stdio.rs conflicts preserving both sides. Harden git_work_tree_for: reject non-regular .git markers before opening and require the space in 'gitdir: '. Mention root.git_work_tree in the status tool description.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed findings

  • scope_disclosure's analyzed_label interpolates the user-supplied base into 'committed diff against base <X>' without sanitization; 256-byte cap + JSON encoding make this wire-safe but unusual characters produce awkward labels.
  • analyzed_label interpolates the user base into 'committed diff against base ...' without escaping backticks; cosmetic only and downstream of a 256-byte cap and JSON encoding.
  • No wire test asserts that a 257-byte base returns -32602 with the exact MAX_BASE_REVISION_BYTES message; the bad-args loop in refresh_base_argument_... uses 257 chars and expects -32602, but the assertion is at -32602 only — wording drift in server.rs is not pinned.

Verification questions

  • Confirm github-actions review flagged 'failed explicit-base refresh overwrites current_desired_input while retained snapshot stays default-base'; tests/mcp_stdio.rs only assert last_known_good persists for hostile bases, not the desired_input-base invariant.
  • Confirm refresh_base_argument_recovers... asserts hostile --output=... fails closed AND inspects the filesystem for the probe path, producing a non-discriminating oracle for option-shaped refs.
  • Confirm scope_disclosure schema pattern is loosened from const to pattern '^committed (default-branch diff|diff against base .+)$', so a base with regex-meaningful chars could produce a non-matching label.

Refuted

  • The new active-view surface introduces resize, detach, transfer, or stale-length hazards.; refuted because: The patch contains no ArrayBuffer/TypedArray or unsafe memory-view operations. Session and snapshot publication uses owned values; the only bounded read is Vec::take/read_to_end and is local to marker validation.
  • snapshot.base is initialized in Snapshot::from_output_admitted to None and overwritten in run_check via snapshot.base = base.map(str::to_string); callers reading base see analyzed_label produce 'committed diff against base X' verbatim into scope disclosure strings, which can contain backticks or quotes supplied in the base arg (cosmetics, not injection).
  • git_work_tree_for probes .git via std::fs::metadata and a 4096-byte bounded File::open read, rejecting FIFO/block devices with metadata.is_file(); the new MarkerInvalid variant closes the prior devin finding (950828e follow-up).

Evidence gaps

  • The requested cargo-test execution has not produced a receipt yet; authored tests are present, but execution status remains unverified in this lane.
  • The new wire tests cover explicit-base recovery, option-shaped refs, no-Git status, marker behavior, and not-found wording, but the sensor packet's ripr run failed before producing complete planned proof.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Post-merge integration regression from #9075 on current main: #9156 required run 39625893339 checked out merge 711e27d6 (main bb35b27a + LSP head cbe22149) and stopped in Repository policy preflight before compilation or tests. Raw failure is check-process-policy: crates/ripr/src/workspace_status.rs contains Command::new 1 time(s), allowed 0. The counted call is the Unix-only FIFO negative control at workspace_status.rs:550: std::process::Command::new("mkfifo") inside git_marker_probe_rejects_a_non_regular_marker_without_opening_it. The occurrence remains on newer main 9cc901fd; it is not from the LSP candidate.

Please carry a bounded follow-up through the existing #9075 owner/normal review path: preserve the FIFO non-regular-marker negative behavior while preparing it through an approved process abstraction or another policy-compliant test method. Verify a negative control reproducing the current process-policy failure, then a corrected current-main check-process-policy/check-fast pass and the FIFO test result. Do not suppress/skip the checker, drop the FIFO control, or broadly change validation policy. #9156 remains held on its current-base required gate until the repair is actually landed and its new controller/subject is checked; no unchanged qualification retry is being requested.

Copy link
Copy Markdown
Member Author

Additional bounded source review for the #9156 prerequisite failure: this is a test-only FIFO constructor, not a production Git process call. Current workspace_status.rs:545-555 runs mkfifo under #[cfg(unix)] and asserts MarkerInvalid; the callback currently discards the command's status. Existing repository precedents retain real FIFO controls with explicit policy ownership: crates/ripr/src/output/first_pr/preflight.rs:770-800 checks mkfifo success and FileTypeExt::is_fifo(), and policy/process_allowlist.txt records that file's one test-only spawn with owner/reason; the TypeScript bounded-read FIFO test also has a recorded test-only count. This is evidence for a narrowly reviewed fixture repair, not permission to add a blanket exception. Please make FIFO creation and its file type explicit, preserve the nonblocking negative control, then use the repository's approved test-process pattern with an exact owner/reason or another equally transparent compliant method. The current policy gate must pass unchanged before #9156 can be requalified.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Post-merge note: main-repair in flight

This merge left check-process-policy failing on main: the cfg(unix) mkfifo fixture in git_marker_probe_rejects_a_non_regular_marker_without_opening_it counts one Command::new in crates/ripr/src/workspace_status.rs, which was not allowlisted. Every routed gate runs the policy preflight, so all lanes inherit the red (first seen on the #9079 gate, run 39624620211).

Repair: #9201 allowlists the test-only spawn (same class as the bounded_read.rs\#4356 mkfifo entry). Lanes whose gates fail at check-process-policy after this should merge main once #9201 lands rather than treating it as their own regression. Follow-up worth a look: why this PR's own gate was green on ac628a29c — if the policy gate's path set drifted between that run and merge, that is a gate-coverage gap, not a one-off.

EffortlessSteven added a commit that referenced this pull request Oct 21, 2026
#9075's cfg(unix) test proves the git-marker probe rejects a non-regular
.git entry without opening it; the mkfifo fixture spawn is test-only but
check-process-policy counts it against the un-allowlisted file, leaving
main red on the repository policy preflight and blocking every routed
gate (first seen on the #9079 gate, run 39624620211).
EffortlessSteven added a commit that referenced this pull request Oct 21, 2026
…y created (#9224)

mkfifo failure or a non-FIFO marker now fails the test instead of letting MarkerInvalid pass for the wrong reason. Follow-up from #9075 review.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_019ZHDKLVQqArSZrUFKSkREo

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants