Skip to content

fix(server): recover proxy usage limits from pool quota resets - #1

Closed
omar7550 wants to merge 1 commit into
mainfrom
fix/claude-proxy-pool-recovery
Closed

omar7550 wants to merge 1 commit into
mainfrom
fix/claude-proxy-pool-recovery

Conversation

@omar7550

Copy link
Copy Markdown
Owner

Claude turns routed through CLIProxyAPI can fail with HTTP 429 after the pool runs out of quota. Claude CLI drops the proxy's cooldown metadata, leaving T3 with no reset time and preventing auto-resume even when the connected Usage source already knows when the pool recovers.

This ports the maintainer-owned upstream fix pingdotgg/t3code#17866 onto upstream main at bf270e74e4c6144fc65648186e879d8bfdb411ed, resolving conflicts with current driver and registry changes. Original authors are retained in the commit attribution. This fork PR provides a reviewable patch for Omar; it does not duplicate or replace the upstream PR. The matching upstream report is #26574.

When native reset information is missing, the adapter refreshes explicitly matching hub sources within five seconds. It uses the latest exhausted applicable window per Claude account, then the earliest whole-account recovery across the pool. Native reset evidence wins. Headroom, unavailable data, ambiguous model scopes, missing or expired deadlines, and failed lookups leave recovery unknown. Stop during lookup remains an interruption.

For this setup, the Claude provider instance must also expose the nonsecret variable ANTHROPIC_BASE_URL=http://127.0.0.1:8317. Setting it only inside the Claude wrapper is invisible to T3's driver. Authentication can remain inside the wrapper. The user guide now explains this requirement. No live configuration or installed application was changed.

Validation on Linux with Node and the repository's vp runner:

  • Demonstrated the existing bare-429 regression failing on main: expected 2026-10-10T08:00:00.000Z, received null.
  • Adapter and usage-source suites: 264 tests passed, covering fallback, native-reset precedence, Stop, fresh pool data, headroom, model scopes, and expired deadlines.
  • vp run check:changed --concurrency 1: formatting, lint, both knip checks, GraphQL, three affected package typechecks, and 319 tests across five files passed.
  • vp test run --project t3 apps/server/src/orchestration-v2/runtimeLayer.test.ts -t 'usage-limit recovery': 17 passed; 85 unrelated cases skipped. This exercises persisted recovery and scheduling behavior.
  • Independent read-only review of the nine-file diff found no blocking defects; git diff --check is clean.

Not exercised: a live exhausted subscription pool, successful quota renewal, installation into the running T3 instance, or platform/browser/device UI. Proxy cooldowns unexplained by reported quota exhaustion still require manual retry. No UI source changed.

Port and verification: GPT-6.1-Sol through the Codex harness in T3 Code, with independent GPT-6.1-Sol review. Original implementation: coderdevang and Julius Marminge, retained from upstream PR pingdotgg#17866.

Port the focused recovery implementation from pingdotgg#17866
(a9c9b50) onto current main.
Preserve current driver and registry refactors and document the provider
environment required when Claude is launched through a wrapper.

A bare Claude 429 can use fresh quota evidence from an explicitly matching
CLIProxy pool. Native reset times retain precedence; unknown or unexplained
cooldowns remain manual retries.

Ported and verified with GPT-6.1-Sol through the Codex harness.

Co-authored-by: coderdevang <devangatpc@gmail.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 30, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for e57bfa6.

This comment will update automatically after the next completed run.

@omar7550

Copy link
Copy Markdown
Owner Author

Closing as superseded. Upstream fixed the same problem in pingdotgg#36238 (merged Nov 13, in nightly 0.1.10-nightly.20261113.4656 and later): proxied Claude usage limits now take their reset time from the CLIProxyAPI hub. Both machines now run 0.1.11-nightly.20261117.4838, which includes it. Rebasing this branch would mean redoing 7 conflicting files for a fix that is already shipped.

@omar7550 omar7550 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant