Repository navigation
fix(step): keep a queued call alive when queue status fails, release its place when a resend fails - #377
Merged
Conversation
…its place when a resend fails - A status endpoint that keeps failing no longer ends the call with a 410. Once failures outlast the 30s budget, the original bytes go out again under the same queue id, as on `ready`: the server runs a request without its queue when it cannot keep one, and seats again a request whose place expired. A queued answer starts a fresh failure budget. - A resend that fails on the way (not a caller stop) now releases the place before the failure reaches the retry policy, so the place does not sit at the front of the line holding a slot until its lease ends.
liuedcson
requested review from
MelodyVAR,
Uking-xxx and
ZouR-Ma
as code owners
November 30, 2026 03:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Two client-side gaps in the Step model request queue:
GET /stepcode/v1/queuekept failing for 30s (for example, the queue's store is unavailable), the call ended with a synthesized, non-retryable 410. At that moment the generation route usually still works, because the server skips its queue when it cannot keep one. The turn failed even though a plain resend would have succeeded.ready, a resend that failed on the way (a network error, or the SDK attempt aborting) threw without cancelling. Sincereadydoes not change the server-side record, the place stayed at the front and held a slot until its lease expired (about 30s), while the retry policy re-entered the line under a new id.Fix
packages/coding-agent/src/step/model-queue.ts): once poll failures outlast the 30s budget, the wrapper resends the original bytes under the same queue id, exactly as onready. A queued answer resets the backoff and starts a fresh budget. A closed answer, an unexpected status answer, the 20-minute bound, and 401/403 behave as before.Queue status unavailable: ...as a 410, plus a cancel.packages/coding-agent/docs/step-integration.mdupdated to match.The server side needs no new contract: it already answers a resend with a queued, closed, or normal response, and is being updated separately to seat again a request (same body digest) whose place expired, rather than closing it.
Validation
pnpm run check: passes.pnpm exec vitest --run test/step-model-queue.test.ts test/step-model-queue-session.test.ts test/main-model-fetch.test.ts(inpackages/coding-agent): 59 passed, 3 runs../test.sh: passes. Locally it neededPATHwithout a user-level git wrapper that depends on$HOME(whichtest.shisolates), and a shortTMPDIR, because macOS limits Unix socket path length for tsx IPC. One earlier run hit anENOTEMPTYtemp-dir cleanup race intest/main-model-fetch.test.ts; the file passes on its own repeatedly and in the final full run.Boundaries