Repository navigation
fix(agents): the wake sweep no longer forks sessions owned by a disconnected SSH pane or a stale-workspace record - #29454
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
…panes still own Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s unreachable A connected target's live-PTY map is authoritative: sleep kills the PTY but keeps its id. Cross-worktree session dedupe ignores finished and invalid records, the same records claim-key dedupe skips. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ng ssh ownership In a split tab the tab-level pty can belong to another leaf. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t the focused server The focus-read ratchet rejects new reads of the routing default; comparing two records' machines needs only each record's own workspace owner row.
8f685d1 to
d01252e
Compare
ELI5
When you switch back to a workspace, Orca resumes any agent sessions that were asleep there. Before resuming one, it checks whether some terminal pane already owns that conversation. In three cases the check got it wrong and decided nobody owned it. Orca then opened a new tab running a second
claude --resumeon the same transcript. We've seen up to five copies of one session, each leaving an orphan tab and an orphan remote terminal.This takes over #12702 by @robertnisipeanu (rebased onto current main, with one review fix added) and supersedes it.
What Changed
All changes are in the wake sweep (
resumeSleepingAgentSessionsForWorktree) and its pane-ownership check (recordPaneIsOwnedByPreservedPane).unverifiable, notexited. Once the target is connected, the live map decides again, so a workspace the user put to sleep still resumes. In a split, the tab-level terminal is only used as a fallback for a single-pane tab, so one pane is never credited with another pane's terminal. Main's workspace-levelunverifiableguard (STA-3500) already declines the whole sweep for a disconnected SSH workspace. This adds the same verdict per pane, for tabs that the stale-workspace lookup in item 2 now finds.ai-vault-original-pane.tsuses.Why
Each fix extends the existing ownership predicate and sweep rather than adding a parallel mechanism.
Alternatives considered:
worktreeIdfrom the claim key. That changes the dedupe for every caller, including the activation gate and the skip-claim plumbing, which is a much wider change than an explicit cross-workspace check in the one place that launches.worktreeIds on records. That's a migration with its own risks, and it doesn't help records captured later.Linked Issue
Linear STA-3498. Supersedes #12702.
Visual Proof
N/A. This fixes a duplicate tab and process that appeared after a reconnect or workspace switch. Nothing new is rendered.
Testing
src/renderer/src/lib/resume-sleeping-agent-session-live-ssh-dedupe.test.ts(10 tests). The tests for the disconnected SSH pane, the stale workspace id, and the cross-workspace claim fail on main and pass here. The moved-host, folder-workspace and different-machine cases each fail without their review fix.Review
Codex review (gpt-6.1-sol, high):
sleepingRecordNamesAnotherExecutionHostguard.Agent skill upstream boundary
Notes
live/unverifiable/exited. A disconnected target is never treated as proof that the agent died.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)