Repository navigation
Description
Bug type
Incorrect behavior or output
Summary
When the primary model's first turn of a run-uat unit fails with a rate-limit / quota error and agent-end recovery successfully switches to a configured fallback model, the turn-abort harnessAbort recorded for that first failed turn is never cleared. The fallback model then runs every UAT check successfully, but gsd_uat_result_save is rejected with Retryable harness abort: … truncated by turn-abort. The ASSESSMENT is never written, finalize-retry re-dispatches the unit, the same thing happens again (primary model is still over quota), and auto-mode pauses after the retry budget.
This is the same "harnessAbort poisoning" tail as #1993, but via the turn-abort kind. #2017 fixed the tool-error kind (a later successful gsd_exec/gsd_uat_exec now calls clearCurrentUnitToolErrorHarnessAbort), but nothing clears a turn-abort after a successful fallback switch — clearUnitHarnessAbort is only reached with expectedKind: "tool-error".
Still present on main @ 8fdc3d2d (2026-11-17).
Steps to reproduce
- Configure a unit model with a fallback, e.g.
models: uat: model: claude-code/claude-opus-5-5 fallbacks: - model: anthropic/claude-opus-5-5
- Have the primary provider be over quota, so every request returns e.g.
You've hit your weekly limit · resets Nov 19 at 10am (Asia/Taipei)(noreset in Ns). - Run
/gsd autountil arun-uatunit is dispatched. - The first turn errors on the primary →
agent_end→recordRetryableTurnAbortwritesharnessAbort: { kind: "turn-abort", … }→tryProviderModelFallbackswitches to the fallback andscheduleFallbackContinuationstarts a fresh turn in the same unit run (samestartedAt). - The fallback model runs all
gsd_uat_execchecks (all pass) and callsgsd_uat_result_save.
Expected behavior
Once the unit has successfully recovered onto a fallback model and is making progress, the earlier turn-abort should no longer block gate saves (gsd_uat_result_save, gsd_save_gate_result, gsd_hook_verdict_save), and the ASSESSMENT is written.
Actual behavior
gsd_uat_result_save is rejected every time:
Retryable harness abort: run-uat M008/S03 was truncated by turn-abort. This gate result was not saved; leave the gate pending so auto-mode can rerun it.
Unit runtime record at that point (.gsd/runtime/units/run-uat-M008-S03.json):
{
"unitType": "run-uat",
"unitId": "M008/S03",
"startedAt": 1794957275628,
"phase": "dispatched",
"lastProgressKind": "coordination-tool-in-flight",
"harnessAbort": {
"kind": "turn-abort",
"reason": "Agent turn aborted before the unit could complete its gate evaluation. origin=error stopReason=error error=You've hit your weekly limit · resets Nov 19 at 10am (Asia/Taipei)",
"recordedAt": 1794957279071
},
"unitEnd": { "status": "no-artifact", "artifactVerified": false }
}Activity log of the same unit (per assistant message: provider, stopReason, tool calls):
23:14:39 claude-code error "You've hit your weekly limit …" []
23:14:52 anthropic toolUse [gsd_uat_exec ×6] ← fallback switch worked
… anthropic toolUse [read …, gsd_uat_exec …] (all exit 0)
23:16:36 anthropic toolUse [gsd_uat_result_save] → Retryable harness abort … turn-abort
23:16:53 anthropic toolUse [gsd_uat_result_save] → same
23:17:04 anthropic stop
Journal: unit-end status=no-artifact → artifact-verification-retry attempts 1, 2, 3 → duplicate-failure-context / auto-mode paused "after 3 retries". Four consecutive run-uat dispatches for this slice all followed the identical pattern.
Why every re-dispatch fails the same way: the quota message has no reset in Ns, so classifyError falls back to retryAfterMs: 60_000, and blockModelUntil only blocks the primary for 60 s. By the next dispatch the primary is selected again, fails again on turn 1, and re-poisons the new run.
Earlier unit types in the same slice (execute-task ×4, complete-slice) hit the identical first-turn quota error + fallback switch but succeeded, because they never go through blockIfHarnessAbortedUnit. Only the three gate-save tools check it, so run-uat (and next, the roadmap-reassessment hook verdict) is where it surfaces.
GSD version
1.23.0 (npm global). Also verified the relevant code on main @ 8fdc3d2d.
Node.js version
v24.15.0
Operating system
macOS 26.6.2 (arm64)
Install method
npm global install
Affected area
Auto-mode / dispatch loop
Model and provider
Primary claude-code/claude-opus-5-5 (over weekly quota), fallback anthropic/claude-opus-5-5.
Logs, screenshots, and evidence
Code path (src, 1.23.0 and main):
bootstrap/register-hooks.tsagent_end→recordRetryableTurnAbort(event)(≈L1503) recordskind: "turn-abort"fororigin=error stopReason=error.bootstrap/agent-end-recovery.tsrate-limit branch →tryProviderModelFallback(...)→ on successscheduleFallbackContinuation(pi); the unit'sstartedAtis unchanged, so the abort stayssameRun.unit-runtime.tsrecordUnitHarnessAbort/clearUnitHarnessAbort: the only clear call site isclearCurrentUnitToolErrorHarnessAbortinregister-hooks.ts(≈L117), gated ontoolName ∈ {gsd_exec, gsd_uat_exec}andexpectedKind: "tool-error".recordUnitHarnessAborteven refuses to downgrade a same-runturn-aborttotool-error, so the successfulgsd_uat_execcalls cannot clear it either.tools/workflow-tool-executors.tsblockIfHarnessAbortedUnit(≈L216) rejectssave_uat_result,save_gate_result,hook_verdict_savewhenever any same-runharnessAbortexists.
Impact
Any user with a primary/fallback chain where the primary is rate-limited or over quota gets every run-uat unit wedged: the UAT work completes with real passing evidence, but it is discarded and auto-mode pauses. The rejection text says "auto-mode can rerun it", but the rerun hits the same path. The only workaround is to swap primary and fallback in preferences until the quota resets.
Additional information
Possible fixes, any of which would unblock this:
- When agent-end recovery successfully switches models and schedules the continuation, clear the same-run
turn-abort(e.g.clearUnitHarnessAbort(..., "turn-abort")right beforescheduleFallbackContinuation). The turn that was aborted is being replaced, not truncating the gate evaluation. - Or clear a
turn-aborton the first successful tool result after it (mirroring fix(gsd): prevent UAT schema errors from poisoning retries #2017 fortool-error), at least forgsd_uat_exec/gsd_exec. - Separately: for rate-limit messages that only carry a wall-clock reset (
resets Nov 19 at 10am), parse it or use a much longer block than 60 s, so the over-quota primary is not re-selected on every unit dispatch.
Activity