Repository navigation
Reopen a closed terminal worker from its orchestration card - #37210
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
34a116b4-dab0-494e-acff-c55b792fbdd2
Files selected for processing: 14-
mobile/src/session/open-mobile-structured-session.tssrc/main/runtime/orchestration/orchestration-party-location.test.tssrc/main/runtime/orchestration/orchestration-party-location.tssrc/main/runtime/rpc/methods/orchestration/caller-show.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-chat.test.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-chat.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.tssrc/main/runtime/rpc/methods/structured-agent-session-create.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-workspace.tssrc/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat.tssrc/renderer/src/lib/open-agent-message-sender.test.tssrc/renderer/src/lib/open-existing-structured-session.tssrc/shared/rpc-contract/orchestration-params.tssrc/shared/structured-agent-cli-conversation-adoption.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
Keep partyLocation a pure lookup; clients call partyOpen for a sender and fall back to partyLocation on older hosts. Adopt from the closed pane's recorded transcript, test terminal liveness by its PTY, keep follow-ups free of chat-host installation, and report a possibly-created chat as retryable.
…y identity only A follow-up to a worker whose conversation a chat holds reveals that chat in the background when its tab was closed, so the follow-up is delivered there instead of being refused. Recorded-source adoption passes only the pane identity and conversation fields source matching reads.
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d4bff55a-d5fd-42c4-b556-694b63dd1a80
Files selected for processing: 6-
src/main/native-chat/structured-agent-cli-source.tssrc/main/native-chat/structured-agent-session-source-admission.test.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-chat.test.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-chat.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-placement.ts
Files with no reviewable changes: 2-
- src/main/native-chat/structured-agent-session-source-admission.test.ts
- src/main/runtime/rpc/methods/orchestration/worker/closed-worker-chat.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
partyOpen now resumes the closed worker's saved conversation in a new terminal through the follow-up resume path, reusing a terminal that already holds it, and answers with the terminal location. Removes the chat conversion and everything only it needed; follow-up placement is as on main.
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
443e5174-5bba-4cca-916f-9a74c9c27ab9
Files selected for processing: 4-
src/main/runtime/rpc/methods/orchestration/caller-show.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-terminal.test.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-terminal.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
64eb91b6-3441-4f73-8dd5-b21f16889eb9
Files selected for processing: 2-
src/main/runtime/rpc/methods/orchestration/worker/closed-worker-terminal.test.tssrc/main/runtime/rpc/methods/orchestration/worker/closed-worker-terminal.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
…ens-as-chat # Conflicts: # src/renderer/src/lib/open-agent-message-sender.test.ts
…ly a terminal whose hook row names the conversation
Summary
Symptom. In a native chat, an orchestration card ("Started worker" / "Update from worker") links the worker's name. For a terminal worker (Claude Code or Codex in a terminal), Orca closes the terminal about two minutes after the worker reports, so clicking the name almost always ends in "Agent's pane is no longer available."
Cause. The host's sender lookup (
orchestration.partyLocation) still answers with the terminal handle (or "lost terminal") after Orca closed the terminal, so desktop and phone try to focus a pane that no longer exists. The worker's conversation is saved on its resource row (resume_session), but nothing used it on this path.Fix. A new host call,
orchestration.partyOpen, answers like the lookup, except when it finds a terminal worker that Orca released and whose terminal is no longer connected. Then it resumes the worker's saved conversation in a new terminal in the worker's workspace and answers with that terminal, which desktop and phone already focus. It uses the same resume path a coordinator follow-up uses to reopen a closed worker.sendto that worker finds it through the existing "the user already has it open" check and delivers there; follow-up placement is unchanged from main.partyLocationis unchanged and stays a pure lookup. Desktop and phone callpartyOpenonly for a sender click. When an older host refuses the call (method_not_found/forbidden), they fall back topartyLocation, so mixed versions keep today's behaviour.Unchanged / limits. These keep today's answer: a worker with no saved conversation, a conversation recorded on a different execution host than the workspace's (the resume path's host match rule), and workers whose terminal is still connected. SSH workspaces resume over SSH where the resume path already supports them. If the resume is refused for another reason (the workspace is asleep in a window, another pane holds the conversation, or the create fails), the click shows the existing "try again" failure instead of the pane-gone toast. Chat workers are unaffected. No new UI or copy.
Testing
closed-worker-terminal.test.ts, through the realpartyOpenhandler and SQLite: a closed worker's click resumes its conversation in a new terminal and a second click reuses it; no saved conversation, or a conversation recorded on another host, keeps thepartyLocationanswer; a later follow-up is placed into the reopened terminal, not a second one; an uncertain resume retries as the same request; once the agent left the reopened terminal, a click resumes again.open-agent-message-sender.test.ts,NativeChatAgentMessageCard.test.tsx,native-chat-agent-message-sender-host.test.tsx, mobileuse-mobile-agent-message-navigation.test.ts(each also covers the older-host fallback topartyLocation), and the orchestration method census.--maxWorkers=2:src/main/runtime/rpc,src/main/runtime/orchestration,src/main/runtime/runtime-rpc,src/main/runtime/session-lifecycle,src/main/native-chat,src/shared, renderernative-chat,liband AI vault, and the whole mobile suite.pnpm tc(all projects), mobile typecheck, oxlint, oxfmt, anti-slop lint, and the pr.yml check scripts.delivery=follow_up) with no second terminal. Not run on a phone; the phone uses the same host call and its existing terminal handling.