Warmup SID Separator
[Created by Codex: 019b74ad-1ac6-7261-962f-e3b9cd21ccb5]
Overview
Distinguish the ephemeral SID emitted by claude.warmup from the “real” session SID used by claude.user_prompt / claude.session_start. Use this to avoid false “resume forked to a new SID” conclusions when tailing sse_lines.jsonl.
When To Use
- •Debug “resume created a new SID” reports where the first observed SID differs from the resumed SID.
- •Implement pid→sid attribution for dashboards, tail bridges, or agent managers consuming
~/centralized-logs/claude/sse_lines.jsonl. - •Confirm whether a mismatch is a true fork (
--fork-session) vs a warmup/telemetry artifact.
Rules (Separate Warmup SID vs Real SID)
To classify SIDs for a single pid:
- •Treat
claude.warmupas pre-session telemetry; record its SID aswarmupSidbut do not treat it as the session identity. - •Treat the first SID observed on any “session boundary” event as the real
sessionSid. Prefer in this order:- •
claude.session_start - •
claude.user_prompt - •(fallback)
claude.stop
- •
- •If a
resumeFromSidis known and later appears as thesessionSid, prefer it even if a different SID was seen earlier. - •Do not freeze
observedSidon “first SID seen for pid”; allow it to update oncesessionSidis established.
Implementation Pattern
To implement robust pid→sid mapping:
- •Track
warmupSid?: stringandsessionSid?: stringseparately perpid. - •Set
warmupSidonclaude.warmup. - •Set
sessionSidonly onclaude.session_start/claude.user_prompt(or fallback events). - •Use
sessionSidas the canonical sid for UI grouping; keepwarmupSidonly for debugging.
Verification Script (Repro + Interpretation)
Run scripts/verify_claude_resume_sid_artifact.mjs to reproduce the warmup-SID artifact and print a PASS/FAIL interpretation.
Bundled Resources
- •
scripts/verify_claude_resume_sid_artifact.mjs: Spawns Claude Code in stream-json mode, resumesSID_A, and confirmsclaude.user_prompt/claude.session_startpreserveSID_Aeven ifclaude.warmupemits a fresh SID first. - •
scripts/inspect_claude_pid_sids.mjs: Scans the tail of a Claudesse_lines.jsonlfor a givenpidand printswarmupSidvs derivedsessionSidwith an interpretation.