Skip to content

fv(kani): prove the five next-action refusal stops on a typed decision (#13707) - #13730

Merged
EffortlessSteven merged 9 commits into
mainfrom
claude/fv-13707-kani-refusal-stops
Nov 8, 2026
Merged

EffortlessSteven merged 9 commits into
mainfrom
claude/fv-13707-kani-refusal-stops

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #13707
Acceptance delta (one sentence): The five next-action selector refusal stops CBMC ran out of memory on are now decided as a typed NextActionDecision with no string building or collection, and five new Kani harnesses assert on that decision that each stop condition yields exactly its typed stop and no executable command, while rendered selector output stays the same.

What changed

  • crates/ripr/src/domain/next_action.rs: select_canonical_next_action is now decide_next_action(input) followed by render_decision(input, decision).
    • decide_next_action returns Result<NextActionDecision<'_>, &'static str>. It keeps the same gate order and the same producer-input refusal texts. The decision variants hold only borrowed references (&NextActionAttemptView, &CommandSpec, &str) and copy enums. There is no format!, to_string, clone or collect on the decision path.
    • render_decision contains the stopped(...) / running(...) calls from before, unchanged: labels, candidate lists and selector-added alternatives. Only NextActionDecision::Run reaches running; every other variant mints through stopped, which never references a command. The two head-refresh stops (bound divergence and the not-fresh tail) share a refresh_head_stop helper that builds the same values as before.
    • NextActionDecision::is_executable (cfg(any(test, kani))) is true only for Run. The control-10 unit battery now also checks, for every gate, that decision executability equals rendered executability.
  • crates/ripr/src/domain/next_action/kani_proofs.rs: five new harnesses that call decide_next_action:
    • platform_stop_decides_unavailable_and_never_runs: symbolic host platform (unknown/Linux/macOS/Windows), spec platform subset and role. Unknown or unsupported host => PlatformUnavailable for the offered spec (checked with ptr::eq), not executable. Otherwise Run.
    • terminal_attempt_stop_decides_terminal_and_never_runs: symbolic terminal/awaits-edit/restart flags and spec role. Terminal with a non-read-only offer => TerminalAttempt for the input's attempt. Executable iff no attempt obligation.
    • awaiting_edit_stop_decides_awaiting_and_never_runs: terminal stop not firing and awaits edit => AwaitingEdit. Executable iff no obligation.
    • restart_recommended_stop_decides_restart_and_never_runs: neither earlier stop firing and restart recommended => RestartRecommended. Executable iff no obligation.
    • several_items_stop_decides_selection_and_never_runs: 0 to 3 candidates over {"a","b"}. More than one => SeveralItems, not executable. Zero or one => Run.
    • The header comment now names what is still not model-checked: render_decision itself. Its link to the decision is structural and is covered by unit tests.
  • changelog.d/13707-kani-selector-refusal-stops.md.

No change to actionability policy, gate order, refusal texts or rendered output. No new required check.

Proof

Ran locally (Linux, bash, CARGO_INCREMENTAL=0, -j1):

  • cargo fmt -p ripr -- --check: pass.
  • cargo test -j1 -p ripr --lib next_action: pass, 70 passed, 0 failed. This run also included a temporary, uncommitted type-check shim: kani_proofs.rs compiled as #[test] functions with stub kani::any (default values), kani::assume and kani::cover!. All 12 harness bodies compiled against the real types and ran on their default inputs. The shim was removed before commit.
  • cargo clippy -j1 -p ripr --lib --tests -- -D warnings: pass.
  • cargo xtask precommit: incomplete. check-static-language, check-no-panic-family, check-allow-attributes and check-local-context passed, as did the covered_by test builds. The run then failed with No space left on device (os error 28) while recompiling ripr. This is an environment limit, not a source failure. Precommit is not established for this head.

Not run locally: Kani. cargo-kani is not installed here, and --cfg kani cannot resolve the kani crate outside cargo kani. Kani verdicts (VERIFICATION:- SUCCESSFUL within budget, plus the negative experiment of a deliberately wrong assertion failing) must come from the hosted Kani lane on this exact head and are not yet established.


Generated by Claude Code

#13707)

Split select_canonical_next_action into decide_next_action, which picks a
typed NextActionDecision (borrowed references only, no label formatting or
candidate collection), and render_decision, which builds the stop labels,
candidate lists and alternatives exactly as before. Add five Kani
harnesses that prove the unsupported/unknown-platform, terminal-attempt,
awaiting-edit, restart-recommended and several-unranked-items stops on the
decision: when the stop condition holds the decision is exactly that typed
stop and is not executable, and the admitted twin runs. The control-10
unit battery now also asserts decision and rendered executability agree
for every gate. Rendered output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUGWB1o9vpixujro7H
@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 Nov 8, 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 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 152 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: 79524491-a598-4f6a-9aad-766985465a13
Commits

Reviewing files that changed from the base of the PR and between f1a321f and c471a88.

Files selected for processing: 3

  • changelog.d/13707-kani-selector-refusal-stops.md
  • crates/ripr/src/domain/next_action.rs
  • crates/ripr/src/domain/next_action/kani_proofs.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

… METRICS row (#13707)

Review nits on #13730: the admitted twin decides Run (render can still fail
closed at mint), the control-10 battery covers the gates it exercises, the
decision enum carries the producer facts (not exactly), and docs/METRICS.md no
longer lists the five refusal paths as unproved or a hand-counted total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUGWB1o9vpixujro7H
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 8, 2026 13:18
@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 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

Independent source review of the selector split: decide_next_action keeps main's gate order and refusal texts, error strings are the same literals, and every render_decision arm builds the same stop or run output as main (the shared refresh_head_stop matches both former copies). Only Run reaches running; every other variant mints through stopped with no command. The five harnesses constrain their stops with symbolic flags, role, platform subset and candidate count; precedence swaps, is_none_or to is_some_and, and > 1 to >= 1 would each fail an assertion; unwind 6 covers the bounded loops, and the decide path allocates nothing. 0af81b4 only tightens doc wording from that review and updates the docs/METRICS.md Kani row. Kani verdicts and runtime come from the hosted lane on this head.


Generated by Claude Code

@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 1 potential issue.

Devin Review

Comment thread docs/METRICS.md Resolved
…#13707)

The row sits in a dated snapshot and the refusal-stop harnesses have no hosted
Kani verdict yet, so the update moves to the post-merge scoreboard refresh.

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

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

Head a3d7747 equals the reviewed 0af81b4 minus the docs/METRICS.md row, which is back to main's text. The selector split, the five refusal-stop harnesses and the doc wording are unchanged from the independent review: same gate order and literals, only Run reaches running, and each harness asserts its exact typed stop and non-executability. Kani verdicts come from the hosted lane on this head.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

ripr static exposure check

Commit c471a88b4faf · run · advisory, static evidence only (not a mutation run).

#ripr agent static-advisory base=f1a321f00eca794a41c6bfa7dea15b0b6566ba61 findings=456 gaps=21 infection_unknown=14 no_static_path=8 propagation_unknown=2 reachable_unrevealed=9 static_unknown=167 weakly_exposed=256
analysis=incomplete|outcome=partial_with_limitations
limitation=language_scope_unsupported|reason=proof_harness_not_evaluated: lines changed inside a function carrying a proof-ha…|recovery=proof_harness_not_evaluated: a changed proof harness (`#[kani::proof]` or `#[kani::proof_for_contract]`) is verification source, so ripr produced no production probe for it and does not evaluate it. Run the verifier for the changed harness; this is not a coverage claim.
+1 more analysis limitations; `--format json` lists all
weakly_exposed|crates/ripr/src/domain/next_action/kani_proofs.rs:454|id: "a".to_string()|missing=id: "a".to_string()|test=t1|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:field_construction:7ba80c87
reachable_unrevealed|crates/ripr/src/domain/next_action/kani_proofs.rs:429|kani::assume(index < 4)|missing=No statically established oracle: assertion execution or macro binding is unesta…|test=t2|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:call_deletion:f5ded049
reachable_unrevealed|crates/ripr/src/domain/next_action/kani_proofs.rs:429|index < 4|missing=No detected boundary input for the changed predicate|test=t3|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:predicate:754d8842
reachable_unrevealed|crates/ripr/src/domain/next_action/kani_proofs.rs:430|match index|missing=No statically established oracle: assertion execution or macro binding is unesta…|test=t4|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:match_arm:97de2e06
reachable_unrevealed|crates/ripr/src/domain/next_action/kani_proofs.rs:432|Some(CommandPlatform::Linux)|missing=No statically established oracle: assertion execution or macro binding is unesta…|test=t5|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:return_value:9066525f
reachable_unrevealed|crates/ripr/src/domain/next_action/kani_proofs.rs:433|Some(CommandPlatform::Macos)|missing=No statically established oracle: assertion execution or macro binding is unesta…|test=t6|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:return_value:8f3b4bb6
reachable_unrevealed|crates/ripr/src/domain/next_action/kani_proofs.rs:434|Some(CommandPlatform::Windows)|missing=No statically established oracle: assertion execution or macro binding is unesta…|test=t7|id=probe:crates_ripr_src_domain_next_action_kani_proofs.rs:return_value:f58fbd11
t1=crates/ripr/src/domain/next_action.rs:2516 status_attempt_states_cover_the_lifecycle relational_check `assert!(restart_route.contains("agent repair"));` miss=weak_assertion
t2=crates/ripr/src/analysis/language/typescript/tests/issue10925_shadow_index_tests.rs:254 a_run_builds_one_index_per_body_and_drops_it_with_the_run relational_check `if index_builds() != start + 1 { return Err(format!( "many names of one body mus…` miss=no_call_path
t3=crates/ripr/src/analysis/language/typescript/tests/reexport_chain_tests.rs:378 a_reexport_index_built_from_known_facts_does_not_reparse_and_matches relational_check `assert!( !from_cache.exposed_names_by_owner().is_empty(), "control: the fixture …` miss=no_call_path
t4=crates/ripr/src/analysis/classify/owner_pin/tests/shared_macro_scan.rs:99 a_cloned_index_starts_with_no_shared_scan exact_value `assert_eq!(cloned.call_identity_memos.macro_site_scans.runs(), 0);` miss=no_call_path
t5=crates/ripr/src/domain/next_action.rs:2922 current_platform_names_linux unknown miss=assertion_admission_unproven
t6=crates/ripr/src/domain/next_action.rs:2934 current_platform_names_macos unknown miss=assertion_admission_unproven
t7=crates/ripr/src/lsp/gap_artifacts.rs:4813 bind_portable_command_for_windows_preserves_quoted_comparison_and_redirect relational_check `if !command_payload_is_safe_for(root, &command, true) { return Err(format!( "Win…` miss=no_call_path
+14 more gaps not shown; `--format json` lists all
limits=infection_unknown:14,no_static_path:8,propagation_unknown:2,static_unknown:167,weakly_exposed:244
next=ripr explain --root . --base f1a321f00eca794a41c6bfa7dea15b0b6566ba61 --committed --mode draft --format agent probe:crates_ripr_src_domain_next_action_kani_proofs.rs:field_construction:7ba80c87
verify=refused|outcome=partial_with_limitations|findings=456|exposed=0|reason=analysis_incomplete,gaps_remain

Took 155s.

Copy link
Copy Markdown
Member Author

Kani lane on a3d7747 (job 128743534817): the five new decision harnesses all VERIFIED in 7.6-11.1s each, but this change regresses the existing selector harnesses. selector_never_runs_a_command_on_diverged_config, ..._when_check_and_card_disagree and unknown_or_stale_head_never_runs_an_admitted_command now exceed the 900s per-harness timeout (they verified in 50-90s on #13619's run, job 128713700198), and the lane hit its 3600s budget, leaving 28 of 49 harnesses with no verdict. This is caused by this PR: routing every selector call through decide_next_action and then one render_decision match puts all render arms behind a single join on a symbolic decision. Not merging until the existing harnesses are back within budget; fix in progress on this branch.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head a3d77477), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

The decide-then-render split joined a symbolic NextActionDecision before
render_decision, so CBMC explored every rendering arm (including the
format!/collect arms) under merged state and the existing selector
harnesses timed out. walk_gates is now the single gate owner and applies a
caller-supplied emit at each gate's return site with a decision whose
variant is fixed there: select_canonical_next_action passes
render_decision, decide_next_action (test/kani only) passes the identity.
Gate logic, order, refusal texts and rendered output are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUGWB1o9vpixujro7H
Resolve the next_action.rs conflict with #13671: keep the walk_gates /
render_decision structure and carry main's new CheckTriage repair_route
(input.check_repair_route) in the CheckTriage render arm.

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

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

Independent review of the delta a3d7747..dafb1fb: c7fc355 only wraps each of the 20 gate returns in emit(...) inside walk_gates, with gate order, conditions, fields and the five error literals unchanged; the selector passes render_decision and decide_next_action (cfg test/kani) passes identity. The merge with main carries all seven #13671 changes verbatim, with repair_route moved into the CheckTriage render arm. Kani workflow run 42492265447 on dafb1fb succeeded: the five new refusal-stop harnesses verified in 8-13s, and the existing selector harnesses are back to main's range (diverged config 62s, disagreement 46s, stale head 86s, route/mode/effect 77s, mint 109s). Compile and unit tests on this head come from hosted CI.


Generated by Claude Code

Picks up #13773 (module_reach_control_qualified fixture contract), which
the Rust gates check-fixture-contracts step needs.

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

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

b7dcd80 is a clean merge of origin/main into the reviewed dafb1fb, picking up #13773 (the module_reach_control_qualified fixture contract that the Rust gates check-fixture-contracts step flagged on dafb1fb; that failure came from main, not this change). git diff dafb1fb6 b7dcd80a -- crates/ripr/src/domain/ is empty, so the reviewed selector split, the five refusal-stop harnesses and the Kani result from run 42492265447 carry over unchanged.


Generated by Claude Code

Picks up the regenerated docs/CLI_REFERENCE.md (#13604) that the
cli_reference_doc test needs after #13685/#13731.

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

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

73f138a is another clean merge of origin/main, picking up #13604's regenerated docs/CLI_REFERENCE.md: the Rust-only feature lane on b7dcd80 flagged cli_reference_matches_the_binary because the branch had #13731's check and #13685's init help change but not the regenerated page. The domain diff since the reviewed dafb1fb is still empty; the selector split, harnesses and Kani result carry over unchanged.


Generated by Claude Code

Picks up #13778, which reblesses docs/CLI_REFERENCE.md after the
repair/continue --json help change.

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

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

0bc0cd0 is a clean merge of origin/main picking up #13778, the CLI reference rebless that main itself needed after the repair/continue --json help change (the cli_reference_matches_the_binary result on 73f138a matched main's state, not this change). Domain diff since the reviewed dafb1fb remains empty; the selector split, harnesses and Kani result carry over unchanged.


Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

Head c471a88 is a main merge only (brings in #13811's CLI reference rebless). git diff 0bc0cd0d c471a88b -- crates/ripr/src/domain/ is empty, so the reviewed selector source and the Kani run 42492265447 verdicts (all next_action harnesses VERIFIED) still describe this head. cargo check -p ripr --lib passes locally on c471a88.


Generated by Claude Code

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