claude-code - 💡(How to fix) Fix Extended thinking burns unlimited tokens on 'continue' with large context — no output, no timeout, requires SIGKILL [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54288Fetched 2026-04-29 06:31:22
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

Error Message

  • Three separate assistant turns over 40 minutes: 2026-04-28T11:23:41, 2026-04-28T11:31:46, 2026-04-28T11:41:26
  • All three turns contained only empty <thinking> blocks — no text, no tool calls
  • SIGINT (Ctrl+C) was caught and ignored by the process (SigCgt includes signal 2)
  • Required kill -9 (SIGKILL) to terminate
  • Session PID: 12852, session ID: e88176e4-994d-478f-b477-30a437d2b753
  • Claude Code version: 2.1.119

Root Cause

~50% of user's monthly usage limit consumed with zero productive output. The in-flight API request continued billing even after the user sent Ctrl+C, because the signal was ignored.

RAW_BUFFERClick to expand / collapse

Bug Report

What happened

Resuming a large session (~5MB JSONL context) with the single word continue triggered unbounded extended thinking that ran for 40+ minutes, consumed ~50% of the user's monthly usage limit, and produced zero output — no text, no tool calls, no code.

Reproduction steps

  1. Have a long session with large context (5MB+ JSONL)
  2. Session hits usage limit mid-task and pauses
  3. Next day, type continue to resume
  4. Claude reloads the entire conversation history into a new extended thinking request
  5. Extended thinking runs indefinitely with no output

Observed behavior

  • Three separate assistant turns over 40 minutes: 2026-04-28T11:23:41, 2026-04-28T11:31:46, 2026-04-28T11:41:26
  • All three turns contained only empty <thinking> blocks — no text, no tool calls
  • SIGINT (Ctrl+C) was caught and ignored by the process (SigCgt includes signal 2)
  • Required kill -9 (SIGKILL) to terminate
  • Session PID: 12852, session ID: e88176e4-994d-478f-b477-30a437d2b753
  • Claude Code version: 2.1.119

Expected behavior

  • Extended thinking should have a maximum duration / token budget per turn
  • If thinking exceeds a threshold with no output, the turn should be aborted and the user notified
  • SIGINT should interrupt an in-flight extended thinking request, not be silently swallowed
  • continue on a large context should not unconditionally trigger extended thinking

Impact

~50% of user's monthly usage limit consumed with zero productive output. The in-flight API request continued billing even after the user sent Ctrl+C, because the signal was ignored.

Root cause hypothesis

When continue is sent to a session with a very large cached context, Claude attempts to re-plan the entire prior conversation before acting. With extended thinking enabled, this planning phase has no output requirement and no token cap enforced client-side, allowing it to spin indefinitely.

Suggested fix

  • Add a per-turn extended thinking timeout (e.g. 5 min) that forces a partial output or abort
  • Make SIGINT cancel the current in-flight streaming request, not just queue an interrupt
  • Warn the user when resuming a session with context >X tokens that extended thinking may be costly

extent analysis

TL;DR

Implementing a per-turn extended thinking timeout and making SIGINT cancel in-flight requests can prevent unbounded thinking and reduce unnecessary resource consumption.

Guidance

  • Introduce a timeout for extended thinking (e.g., 5 minutes) to force partial output or abort, preventing indefinite runs.
  • Modify the signal handling to ensure SIGINT cancels the current in-flight streaming request instead of being ignored.
  • Consider adding a warning for users when resuming sessions with large contexts (>X tokens) about potential costs of extended thinking.
  • Review the current token budget and duration limits for extended thinking to ensure they are adequate and enforced.

Example

No specific code snippet is provided due to the lack of direct code references in the issue, but the fix would involve modifying the extended thinking logic to include timeouts and proper signal handling.

Notes

The suggested fixes aim to address the symptoms described but may require further adjustments based on the specific implementation details of Claude's extended thinking feature and signal handling mechanisms.

Recommendation

Apply the workaround by introducing a per-turn extended thinking timeout and improving signal handling to prevent similar issues until a more comprehensive fix can be implemented. This approach directly addresses the observed unbounded thinking and ignored SIGINT issues.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Extended thinking should have a maximum duration / token budget per turn
  • If thinking exceeds a threshold with no output, the turn should be aborted and the user notified
  • SIGINT should interrupt an in-flight extended thinking request, not be silently swallowed
  • continue on a large context should not unconditionally trigger extended thinking

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING