Repository navigation
Description
Discord Username / User ID
uisupersaiyan3
What does this improvement do?
Summary
runTestRerun's pollAccepted hardcodes exitCode: 1 on every ApiError
encountered during run polling, regardless of the error's actual class. As a
result, the batch aggregator, which detects authentication failures via
rerunResults.find(r => r.error?.exitCode === 3), never observes an
exitCode of 3. Authentication failures are therefore never escalated,
and a batch rerun containing an auth error exits 1 instead of 3.
The sibling function runTestRunAll already stores the real exitCode from
each polling failure and performs this escalation correctly. runTestRerun
was not updated when that fix was applied and has since drifted out of
parity.
A related idempotency key issue exists on the same code path: initial chunk
dispatch in runTestRerun does not truncate the base idempotency key before
appending a chunk suffix, so base + :chunkN can exceed 256 characters. The
deferred-retry path already guards against this; the initial dispatch path
does not.
Affected Code
| File | Function | Issue |
|---|---|---|
src/commands/test.ts |
pollAccepted (within runTestRerun) |
Hardcodes exitCode: 1, discarding the real error class |
src/commands/test.ts |
runTestRerun (batch aggregation) |
No auth-escalation check before the generic exit-1 throw |
src/commands/test.ts |
runTestRerun (initial chunk dispatch) |
Base idempotency key not truncated before appending :chunkN, unlike the deferred-retry path |
Impact
- Silent exit code misreporting: Any polling failure during a batch
rerun is reported as genericexitCode: 1, even when the underlying error
isAUTH_REQUIREDorAUTH_INVALID(exitCode: 3),RATE_LIMITED, or
another distinct error class. Callers and CI pipelines that branch on exit
code cannot distinguish an authentication failure from any other failure. - No auth escalation: A batch containing an authentication failure exits
1instead of3, so the caller receives no actionable signal that
credentials need attention. This is inconsistent withrunTestRunAll,
which already escalates correctly. - Idempotency key overflow: A sufficiently long base idempotency key
combined with a chunk suffix (:chunkN) can exceed the 256-character
limit on initial dispatch, which the deferred-retry path already prevents.
This creates inconsistent behavior between the initial and retry dispatch
paths and risks invalid or truncated-inconsistently idempotency keys being
sent to the API.
Root Cause
runTestRerun and runTestRunAll were originally implemented with the same
polling and dispatch logic, but a subsequent fix to runTestRunAll (correct
exitCode propagation, auth escalation, and idempotency key truncation on
initial dispatch) was never backported to runTestRerun. The two code paths
have since diverged.
Details / implementation notes
issue fixed in PR #33
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 Jul 6, 2026
Fixed by #33 (merged 2026-07-05): batch rerun fan-out rows now carry the real per-member exit code, and any auth failure escalates the whole batch to exit 3. Closing as completed.