Skip to main content

Module redundant_run

Module redundant_run 

Source
Expand description

Redundant full-suite test re-run suppression (#2682): the complement to verify_gate — it stops the suite running MORE than it needs to.

Why: (bake-off L1 diagnosis) The engineer re-runs the full suite 7-14x per run as repeated “one final run to confirm” passes, even when no code has changed since the last clean pass, inflating tcode’s turn count far above claude-code’s on the same challenge. What: The pure is_redundant_test_rerun predicate the agent loop consults (when suppression is enabled) to short-circuit a redundant test re-run with redundant_run::REDUNDANT_RERUN_MESSAGE instead of spawning the suite. Test: redundant_run::tests::*. Redundant full-suite test re-run suppression (#2682).

Why: (bake-off L1 diagnosis) The delegated engineer re-runs the full test suite 7-14x per run, typically framed as “one final run to confirm”, even when NO code has changed since the last clean pass. Each redundant re-run burns a whole turn (and the suite’s wall-clock cost), inflating tcode’s turn count (~33-49) far above claude-code’s (~15) on the same challenge. The sibling verify-before-finish gate (#2279) guarantees the suite runs at LEAST once; this module is its complement — it stops the suite running MORE than it needs to. Together they bracket the correct behaviour: exactly one clean full-suite pass after the last code change, no more and no less. What: is_redundant_test_rerun is a pure predicate over a loop’s transcript. A proposed bash test invocation is redundant iff the most recent prior test invocation ran the BYTE-IDENTICAL command, already PASSED, and nothing that could have changed the tree (a write_file/write_files/ edit, or any non-test bash command) has run since. Command identity is load-bearing (#2804 review): a narrow run passing (cargo test -p a) must never suppress a broader/different one (cargo test --workspace, cargo test -p b) that never actually ran, nor may a compile-only cargo test --no-run suppress the real subsequent run. The predicate reuses verify_gate’s is_test_command / bash_command_from_call so the two gates can never drift on what counts as a test invocation. agent_loop::AgentLoop’s dispatch loop consults it (when suppression is enabled via AgentLoop::with_redundant_run_suppression) and, on a match, short-circuits the dispatch with REDUNDANT_RERUN_MESSAGE instead of actually spawning the suite — saving the turn’s wall-clock cost and nudging the model to proceed to finish. (#2857) That short-circuit is itself a decision that silently changes the run’s outcome (a test invocation the model requested did NOT happen), so agent_loop::AgentLoop::dispatch_all logs it via tracing::info! at the call site — a suppressed run is still the expected, by-design outcome (not a failure), so info rather than warn. Test: redundant_run::tests::*, plus agent_loop::tests::redundant_test_rerun_is_suppressed, agent_loop::tests::test_rerun_after_edit_is_not_suppressed, and agent_loop::tests::redundant_rerun_suppression_logs_info.

Constants§

REDUNDANT_RERUN_MESSAGE
The ToolResult text returned in place of a suppressed redundant re-run.

Functions§

is_redundant_test_rerun
Whether the pending bash test call current_call_id would be a redundant re-run: the SAME command already passed with nothing changed since.
is_test_bash_call
Whether call is a bash invocation of a test command — the cheap pre-filter dispatch_all applies before the fuller is_redundant_test_rerun transcript scan.