Skip to content

[Bug]: turn-abort harnessAbort survives a successful model fallback switch, so gsd_uat_result_save is rejected and run-uat wedges (follow-up to #1993) #3199

Open

Description

@robert1112

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

  1. 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
  2. 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) (no reset in Ns).
  3. Run /gsd auto until a run-uat unit is dispatched.
  4. The first turn errors on the primary → agent_end → recordRetryableTurnAbort writes harnessAbort: { kind: "turn-abort", … } → tryProviderModelFallback switches to the fallback and scheduleFallbackContinuation starts a fresh turn in the same unit run (same startedAt).
  5. The fallback model runs all gsd_uat_exec checks (all pass) and calls gsd_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.ts agent_end → recordRetryableTurnAbort(event) (≈L1503) records kind: "turn-abort" for origin=error stopReason=error.
  • bootstrap/agent-end-recovery.ts rate-limit branch → tryProviderModelFallback(...) → on success scheduleFallbackContinuation(pi); the unit's startedAt is unchanged, so the abort stays sameRun.
  • unit-runtime.ts recordUnitHarnessAbort / clearUnitHarnessAbort: the only clear call site is clearCurrentUnitToolErrorHarnessAbort in register-hooks.ts (≈L117), gated on toolName ∈ {gsd_exec, gsd_uat_exec} and expectedKind: "tool-error". recordUnitHarnessAbort even refuses to downgrade a same-run turn-abort to tool-error, so the successful gsd_uat_exec calls cannot clear it either.
  • tools/workflow-tool-executors.ts blockIfHarnessAbortedUnit (≈L216) rejects save_uat_result, save_gate_result, hook_verdict_save whenever any same-run harnessAbort exists.

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:

  1. When agent-end recovery successfully switches models and schedules the continuation, clear the same-run turn-abort (e.g. clearUnitHarnessAbort(..., "turn-abort") right before scheduleFallbackContinuation). The turn that was aborted is being replaced, not truncating the gate evaluation.
  2. Or clear a turn-abort on the first successful tool result after it (mirroring fix(gsd): prevent UAT schema errors from poisoning retries #2017 for tool-error), at least for gsd_uat_exec / gsd_exec.
  3. 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

  1. added
    needs-triageUnlabeled or unassigned — needs maintainer review
    bugSomething isn't working
    and removed
    needs-triageUnlabeled or unassigned — needs maintainer review
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-humanRequires human implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions