Repository navigation
Description
Verified against (commit SHA or released version)
commit 988c035 (v0.14.0)
Discord Username / User ID
weili_yang33
What does this improvement do?
Summary
A mixed batch rerun under --wait — some tests dispatch and are polled, others come back in conflicts[] — decides its exit code from the dispatched subset alone. When every dispatched rerun passes, the command exits 0 even though the refused tests never ran. A CI gate therefore goes green on an incomplete rerun.
test run --all already closes this exact hole with a hard-conflict gate. test rerun and testlist run are missing that sibling gate.
What happened
runTestRerunCore's --wait tail (src/commands/test.ts, the gates after emitCiArtifacts) checks, in order: auth escalation, deferred/timeout, then resolveWaitFailure. After those gates it returns normally. conflicts only reaches the JSON payload and its summary.conflicts count — no gate reads it:
test.ts:13502-13553— the rerun--waittail: three gates, no conflict gate, thenreturn.testlist.ts:1037-1045— thetestlist run --waittail:assertNoDeferred→resolveWaitFailure→assertNoNotFound→return. Same gap.
Compare test run --all (test.ts:10745-10766), which throws CONFLICT (exit 6) in this shape. Its comment states the invariant directly: "without this gate a passing resumable run would mask an unresolved hard conflict and exit 0".
Two existing unit tests encode the exit-0 behavior today (test.rerun.spec.ts: "partial conflict: accepted proceed, conflicts reported" and "partial conflict (some accepted + some conflicts) still exits 0 on all-passed"), so the gap is baked into the suite, not just the code.
Reproduction
- Project has tests
AandB. Start a run ofBfrom another terminal (or a teammate/CI triggers it), soBhas a run in flight. - Run:
$ testsprite test rerun <A-id> <B-id> --wait --output json; echo "exit=$?"
Batch rerun complete: 1/1 passed, 0 failed/blocked, 0 timed out
{ "accepted": [ ...A passed... ], "conflicts": [ { "testId": "<B-id>", "currentRunId": "run_..." } ], "summary": { "passed": 1, "conflicts": 1, "total": 1 } }
exit=0Bwas never rerun, but the command reports success. In CI, the step passes and the pipeline continues on an incomplete rerun.
The identical batch shape through test run --all exits 6 with CONFLICT.
Expected
A --wait batch with unresolved conflicts — tests the operator asked to rerun but that were refused — must not exit 0. Mirror test run --all's hard-conflict gate: throw CONFLICT (exit 6) after the auth / deferred / poll-failure gates, so a real failure still wins the headline (run --all orders it the same way).
Scope note
The non---wait paths are out of scope here: without --wait the command is fire-and-forget and test run --all also exits 0 with conflicts reported in the payload. The all-conflict no-op cases (zero dispatched) already exit 6 in both commands; only the mixed --wait tail is broken.
Related
- [Hackathon] batch rerun swallows exit codes and never escalates auth failures #78 fixed auth-error escalation on the same rerun tail ("batch rerun swallows exit codes and never escalates auth failures"). This is the remaining hole in the same gate chain.
Details / implementation notes
Branch ready: fix/batch-wait-conflict-exit-code (commit c79cda4). The change adds the conflict gate to the rerun --wait tail and a assertNoHardConflicts helper to testlist run, mirrors runTestRunAll's gate ordering, and updates the two specs that encoded the old exit-0 behavior plus three new cases (pass+conflict → 6, fail+conflict → 1, non-in-flight conflict reasons rendering reason-aware wording). Full gate green: npm run typecheck, npm run lint (0 errors, baseline warnings unchanged), npm test (115 files, 4580 passed, 11 skipped). PR to follow once this issue is assigned.
Confirmations
- I have searched existing issues and this is not a duplicate.
- I have provided my Discord identity above for reward coordination.
Activity
zeshi-du commentedon Oct 20, 2026
Thanks @Herbicide7665, confirmed: in a mixed batch under
--wait,test rerunandtestlist runtake the exit code from dispatched runs only, whiletest run --allexits 6.test rerunis being folded intotest run, deprecated in an upcoming release and removed in 1.0, so we're not taking changes to rerun-only code paths.testlist runwill followtest run --allas part of the 1.0 exit-code changes, since changing it in 0.x would break existing CI scripts. Tracked internally as DEV-2180.Closing as not planned.