Skip to content

bug: session status stuck on 'working' at context limit prompt #110

@grimmerk

Description

@grimmerk

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

  1. Upstream: Claude Code adds a hook event for context limit prompt (e.g., ContextLimitReached or reuse Stop with a reason field)
  2. 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
  3. Workaround — JSONL scan: Periodically check the last JSONL entry for stop_reason: None as indicator of context limit state

Reproduction

  1. Run a Claude Code session with a long conversation until context limit
  2. Claude shows "new task? /clear to save 357.4k tokens"
  3. Check ~/.claude/codev-status/{sessionId}.json → still shows "status":"working"

Related

🤖 On behalf of @grimmerk — generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions