Repository navigation
fix(claude): start a resumed Claude chat when its SessionStart hook names a boot id - #48404
Conversation
…ames a boot id Claude CLI 2.1.117 runs a resume's SessionStart hooks while it loads the transcript, before it switches to the resumed session, so their stream-json frames carry a random boot session_id. Orca read that as Claude starting a different session and failed the start with "claude provider session expected". On a resume, a SessionStart hook frame naming another session is now ignored; a foreign system/init still refuses, and fresh starts keep the check. Fixes #48370
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
Reopening an existing Claude chat could fail with "Claude couldn't start" on some Claude CLI versions. The CLI briefly reports a throwaway session id while it reopens the chat, and Orca took that as Claude starting the wrong conversation. Orca now ignores that one early report on a reopen.
What Changed
--resume), aSessionStart:resumehook frame that names another session is ignored: it neither proves nor refuses the session.system/initstill refuses startupsystem/init, which carries the resumed id. A mismatch there still ends the session through the existing late-refusal path.claudeForeignFrameRefusesStartupinclaude-structured-init-proof.ts, with a unit test.Why
Claude CLI 2.1.117 runs a resume's SessionStart hooks while it loads the transcript, before it switches to the resumed session, and stamps their stream-json frames with its random boot
session_id. This was reproduced with the real 2.1.117 binary: a SessionStart hook plus--resume <id>prints hook frames with a different id. A current CLI (2.1.331) prints the resumed id. A fresh--session-idstart and a fork (--fork-session --session-id) on 2.1.117 both print the expected id, so the check stays strict for them.Any SessionStart hook triggers it, including Orca's own optional status hooks, so affected users saw
Error: claude provider session expectedon resumed chats and bots. Asking users to upgrade the CLI would leave older installs broken. Ignoring every foreign SessionStart frame would drop a check that is accurate on fresh starts. Checked against how comparable products handle this.Linked Issue
Fixes #48370
Follow-ups for two older identity gaps found in review, not changed here: #48402, #48403.
Visual Proof
N/A: no UI change. The visible effect is that a resumed Claude chat starts instead of showing "Claude couldn't start".
Testing
claude-structured-init-proof.test.tsuses the exact 2.1.117 resume frames.Performance
None, because this only changes a string comparison on frames that already arrive during startup.
Risk
Level: Low. The riskiest case is a CLI that resumes into a different session and reports it only through a
SessionStart:resumeframe. That mismatch is now caught at the first turn'ssystem/initinstead of at startup. Back out with a plain revert.