Skip to content

[Bug]: Scheduled Claude thread fails every run with "Insufficient context allowance" while the task reports succeeded #28654

Closed

Description

@Ryan-Alfaddaghi

Summary

A scheduled task bound to a long-lived Claude thread failed for about 34 hours with Insufficient context allowance for the provider handoff, while the task's lastRunStatus stayed succeeded. The thread was not permanently wedged: a manual /compact recovered it. T3 just never tried that itself.

Steps to reproduce

  1. Bind an hourly scheduled task to a thread on claudeAgent (claude-opus-5-5, 1M window) and let the native session grow large (about 808k tokens here, after 400+ runs).
  2. Run a turn on that thread with another provider (Codex), so a handoff back to Claude is pending.
  3. Let the next scheduled run start on Claude.

Expected

T3 compacts the native session, or otherwise makes room, and the run proceeds. If it can't, the schedule reports the failure.

Actual

  • The run fails 0.2-0.4s after starting, with ContextHandoffBudgetError, without reaching Claude. Provider auto-compaction therefore never fires.
  • Every later run fails the same way. This thread had 37 such failures between 2026-10-30 and 2026-11-01.
  • list_scheduled_tasks kept reporting lastRunStatus: "succeeded", apparently because the message was delivered and the run started. An unattended automation has no signal that it stopped working.

Cause (from the shipped bundle)

handoffBudget computes window - native - current - max(16000, window / 4). At 808k of 1M that is 0 or less, so deliverContextHandoffs raises ContextHandoffBudgetError. The check only runs on non-compaction turns; a bare /compact sets deferInline, which is why it recovers the thread.

Suggested fix

  1. When the budget is exhausted on a provider with supportsCompaction, compact automatically and retry the turn once.
  2. Report the run's terminal status in the scheduled task's lastRunStatus.

Workaround

Send a bare /compact to the thread. The next normal turn then succeeds.

Related

#15997, #19875, #23275, #23142: same error, in other providers or triggers. #19875 is the case where /compact cannot recover.

Environment

T3 Code desktop, CLI t3 v0.1.0, Linux (Arch-based, Omarchy), Claude Agent provider with Codex as the other provider.

🤖 Generated with Claude Code

Activity

  1. juliusmarminge commented on Nov 1, 2026

    @juliusmarminge
    Member

    I ran this as a provider-switch integration scenario that matches the report: Claude with a 1M window and 808k tokens already used natively, a Codex turn in between, then a Claude turn.

    That recovery shipped in https://git.cafe/pingdotgg/t3code/pulls/25610 (07242abff3), first released in v0.1.4. This report is from t3 v0.1.0, so updating should stop the repeated failures without a manual /compact.

    The second part, lastRunStatus showing succeeded for a run whose turn failed, is tracked in https://git.cafe/pingdotgg/t3code/issues/17889 and has an open fix in https://git.cafe/pingdotgg/t3code/pulls/23131.

    Closing this one as fixed on main. The status reporting continues in https://git.cafe/pingdotgg/t3code/issues/17889.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions