Skip to content

fix(agent): bind refusal recovery to the running binary; refuse foreign producer.version in agent verify (#9500 b,c) - #9632

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/audit-agent-artifact-envelope
Oct 22, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/audit-agent-artifact-envelope

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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 touch reports gap-ledger.

  • (b) The legacy-artifact refusal's regeneration command now runs std::env::current_exe() (quoted via shell_arg) and prints the running executable's version line, instead of a bare PATH ripr. If the OS cannot name the executable it falls back to ripr and says to confirm ripr --version.
  • (c) validate_repo_exposure_artifact refuses an envelope whose artifact.producer.version differs from the running executable's CARGO_PKG_VERSION, with a "produced by X, consumer is Y, regenerate" message and the same recovery command.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-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.version fails agent verify closed, 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 sharing validate_repo_exposure_artifact. In agent_seam_packets_live/currentness.rs the validation error is surfaced in the not-evaluated reason, not swallowed.

Scope Classification

  • One production behavior

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.rs tests updated so fixtures use env!("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.json carry 0.11.0; the assistant-loop proof route does not validate producer.version and its tests pass, so they do not need to track bumps. bump-version does not touch test fixtures; the cli_smoke helpers now follow the package version automatically.

Proof

cargo test -p ripr --lib -- legacy_ forged_producer repo_exposure_validation comparable_pair   # 88 passed
cargo test -p ripr --test cli_smoke --test python_repair_attempt -- comparison_metadata_drift assistant_loop agent_verify agent_receipt first_useful repair_attempt   # 46 passed
cargo xtask precommit   # exit 0 on 731e6cbd

Mutation verification (earlier head, reverted): bare ripr rendering 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

  • Spec: RIPR-SPEC-0011
  • Tests: agent::artifact::tests::{legacy_recovery_command_names_the_running_executable_not_bare_ripr, repo_exposure_validation_rejects_forged_producer_version}; cli_smoke agent_verify_rejects_comparison_metadata_drift, agent_receipt_rejects_comparison_metadata_drift
  • Code: crates/ripr/src/agent/artifact.rs, agent/loop_commands.rs

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

Head: 731e6cb

🤖 Generated with Claude Code

https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh

…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
…om xtask (#9500)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
@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!

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 22, 2026 10:22
@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 22, 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 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 104 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 2d6522f3-a8e6-42ad-82c2-c577217f4a96
📥 Commits

Reviewing files that changed from the base of the PR and between 48d3080 and 0648af6.

📒 Files selected for processing: 7
  • changelog.d/9500-agent-artifact-envelope.md
  • crates/ripr/src/agent/artifact.rs
  • crates/ripr/src/agent/loop_commands.rs
  • crates/ripr/tests/cli_smoke.rs
  • crates/ripr/tests/python_repair_attempt.rs
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/RIPR-SPEC-0011-llm-work-loop.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

… 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

@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.

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.tool value 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 --root check 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 --root which 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 artifact member but also without seams could 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.

@EffortlessSteven EffortlessSteven changed the title fix(agent): refuse unenveloped/foreign-producer repo-exposure artifacts; bind recovery to the running binary (#9500) fix(agent): bind refusal recovery to the running binary; refuse foreign producer.version in agent verify (#9500 b,c) Oct 22, 2026
…e is unchanged (#9500)

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

Copy link
Copy Markdown
Member Author

Review of record, head 0648af6 (731e6cb plus a changelog-wording commit).


Generated by Claude Code

@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

  • PATH-form PATH ripr emitters 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 ripr from PATH and a ripr --version confirmation 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.

@EffortlessSteven
EffortlessSteven merged commit 72c8345 into main Oct 22, 2026
50 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/audit-agent-artifact-envelope branch October 22, 2026 12:35

Copy link
Copy Markdown
Member Author

Merged as 72c8345 (squash, expected head 0648af6). Ripr Rust Small Result green on that head (run 39772793060). Residuals: #9665.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Current-main integration counterexample from the cloud #9478 lane:

At fetched main dfb71a8e1 (including this PR's squash 72c834583a267ceded3ec09a8b79568c2c402608 and #9547's 118ad10069), crates/ripr/src/agent/artifact.rs:719 passes &subject to foreign_producer_refusal, but the shared validate_artifact_identity(root, raw, label, identity, spec) function has no subject binding. The shared-validator refactor names its context label.

Native Rust 1.95 cargo test --locked -p ripr --test owner_pin_execution function_pointer -- --nocapture --test-threads=1 terminated with exit 101 / E0425 before any selected tests executed. The failing artifact.rs blob is byte-identical between fetched main and the #9478 composition; #9478 changes none of this file. This is a current integration prerequisite, not a failed pointer assertion or a fresh full-main qualification claim.

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.

EffortlessSteven added a commit that referenced this pull request Oct 22, 2026
…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>
EffortlessSteven added a commit that referenced this pull request Oct 22, 2026
…#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>
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