Repository navigation
fix(remote): reopening a slept tab resumes when the other holder's agent has proven exited - #29588
Merged
Merged
Conversation
…ent has proven exited A pane whose shell outlived its agent kept counting as the session's live holder because its PTY was alive, so a paired client got a plain shell. Ask the hook store: a holder it proves exited no longer blocks the resume; unverifiable still does.
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On a paired phone or other client, reopening a slept agent tab could give you a plain shell instead of resuming the conversation. That happened when a different pane had once held the same conversation and still had a terminal open after its agent quit. Now the tab resumes in that case.
What Changed
Before: when a paired client reopens a slept tab, the host first checks whether another pane still holds the same agent conversation, because resuming it twice would put two writers on one transcript. The check (#29272) treated any other pane with a live terminal as a holder. An agent that exits back to its shell leaves the terminal alive, so the check kept refusing even though the host's agent-status store had already proved that agent exited (#29483). The tab then opened a plain shell.
After: each candidate holder is checked against the host's agent-status store. A holder whose agent the store proves
exitedno longer blocks the resume. A holder that isliveorunverifiable, or that has no evidence either way, still blocks it, so a dropped SSH connection is never taken as an exit.Mechanism:
isProviderSessionLiveInAnotherPaneis now async and askscheckHookAgentPresence(paneKey, 0)about each pane that still holds the conversation. That call is the runtime's existing binding to the hook store's presence check and recorded exits.Why
The agent-status store on the execution host owns agent liveness, and the runtime already reads it through
checkHookAgentPresenceelsewhere (PTY exit confirmation, orphan adoption). Reusing it keeps one source of truth. The alternatives were exposingagentPresenceon the snapshot rows (a wider shape change that reaches every reader) or treating a PTY with no foreground agent as exited (a guess, and wrong over SSH).Linked Issue
Follow-up to #29272 and #29483 (found in a review of today's merges).
Visual Proof
N/A: this changes host-side resume selection, which is covered by runtime tests.
Testing
pnpm test src/main/runtime/orca-runtime.test.ts -t "holder|another pane|hook store": new cases. A live-PTY holder whose agent the hook store provesexitednow resumes (fails before the fix). Anunverifiableholder still gets a plain shell. The existing holder tests still pass.pnpm tc:node,pnpm run check:code-quality:changed.Verified live: nothing. Verified only in tests: all of the above. A live check needs a paired client, a slept tab, and a second pane holding the same provider session whose agent has exited to its shell.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Codex review (gpt-6.1-sol, high): no findings.
Agent skill upstream boundary
Notes
SSH: for a remote-owned row, the hook store's presence check returns
unverifiableunless it holds a recorded exit, so a disconnected remote holder still blocks the resume. Wire: no change. Folder workspaces: unaffected (pane-keyed).Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)