Skip to content

fix: context bar not updating for resumed Claude Code sessions#72

Merged
gi11es merged 1 commit intogi11es:masterfrom
trogulja:fix/context-bar-resumed-sessions
Apr 6, 2026
Merged

fix: context bar not updating for resumed Claude Code sessions#72
gi11es merged 1 commit intogi11es:masterfrom
trogulja:fix/context-bar-resumed-sessions

Conversation

@trogulja
Copy link
Copy Markdown
Contributor

@trogulja trogulja commented Apr 6, 2026

Fixes #71

Summary

  • notify.sh: Read session_id from stdin JSON (provided by Claude Code on every hook) instead of draining stdin and relying solely on PID walking. PID walking is retained as fallback if stdin doesn't contain session_id.
  • updateSessionId: Remove guard that blocked session ID updates for tabs that already had one — this was a workaround for the PID walking limitation and prevented resumed sessions from getting the correct ID.

Why

For resumed sessions, ~/.claude/sessions/<pid>.json contains a new PID-based session ID that doesn't match the original JSONL transcript. ContextMonitor.getUsage() looks for the JSONL using this wrong ID and never finds it, leaving the context bar empty.

Test plan

  • New Claude session → context bar populates ✓
  • Resumed Claude session → context bar populates ✓
  • All existing tests pass
  • 3 new tests for stdin extraction, PID walking fallback, and ordering

The hook script was draining stdin (`cat > /dev/null`) and using PID
walking to find the session ID. For resumed sessions, the PID-based
session file contains a different ID than the original JSONL transcript,
so `getUsage` could never find the file.

Now reads `session_id` from stdin JSON (provided by Claude Code on every
hook invocation), which works for both new and resumed sessions. PID
walking is retained as a fallback if stdin doesn't contain session_id.

Also removes the guard in `updateSessionId` that blocked session ID
updates for tabs that already had one — this was a workaround for the
PID walking bug and is no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gi11es
Copy link
Copy Markdown
Owner

gi11es commented Apr 6, 2026

Works great, thank you!

@gi11es gi11es merged commit 9a75f32 into gi11es:master Apr 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context bar doesn't update for resumed Claude Code sessions

2 participants