Repository navigation
fix(devtools): State verify's verdict where a pipeline cannot lose it - #5417
Conversation
`devtools verify` ended its output with the last gate's status line and nothing else. A pipeline exits with its last command's status, so `devtools verify | tail` reports tail's 0 whatever the gates found, and the per-gate `ok` lines do not close the gap: a run whose third gate failed still ends its gate output with a later gate's `ok`, which reads as green to exactly the truncating reader who needed the verdict. `devtools test` already states its verdict as the last line of its own output (#4718, `run_tests.main`). That adjudication was scoped to the focused runner and left the broad verifier saying nothing. This is the same sentence from the other runner, so one reader habit covers both. The write sits in `_emit`, which every terminal path in `_main` reaches — completion, checkout-import mismatch, affected-admission refusal, and interruption — so no terminal outcome is silent. It goes to stderr, so the `--json` stdout contract stays exactly one document. A green verification carries no diagnosis: the payload field is `None`, an absence rather than a determination that failed, so the clause is omitted instead of reported as `diagnosis=unknown`. The receipt named is this run's own `run.json`, never a `current-*` path that a concurrent run in the same checkout would overwrite. Salvaged from `fix/test-verify-reds` (2026-09-06), whose other four defects all landed independently: the pueue-task-id identity hazard is gone with the pueue route itself (`pytest_slot` now waits on an `agentctl` job id and clears its per-pid result file), the rerun report path guard landed as `pytest_rerun._path_for_receipt`, the `current-pytest-summary.json` promise was adjudicated the other way (#4718 stopped naming it rather than writing it), and both stale test expectations match head exactly. That branch is now a delete. Verification: devtools verify --quick — exit 0, 25/25 gates ok, no "out of sync" devtools render all --check — exit 0, zero "out of sync" lines devtools test tests/unit/devtools/{test_verify,test_run_tests, test_pytest_invocation}.py — exit 0, 111 passed devtools schema closure devtools/verify.py tests/unit/devtools/ test_verify.py — both `out`; the derived schema identity is unmoved Anti-vacuity, executed: drop the `_write_verdict_line` call → all three red; the failing case's last line is literally `gate population-coverage ... ok (1.3s)` for a run that exited 1 guard with `if exit_code:` → only the passing case red write to `sys.stdout` → the json case fails decoding on trailing prose restore `or "unknown"` → only the passing case red, on `unknown` Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 35 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55d77a110c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
devtools verifyended its output with a gate'sokline whether it passed or failed, sodevtools verify | tailreported tail's exit 0 whatever the gates found. Salvaged fromfix/test-verify-reds, a two-week-old branch whose other five defects all turned out to be superseded.Problem
Measured at base
74e1aa3d0: the last line of a greenverify --quickisand a failing run ends identically. The verdict lived only in the exit status, which a pipeline discards.
#4718gave the last-line verdict contract todevtools test(run_tests.py:681) but never todevtools verify, whose_mainended at_emit(payload, ...).This is the hazard the environment contract already names — read command exit status directly; a pipeline's final status does not prove an earlier check passed — with no way to comply short of not piping.
Solution
_write_verdict_line, called from_emit, covering all four terminal paths: completion, checkout-import mismatch, affected-admission refusal, and interruption.Written to stderr, so the
--jsonstdout contract stays exactly one document. A green run's absent diagnosis is omitted rather than reported asdiagnosis=unknown— an absent determination is not a failed one.Live production output at the branch tip:
TESTING.md:146is corrected; it claimed the last-line-verdict contract fordevtools testalone.Anti-vacuity — four mutations, each executed and restored
assert 'gate populat...... ok (1.3s)' == 'verify: FAIL...0922/run.json', plus twoIndexError: list index out of rangebecause stderr was empty. That is the defect itself: a run that exited 1 whose last line is a gate'sok.if exit_code:so only failures speak → exactly 1 red,test_a_passing_run_states_its_verdict_too. The failing case stayed green, so red/green separates on the named axis and a failure-only verdict cannot pass.sys.stdout→json.decoder.JSONDecodeError: Extra data: line 3 column 1— the prose landed after the document, exactly as the contract test names.payload.get("diagnosis") or "unknown"→ exactly 1 red:+ verify: PASSED exit=0 diagnosis=unknown receipt=.... The failing case, which has a real diagnosis, stayed green — so the test pins the absence-vs-unknown distinction, not merely the presence of a line.Verification
74e1aa3d0before any edit:devtools verify --quickexit 0, 25 gates all ok, zero FAILED. Nothing to attribute.devtools verify --quickat the tip: exit 0, 25 gates, gate set byte-identical to the base run (diffed).devtools render all --check: exit 0,grep -c 'out of sync'= 0 — checked explicitly, since this command can print per-surfacesync OKand still exit 1.devtools testovertest_verify.py,test_run_tests.py,test_pytest_invocation.py: exit 0, 111 passed, selected 111 / terminal 111.out. Identity measured directly on both trees, not inferred —index=5274c9cc…,ops=86866235…, identical. Unlike several PRs today, this one carries no rebuild-boundary constraint.The other five defects on that branch were superseded
Reported rather than landed:
pytest_rerun.py:72 _path_for_receipt, identical remedy[(False, "gate_unprovisioned_environment"), (True, "gate_missing_executable")]agentctl job startwith a durable job id and a per-pid result file the runner unlinks firstcurrent-pytest-summary.json— decided the opposite way on purpose.#4718closed the same bead choosing "stop naming it" over "write it";run_tests.py:675states "The receipt is this run's own file, never acurrent-*name a concurrent run in the same checkout would overwrite." Reviving the branch would have regressed a landed adjudication.Residual
devtools verify's agent-tier refusal (verify.py:894-912) returns 2 before anyVerifyRunexists and still ends in its own prose refusal rather than averify:line. That is a refusal before a run, not a run with a lost verdict, so it is left alone; if one sentence shape is wanted for every exit, that path is the remaining gap.Separately,
tests/unit/storage/test_index_generation.py:305still says "which later blocks archive-root relocation", describing a mechanism#5086deleted. It is the only surviving reference in the tracked tree — a one-line follow-up owed by that change.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy