Repository navigation
fix(agent): bind refusal recovery to the running binary; refuse foreign producer.version in agent verify (#9500 b,c) - #9632
Conversation
…ledger and verify; bind recovery to running binary (#9500) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…ry (#9500) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…om xtask (#9500) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 24 minutes. View limit details
Comment |
… a warning in #9570 (#9500) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…for the exact producer-version check (#9500) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- PR explicitly scopes the program-bound recovery to the refusal's command; start-here, packets, and specs still render bare PATH
ripr. The single-owner invariant is about envelope/refusal, not about command emission everywhere. Not a regression introduced by this PR, but worth surfacing so reviewers know the change is intentionally narrow (#5115 residual).
Verification questions
- Confirm foreign-producer negative path is only covered by a hand-constructed JSON with a version string, not by an artifact actually written by a different RIPR build. A binary that wrote CARGO_PKG_VERSION=0.10.9 then ran as 0.11.0 would still be caught (version mismatch), but two cases are not covered: (1) a non-ripr
producer.toolvalue paired with a foreign version, and (2) a foreign version that also lies about its tool/identity fields but is structurally self-consistent at the content-commitment layer. - Confirm version_line() is read at refusal render time and is independent of the bound program arg; a downgraded binary can name the bound exe while printing a different version line.
Refuted
- Running-binary recovery on Windows where current_exe returns a path containing spaces would break shell_arg quoting and the literal
ripr check --rootcheck would still pass since the assertion is a substring match.; refuted because: shell_arg already handles Windows path quoting (existing is_windows_console_form + powershell_command handling); the assertion is the rendered literal form the test compares against via loop_commands builders, not a naive substring on 'ripr '. The check excludes`ripr check --rootwhich would only appear if the program argument were literally 'ripr'. No quote-breakage path opened by this diff. - A repo-exposure JSON object without an
artifactmember but also withoutseamscould be misclassified as unenveloped legacy and refused with a regeneration diagnosis.; refuted because: is_unenveloped_repo_exposure requires both !contains_key("artifact") and document.get("seams").is_some_and(Value::is_array), so the caller's own parser still runs for non-RepoExposure shapes and the gate only fires for legacy repo-exposure docs.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
…e is unchanged (#9500) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
|
Review of record, head 0648af6 (731e6cb plus a changelog-wording commit).
Generated by Claude Code |
There was a problem hiding this comment.
Confirmed findings
- PATH-form PATH
ripremitters other than this refusal still render bare ripr (start-here, packets, specs); intentional per PR body but a user reading a refusal then a different diagnostic sees inconsistent recovery forms. Not a blocker, surfaced for reviewer awareness as #5115 residual.
Verification questions
- Confirm forged-producer test only covers a mutated JSON document, not an artifact actually emitted by a different RIPR build; structural self-consistency at content-commitment layer with a lying version is exercised, but two cross-build shapes are not (foreign producer.tool + foreign version; structurally consistent with tool/identity fields lied in lockstep).
- Confirm crates/ripr/src/agent/artifact.rs:4063 — repo_exposure_validation_rejects_forged_producer_version only mutates producer.version; add at least one case that also rewrites producer.tool (e.g. 'ripr-foreign' / 'not-ripr') to prove the version-equality gate is the actual refusal cause rather than incidental identity-string matching downstream of producer-identity checks.
- Confirm no unit test covers the 'OS cannot name running executable' fallback path (running_executable() returns None): the refused message would then render
riprfrom PATH and aripr --versionconfirmation hint. - Confirm version_line() is rendered into the binding sentence but is not asserted to equal env!(CARGO_PKG_VERSION); a downgraded/down-built binary can name the bound exe while printing a different version line, so 'confirm ripr --version' guidance can lie.
- Confirm version_line() is read at refusal render time and could in principle diverge from the bound program (downgraded binary naming the bound exe while printing another line). The PR does not exercise this; mutation verification covered the binary-revert and version-equality-disable cases only.
- Confirm tests forge the producer.version JSON string but never run a real foreign-RIPR build end-to-end; structural hand-construction of the JSON cannot exercise the real producer-side writer, so a producer-side bug that also writes the consumer's version into a foreign-build artifact would not be caught.
Refuted
- Introducing check_repo_exposure_command_with_program_and_base as a new public helper alongside the PATH-form trampoline creates duplication that should be collapsed by inlining the program param into the existing signature.; refuted because: Inlining would change the public signature for ~9 existing call sites and the PATH-form callers do legitimately need a stable entry point that is not silently rebound. Trampoline + new helper keeps scope narrow and reviewable.
- A non-ripr producer.tool paired with a foreign version, or a structurally self-consistent foreign envelope with tampered tool/identity, could bypass the version check; refuted because: The new gate is an unconditional != compare against env!(CARGO_PKG_VERSION) placed before any digest recomputation; tool and identity fields are not consulted by this check, so tool value is irrelevant and self-consistency at the content layer does not affect refusal. Identical bypass would require declaring the current version, which is no longer a bypass.
- version_line() is read at refusal render time and could be replaced by a downgraded binary, so the version-line print does not actually bind to a specific binary; refuted because: version_line() returns env!('CARGO_PKG_VERSION') of the running executable; the same string is the one validated against. A downgraded binary that prints a different line is a contradiction in terms and outside the PR's scope (auth is explicitly disclaimed). The check that matters is that the recovery command runs the same binary whose version was checked; the program arg and version line come from the same process via std::env::current_exe() and env!('CARGO_PKG_VERSION'), so they cannot diverge within one process.
- The Windows 'cmd.exe' first-form label is chosen when is_windows_console_form(bash_recovery) is true; a command containing both balanced double-quotes and single-quoted '$'/backtick segments (literal in Git Bash/PowerShell) is mislabeled as cmd.exe and will fail to run there.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
|
Merged as 72c8345 (squash, expected head 0648af6). Generated by Claude Code |
|
Current-main integration counterexample from the cloud #9478 lane: At fetched main Native Rust 1.95 I have retained the compiler log and kept #9478 qualification off. The artifact/validator repair should stay with its existing owner; I am not adding a competing artifact writer. The required result's earlier green on #9632's head does not establish this later combined source tree. |
…ate_artifact_identity #9632 passed `subject`, a local of a different function, so the lang-rust lane failed to compile. Build the label where it is used. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ
…y validator (#9500) (#9701) #9632 and #9547 each passed alone; together the foreign-producer refusal referenced a subject only the repo-exposure route defined. Claude-Session: https://claude.ai/code/session_015jyhvmnQnqYgyfnycQYsvx Co-authored-by: Claude <noreply@anthropic.com>
…#9590) * fix(rust): bind implicit-call withholding to a value of the impl type (#9540) An operator, drop, iteration or dyn call now withholds a gap only when the test applies the syntax to a value of the impl's type and a strong assertion observes the result. A type named beside an operator on integers, a field operand, a discarded result and a receiver of another type keep the gap. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ * fix(rust): keep implicit-call withholding unless the use is provably unrelated (#9540) Review showed requiring a proven binding re-keeps tested code whose operand comes from a helper, constant or tuple, a false actionable. Keep a gap only for a literal or other-typed operand, a discarded result, or a receiver of another type. Statement bounds now nest braces, ident_before is UTF-8 safe, and PartialOrd keeps its method forms. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ * fix(rust): keep implicit-call withholding for shadowed, factory-built, destructured and mutated operands (#9540) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ * fix(rust): a postfix access after a unary operand is not the impl type (#9540) -Money(1).0 negates the field, so the operand is not a Money. It is now Unknown, which still withholds, and cannot later be credited as Bound. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ * fix(agent): name the subject at the foreign-producer refusal in validate_artifact_identity #9632 passed `subject`, a local of a different function, so the lang-rust lane failed to compile. Build the label where it is used. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ * fix(rust): keep implicit-call withholding for postfix, primitive-Self and match-arm operands Review of 1d47a1b found three narrow cases where the provably-unrelated rule could keep a gap although the impl is called: a postfix [ or ? on a bare unary operand, a literal operand when Self is a primitive, and a match-arm pattern that rebinds the name. Each now reads Unknown. Spec text covers the rules the first review added; two public-API controls cover for-loop and match-arm rebinding. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ * fix(agent): take main's artifact.rs after #9701 landed the same compile fix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZcvvTYPGoc4M6akrD8PNJ --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Delivers items (b) and (c) of #9500 through the existing envelope owner
crates/ripr/src/agent/artifact.rs(no second validator). Item (a) was delivered upstream as a warning in #9570 (squash 2e2757d, separate claim); an earlier head of this PR (559daf1) also refused on the gap-ledger route, but that was dropped to avoid contradicting the merged warn decision, so this PR does not touchreports gap-ledger.std::env::current_exe()(quoted viashell_arg) and prints the running executable's version line, instead of a bare PATHripr. If the OS cannot name the executable it falls back toriprand says to confirmripr --version.validate_repo_exposure_artifactrefuses an envelope whoseartifact.producer.versiondiffers from the running executable'sCARGO_PKG_VERSION, with a "produced by X, consumer is Y, regenerate" message and the same recovery command.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #9500 (items b, c; split from #9305 / #5115)
Acceptance delta (one sentence): The legacy-refusal recovery command binds to the running executable and a foreign
producer.versionfailsagent verifyclosed, each with a failing-before negative test and a positive control.Decision: (c) fail-closed design
The audit (F3) suggested disclosure; I chose the most conservative option, exact equality with the consuming executable's version. Consequence: artifacts/receipts from another RIPR build, even a patch release, must be regenerated (pairs from one build are unaffected). This is not producer authentication (a forger can write the current version). A looser compat rule (for example same minor) is a one-line relaxation at the check; no such rule exists in the repo today (the input-identity digest already embeds the analyzer version).
What refuses now:
agent verify,agent receipt, repair-attempt, packet and live-currentness consumers sharingvalidate_repo_exposure_artifact. Inagent_seam_packets_live/currentness.rsthe validation error is surfaced in the not-evaluated reason, not swallowed.Scope Classification
Production delta:
agent/artifact.rs(shared guidance builder, exact version check),agent/loop_commands.rs(program-bound variant; PATH-form builders delegate unchanged).Evidence/support delta: unit tests in
artifact.rs;cli_smoke.rstests updated so fixtures useenv!("CARGO_PKG_VERSION")and the producer-version drift cases expect the new refusal; spec RIPR-SPEC-0011, OUTPUT_SCHEMA.md and changelog fragment updated.Non-goals: producer authentication; rebinding other emitters that still render PATH
ripr; the gap-ledger route (#9570); full CLI-level test of the recovery text (covered at unit level plus the updated drift tests).Fixture note: committed
fixtures/boundary_gap/.../unchanged-after-attempt/{before,after}.repo-exposure.jsoncarry0.11.0; theassistant-loop proofroute does not validateproducer.versionand its tests pass, so they do not need to track bumps.bump-versiondoes not touch test fixtures; the cli_smoke helpers now follow the package version automatically.Proof
Mutation verification (earlier head, reverted): bare
riprrendering and disabling the version equality each failed their dedicated tests (legacy_recovery_command_names_the_running_executable_not_bare_ripr,repo_exposure_validation_rejects_forged_producer_version); positive control: the genuine version validates in the same test.Skipped: full workspace tests,
ci-policy(no workflow/policy surface), hosted CI.Claim Boundary
May claim: the two items refuse/bind as described. Must not claim: producer authentication, executable binding on other emitters, Windows/PowerShell stale-binary execution proof (#3922/#4510).
Rollback
Revert the squash commit; no schema or config change.
Spec-Test-Code Traceability
agent::artifact::tests::{legacy_recovery_command_names_the_running_executable_not_bare_ripr, repo_exposure_validation_rejects_forged_producer_version}; cli_smokeagent_verify_rejects_comparison_metadata_drift,agent_receipt_rejects_comparison_metadata_driftcrates/ripr/src/agent/artifact.rs,agent/loop_commands.rsStatic Language Check
killed,survived,untested,proven, andadequate.Head: 731e6cb
🤖 Generated with Claude Code
https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh