Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): usage-limit auto-resume uses native resume when the provider has it #45678

Openshivamhwp(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/45678/headopened View on GitHub

shivamhwp(GitHub profile, opens in a new tab)commented

Usage-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 true on resume) 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.

RunLimit hitWhat the provider received after the resetResult
Claude, mainafter line 2user text Continue where you left off.lines 1–6 once each, DONE
Claude, this PRafter line 2query.open with resume, an empty prompt, no user textlines 1–6 once each, DONE
Codex, mainafter line 2turn/start with Continue where you left off.lines 1–6 once each, DONE
Codex, this PRafter line 2turn/start with input=[], the same 17 items as the failed requestlines 1–6 once each, DONE
This PR, limit on the turn's first requestbefore any workthe original request again, no user textall 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. Pushedafc75e3

Sign in to join this conversation.