Hook payload session_id misattributed after /resume
Bug Description
After resuming a session with /resume, the session_id in hook payloads switches to a different, older session ID. All subsequent tool use and prompt events are attributed to the wrong session, while the actual resumed session receives only lifecycle events (SessionStart/SessionEnd).
Environment
- Claude Code version: Latest (Feb 2026)
- OS: macOS (Darwin 24.6.0)
- Shell: zsh
Steps to Reproduce
- Have multiple session JSONL files in a project directory (e.g.,
~/.claude/projects/<project>/) - End a session (
1be8b33f) with/exit - Resume it with
/resumeselecting1be8b33f - Interact with the session (send prompts, trigger tool uses)
- Observe hook payloads — the
session_idfield points to a different session (22c210bd)
Evidence
Session 1be8b33f (the one actually resumed and interacted with)
- JSONL file actively written until 14:58
- Hook events received:
| Time | Event | Notes |
|------|-------|-------|
| 02:43 | SessionStart | source=clear (original) |
| 02:43–03:42 | 200+ tool events | Normal activity |
| 11:31 | SessionEnd | reason=prompt_input_exit |
| 11:42:43 | SessionStart | source=resume |
| 11:42:59 | SessionEnd | Exit |
| 11:43:13 | SessionStart | source=resume |
| (nothing after this) | | Zero tool use or prompt events |
Session 22c210bd (old session, incorrectly receiving events)
- JSONL file last modified at 02:53 AM (session was done hours ago)
- Hook events received:
| Time | Event | Notes |
|------|-------|-------|
| 02:22 | SessionStart | Original session, 225 events |
| 11:43:40 | SessionStart | source=resume — 27 seconds after 1be8b33f was resumed |
| 14:56 | UserPromptSubmit | Should be 1be8b33f |
| 14:57 | PreToolUse/PostToolUse (Bash ×4) | Should be 1be8b33f |
| 15:07 | UserPromptSubmit + Stop | Should be 1be8b33f |
Payload confirmation
The session_id field inside the JSON payload delivered to hooks via stdin is 22c210bd-3efd-4575-9390-226dd6c6bca6 for all misattributed events. This is not a downstream processing issue — Claude Code itself is injecting the wrong session_id.
Expected Behavior
After /resume of session 1be8b33f, all hook payloads (SessionStart, tool uses, prompts, Stop) should contain session_id: 1be8b33f-....
Actual Behavior
- SessionStart lifecycle events are correctly attributed to
1be8b33f - All subsequent tool use and prompt events are incorrectly attributed to
22c210bd(a different, older session in the same project) - The old session
22c210bdalso receives a spuriousSessionStart(source=resume)event
Impact
Any hook-based system that tracks sessions (analytics, logging, agent monitoring) will misattribute all activity to the wrong session after a /resume. This makes session-level analytics unreliable.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗