Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/shared/agent-hook-listener/claude-session-continuation.test.ts (1)
11-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDelete the temp directories after each test.
makeProjectcallsmkdtempSyncin every test and never removes the result. The test at Line 92 writes about 3 MB per run. Every CI or local run leaves these files intmpdir(). Add anafterEachthat removes each createdconfigDir.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d24de933-5509-462a-9a6f-c4f59e891ba8
📥 Commits
Reviewing files that changed from the base of the PR and between 7c50009 and da2bfb57d3f7f8bc4907acbb09711ffb24db1284.
📒 Files selected for processing (7)
src/main/agent-hooks/server-claude-session-continuation.test.tssrc/main/agent-hooks/server/server-agent-presence.tssrc/relay/agent-hook-server-claude-session-continuation.test.tssrc/relay/agent-hook-server.tssrc/relay/relay-agent-presence.tssrc/shared/agent-hook-listener/claude-session-continuation.test.tssrc/shared/agent-hook-listener/claude-session-continuation.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
One case this doesn't reach: Seen on Orca 1.4.222 (macOS) with Claude Code 2.1.291 in the job. The pane's transcript In the same pane, a Codex run started from the job later relabelled the row as Codex (#24516, #24641), so from then on the Claude-only check here no longer runs for this row. |
d67721d to
d263cf1
Compare
|
Thanks, good catch. I reproduced it on Claude Code 2.1.280: after d263cf14e8 follows that. When the row's session has a job state whose The Codex relabel is a separate problem (#24516, #24641). Once the row is Codex, this check is right to leave it alone, so I'd leave that to those. |
d263cf1 to
2633fff
Compare
…tablyai#24117) When Claude Code forks a pane's session into a daemon job (`/background`, or an interrupt followed by a new prompt), the job keeps running in the same pane but its hooks are declined since stablyai#15304. The pane's row kept the old providerSession, so mobile native chat showed the old transcript while Stop still interrupted the live job. The old transcript records `continued-in` with the new session id. On each presence recheck the execution host's hook server (and the relay for SSH) reads the tail of the row's transcript, verifies the fork beside it carries the new id, and rewrites only the row's providerSession as a replay, keeping state and evidence age. A fork another pane already reports is left alone. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`/clear` inside a job starts a new transcript without writing `continued-in`, so the chain stopped at the job's first transcript. The job's state.json keeps its first sessionId and names the current one in resumeSessionId and linkScanPath; follow that when the new transcript sits beside the old one and carries the new id. It is checked before the size memo because the old transcript stops growing after `/clear`. Reported by Sangkwun on stablyai#26569. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… evidence Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Rs88gCErtCoZLvrC7fTCXm
2633fff to
5d3dcc7
Compare
…(adopts #26569) (#33605) Panes follow a Claude Code conversation that moves into a background job (agent view ← then Enter, and /clear inside the job): on the presence recheck Orca reads the pane's own transcript `continued-in` record and the job's state.json (UUID-validated, sibling-folder only, overtaken pointers ignored, cwd kept) instead of trusting job hooks, so mobile and native chat stop freezing on the old session. Refs #24117 Supersedes #26569 Co-authored-by: mtsr404 <[email protected]> Co-authored-by: dimakrest <[email protected]>
ELI5
Claude Code can move the conversation in an Orca terminal into a background job while the terminal keeps showing it. Orca never hears about the new conversation, so the phone keeps showing the old one. Claude leaves a note in the old conversation file saying where it continued, and Orca now follows that note.
What Changed
Before: Claude Code can fork a pane's session into a daemon job while the same pane keeps showing it. On Claude Code 2.1.280, pressing ← to open the agent view and then Enter to reopen the conversation does this. #15304 makes the hook script drop all of the job's hooks, so the pane's row keeps the old
providerSession, and on mobile:After: on the existing presence recheck (a real title change or a finished command), the execution host reads the tail of the row's transcript for Claude's
continued-inrecord. If the forked transcript is in the same project directory and its records carry the new id, the host rewrites only the row'sproviderSession, as a replay, so the state and evidence age don't change./clearinside the job starts another transcript without writingcontinued-in, so the host also follows the job'sstate.jsonwhen itsresumeSessionIdnames a later session in the same directory. Mobile chat then reads the new transcript. SSH hosts runorcad, which uses this same hook server, and the WSL guest's hook relay does the same for WSL panes.Why
This is direction 2 from #24117, where @dimakrest worked out the root cause and both directions.
It keeps #15304's rule: nothing comes from the worker's environment. The only evidence is the pane's own transcript, which the row already records. Per the Agent Status rule in AGENTS.md, it is a producer writing to the hook server's store, so no reader adds its own precedence. I didn't take these alternatives:
Limits:
/backgroundfollowed byclaude attachisn't covered. There the pane'sclaudeexits and Orca clears the row first, so there is no old session to follow. That case still needs direction 1.Linked Issue
Fixes #24117
Visual Proof
No screenshots, since the visible change is a chat that stays current instead of freezing. I ran the same steps on this branch and on 1.4.223 with an Android phone; see Testing.
Testing
claude-session-continuation.test.ts(13 tests): a pointer that isn't the last line, a pointer for another session, a fork file that doesn't name the session, a fork that reaches disk after the first check, a pointer appended after an empty scan, a transcript larger than the first scan, the jobstate.jsonfallback and its directory guard, a chain with a cycle, and/clearinside a job (followed after the transcripts stop growing; ignored when the job state names the same session, points outside the project, or names a file without that id).server-claude-session-continuation.test.ts(4 tests): real hook posts, thencheckAgentPresence.last-status.jsonand leaves state and prompt unchanged.src/wsl-guest/agent-hook-server-claude-session-continuation.test.ts(2 tests): the WSL guest's relay forwards the fork withisReplay, and a later suspension without it.The rebinding, other-pane, WSL relay,
/clearand suspension tests fail with their call or guard removed.pnpm typecheck, the changed-lines quality gate, the max-lines ratchet and anti-slop pass.pnpm test src/main/agent-hooks src/wsl-guest src/shared/agent-hook-listener(2300 tests) passes.Manual A/B on macOS with Claude Code 2.1.280 and the Android app, in a throwaway repo. Steps: start
claudein a pane and send a prompt, press ← then Enter to reopen it as a job, then send another prompt.pnpm dev): the pane's row moved to the job's session, and mobile chat showed the reply to the second prompt.On my original case, the tracker resolves the real 912 MB transcript to its fork in about 5 ms.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
I used Claude Code (Claude Opus 5.5) to investigate, implement and test this, and I reviewed the result.
Review
AI review summary:
node:path, with no platform-specific code.orcadwith this hook server; main skips rows relayed from WSL (they carry aconnectionId), and the WSL guest's relay handles them inside the distro.state.json. The new id is validated withnormalizeAgentProviderSession.Agent skill upstream boundary
Notes
Security, cross-platform, SSH, mobile, backwards compatibility and performance are covered in the review summary above.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code