Summary
When Claude Code hits its context limit and shows the "new task? /clear to save Xk tokens" prompt, the session status in CodeV stays stuck on "working" (orange pulse) instead of transitioning to "idle" (green).
Root Cause
Claude Code's Stop hook does not fire at the context limit prompt. The last hook event is UserPromptSubmit (working) or SubagentStart (working). The context limit pause is an internal Claude Code state with no corresponding hook event.
Evidence from JSONL: the last assistant message has stop_reason: None (not end_turn), confirming the response was truncated rather than completed normally.
Impact
- Session shows incorrect status (working instead of idle) indefinitely
- User might think the session is still processing
- Affects all terminal types (not VS Code-specific)
Possible Fixes
- Upstream: Claude Code adds a hook event for context limit prompt (e.g.,
ContextLimitReached or reuse Stop with a reason field)
- Workaround — timeout heuristic: If a session has been "working" for >5 minutes without any new hook events, assume it's stalled and mark as idle or a new "stalled" status
- Workaround — JSONL scan: Periodically check the last JSONL entry for
stop_reason: None as indicator of context limit state
Reproduction
- Run a Claude Code session with a long conversation until context limit
- Claude shows "new task? /clear to save 357.4k tokens"
- Check
~/.claude/codev-status/{sessionId}.json → still shows "status":"working"
Related
🤖 On behalf of @grimmerk — generated with Claude Code
Summary
When Claude Code hits its context limit and shows the "new task? /clear to save Xk tokens" prompt, the session status in CodeV stays stuck on "working" (orange pulse) instead of transitioning to "idle" (green).
Root Cause
Claude Code's
Stophook does not fire at the context limit prompt. The last hook event isUserPromptSubmit(working) orSubagentStart(working). The context limit pause is an internal Claude Code state with no corresponding hook event.Evidence from JSONL: the last assistant message has
stop_reason: None(notend_turn), confirming the response was truncated rather than completed normally.Impact
Possible Fixes
ContextLimitReachedor reuseStopwith a reason field)stop_reason: Noneas indicator of context limit stateReproduction
~/.claude/codev-status/{sessionId}.json→ still shows"status":"working"Related
🤖 On behalf of @grimmerk — generated with Claude Code