fix(server): usage-limit auto-resume uses native resume when the provider has it #45678
main fromrefs/pull/45678/head·opened View on GitHubUsage-limit auto-resume sent the stored text "Continue where you left off." even on providers that implement resumeTurn, because only manual continuations were routed to native resume. Usage-limit continuations now call resumeTurn when the session supports it. Providers without native resume keep sending the stored prompt, so they are unchanged.
Closes #45645
Scope: ProviderTurnStartService.ts (7 lines) and one test case. The stored message text stays the same.
Tests
ProviderTurnStartService.test.ts: the new case "a usage-limit continuation resumes natively when the provider has native resume" fails on main (expected false to be trueonresume) and passes with this change. The file passes 109/109 locally.- Six related files pass 1119/1119 on Boat:
ProviderTurnStartService,UsageLimitRecoveryWorker,runtimeLayer,ProviderRuntimeRecoveryService,Adapters/ClaudeAdapterV2,Adapters/CodexAdapterV2. - The repo's
check:changed(format, lint, knip, graphql, typecheck, tests) passes on this commit.
Real provider runs
A real T3 Code dev server with the real claude 2.1.333 and codex 0.172.0 CLIs and real models (claude-haiku-5-5, gpt-6-luna), with autoResumeLimitedThreads on. The usage limit was injected: a forwarding proxy in front of the model endpoint returned a 429 with a reset time about 30 s away. The task was six appended lines, one tool call each, so lost or repeated work would show. Base is 1570be5, head is afc75e3.
| Run | Limit hit | What the provider received after the reset | Result |
|---|---|---|---|
Claude, main | after line 2 | user text Continue where you left off. | lines 1–6 once each, DONE |
| Claude, this PR | after line 2 | query.open with resume, an empty prompt, no user text | lines 1–6 once each, DONE |
Codex, main | after line 2 | turn/start with Continue where you left off. | lines 1–6 once each, DONE |
| Codex, this PR | after line 2 | turn/start with input=[], the same 17 items as the failed request | lines 1–6 once each, DONE |
| This PR, limit on the turn's first request | before any work | the original request again, no user text | all lines once each, DONE (both providers) |
The thread still shows the stored Continue where you left off. message on this PR, although the provider no longer receives it.
Not shown: a real account running out. The 429 bodies were written to match what each adapter recognises. Also not shown: Claude signed in with a subscription (the rate_limit_event path), Codex resuming after its app-server restarted, a T3 server restart between the limit and the reset, and the web, desktop and mobile clients (the server was driven through its CLI).
🤖 Generated with Claude Code
- 1
- 2
- 3
Pushedafc75e3
Sign in to join this conversation.