Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a full Claude context window no longer shows as a usage limit #19848

Mergedfixfon(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/19848/headmerged by juliusmarminge View on GitHub

Problem

When a Claude conversation fills its context window, the turn ends with terminal_reason: "blocking_limit", result: "Prompt is too long". T3 Code shows "Usage limit reached" with "Reset time unavailable; retry manually", even though the latest rate_limit_event is allowed. Retrying can never work, and the user is not pointed to /compact or a new thread. Fixes #19832.

Change

ClaudeAdapterV2 treated every blocking_limit as a usage limit. It is now a usage limit only with rate-limit evidence: api_error_status 429, a rejected rate_limit_event, or a rate_limit assistant error. Otherwise the turn fails as a provider_error saying the context window is full, with /compact or a new thread as the way out. A genuine usage-limit blocking_limit now shows the existing "usage limit reached, send again once the limit resets" hint instead of "a usage limit blocked the request". Clients key off failure.class, so no client or contract changes are needed.

Scope and approval

A small, focused fix for an obvious misclassification, from the reproduction in #19832 (provider log included). It changes no settings, schemas, defaults or recovery policy. #19414, #19543 and #19583 are adjacent but do not cover this classification.

Verification

  • vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts (in apps/server): 258 passed. A new table test replays the issue's frames. With the fix reverted, the allowed-window case fails with usage_limit.
  • Controls: a rejected five-hour window still yields usage_limit. The existing table test now expects provider_error for blocking_limit without evidence.
  • vp fmt --check is clean. vp lint on both files shows 0 errors and 1 existing warning. The apps/server typecheck passes.
  • Not checked: a live Claude run at a full context window, since this is a frame replay. No repo-wide checks were run.

Model: Claude Sonnet 5.5. Harness: Claude Code in T3 Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at c6bb998

      Macroscope's review found this PR approvable — This is a narrowly scoped Claude error-classification fix with targeted regression coverage. It changes only the user-facing handling of an existing terminal result and preserves genuine usage-limit behavior without affecting schemas, defaults, or deployment.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 5278da87-cb39-47f0-93dd-e5330f2545f0
      📥 Commits

      Reviewing files that changed from the base of the PR and between 339179f50a84dc599cce373dbb48f172f182f44e and c6bb9980bf534fe912bfc02018182844b3259356.

      📒 Files selected for processing: 2
      • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
      • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      📝 Walkthrough

      Claude terminal failures now use context-window messaging for blocking_limit and prompt_too_long. Usage-limit classification relies on API status 429 or explicit usage-limit evidence. Tests cover allowed and rejected five-hour rate-limit windows.

      Changes: Claude terminal failures

      Layer / File(s)Summary
      Terminal failure mapping and tests
      apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
      blocking_limit uses a context-window message unless a failure hint is present. prompt_too_long uses the same message. The adapter classifies usage limits based on API status 429 or usage-limit evidence. Tests cover blocking_limit with allowed and rejected five-hour rate-limit windows.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to c6bb9

      The reviewed change distinguishes context-window failures from rejected rate limits. No issue requiring a fix before merge was identified.

      Pre-merge checks: Passed 4
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main fix: Claude context-window failures no longer appear as usage-limit errors.
      Description checkPassedThe description includes the problem, change, scope and approval rationale, linked issue reference, focused verification results, controls, and unchecked live-run limitations. It is complete and align…
      Linked Issues checkPassedIssue #19832 requires blocking_limit to use usage_limit only with rate-limit evidence. The adapter now removes blocking_limit as an independent usage-limit condition. It returns the context-wind…
      Out of Scope Changes checkPassedThe diff changes only ClaudeAdapterV2 classification and user-facing error text, plus focused adapter tests and test-frame support. These changes directly implement issue #19832. No unrelated settin…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge merged thisfb9af9e

    5. juliusmarminge closed this

Sign in to join this conversation.