Repository navigation
Continue in Chat UI opens the chat before closing the terminal, and stops a CLI still starting - #37227
Conversation
…tops a CLI still starting The chat tab now opens right after the terminal and is selected before the terminal closes; its create waits for proof the CLI exited, so the workspace never sits empty while a large conversation loads. The terminal is kept only when the host proves its shell runs nothing, so a CLI clicked before its first status update is stopped instead of left writing beside a chat that can't send.
…ready opening, and keeps a failed chat in place A job started in the shell after the agent quit now goes through the terminal's running-process prompt instead of being stopped silently. A pane not bound to its terminal on this client is treated as unverifiable and closed, like any unverifiable read. When a chat for the same conversation is already opening, Continue shows it and keeps the terminal rather than handing the terminal into a launch it doesn't own. After the terminal closed, a failed start stays in the chat that took its place and says why once, including when the CLI's exit couldn't be confirmed, so the workspace is never left blank. A launch that ended before its tab opened reports its failure again, and a tab picked during the close stays selected.
|
No actionable comments were generated in the recent review.
|
…rs a chat still opening without joining it Only the conversation's own agent is stopped without the running-process prompt; another agent started in that shell is asked about like any other job. A chat already opening the same conversation is found before the new chat starts and shown (or named, from the tab menu) with the terminal kept, so an unconfirmed chat's create is never re-sent beside the running CLI. The in-chat message for an unconfirmed stop no longer points at a host connection. Test timestamps are fixed values.
# Conflicts: # src/renderer/src/i18n/en-runtime-required.json
Review statusProblem. "Continue in Chat UI" on a terminal running Claude or Codex closed the terminal first and opened the chat seconds later. With a large conversation as the workspace's only tab, the workspace sat empty (and could look asleep, with a blank screen until clicked). A CLI clicked in its first seconds could also be left running beside a chat that refused every send. What changes for users. The chat tab opens right after the terminal and is selected before the terminal closes; the chat starts once the CLI has exited. A CLI clicked just after it started is stopped instead of left running. Verified (M4Air, real Claude and Codex through the team load balancers, PR head 5e1b5ec):
Known, accepted for this release (follow-ups for the chat/terminal switch rollout, listed as Temporary in the description):
Not exercised: the sub-300 ms "pick another tab while the chat opens" race (the later pick held in both agents); the "close running terminal?" prompt for a non-agent job (the test pane's conversation already had a chat, which opened instead, as on main). For Brennan's review Main, large conversation after the gap: Spots worth a look: |
…tops a CLI still starting (stablyai#37227) * Continue in Chat UI opens the chat before closing the terminal, and stops a CLI still starting The chat tab now opens right after the terminal and is selected before the terminal closes; its create waits for proof the CLI exited, so the workspace never sits empty while a large conversation loads. The terminal is kept only when the host proves its shell runs nothing, so a CLI clicked before its first status update is stopped instead of left writing beside a chat that can't send. * Continue in Chat UI asks before stopping another job, shows a chat already opening, and keeps a failed chat in place A job started in the shell after the agent quit now goes through the terminal's running-process prompt instead of being stopped silently. A pane not bound to its terminal on this client is treated as unverifiable and closed, like any unverifiable read. When a chat for the same conversation is already opening, Continue shows it and keeps the terminal rather than handing the terminal into a launch it doesn't own. After the terminal closed, a failed start stays in the chat that took its place and says why once, including when the CLI's exit couldn't be confirmed, so the workspace is never left blank. A launch that ended before its tab opened reports its failure again, and a tab picked during the close stays selected. * Continue in Chat UI asks before stopping a different agent, and answers a chat still opening without joining it Only the conversation's own agent is stopped without the running-process prompt; another agent started in that shell is asked about like any other job. A chat already opening the same conversation is found before the new chat starts and shown (or named, from the tab menu) with the terminal kept, so an unconfirmed chat's create is never re-sent beside the running CLI. The in-chat message for an unconfirmed stop no longer points at a host connection. Test timestamps are fixed values.





The problem
Clicking Continue in Chat UI on a terminal running Claude, Codex or another agent closed the terminal tab first and opened the chat only after the agent had exited and the host had started the chat. For a few seconds — longer for a large conversation — the user saw no terminal, no chat and no explanation: the sidebar row lost its agent and looked asleep, and when the terminal was the workspace's only tab the screen went blank until the chat finally appeared. This came in with "close the terminal before continuing its conversation in chat" (#36732).
A second problem from the same change: a CLI clicked within a few seconds of starting (for example one just reopened from Session History or restored after a restart) was treated as "already quit", because Orca had not yet received its first status update. The terminal was left running and a chat opened beside it that refused every message with "Claude is already running this conversation in another terminal".
What changes for users
How it works
runCliChatResumebegins the chat's provisional launch (not deferred) withafterTabIdset to the terminal, waits for the tab to open, then runs the existing terminal close and exit proof.createAfterpromise, awaited once before the host create. The run resolves it after the exit is proven, with false to abandon the create when the terminal stays, or with a refusal that fails the chat with its reason when the terminal closed but its exit wasn't proven.cli-chat-resume-close-admission.ts. The tests were split along the close path to stay under the file-size limit.Compatibility and differences
Intended:
Temporary (follow-ups for the chat/terminal switch rollout, tracked in STA-13388):
Verification
cli-chat-resume-run.test.ts,cli-chat-resume-run-close.test.ts(new: the chat tab exists and is selected before the close runs, with no create until after it; a CLI with no status row yet is closed; a pane whose shell runs nothing keeps its terminal; another job in the pane asks first; an unbound pane or unverifiable read closes; a failure after the close stays in the chat; a tab picked during the close stays selected; another agent in the pane asks first; a pending or unconfirmed chat already opening the conversation is shown, nothing is re-sent and the terminal kept), plus the launch, provisional-tab and probe suites.Tracked in STA-13234 (ships with the #36732 cherry-pick).
Tracked in STA-13349.