Repository navigation
fix(automations): sleep a finished run's terminal instead of closing it - #28838
Conversation
The agent dies before its shell, so the shell's command-finished mark read as the agent exiting and deleted the record the hibernation had just written.
Closing it left the run's own workspace empty, so opening it later showed a blank chat or shell instead of the run's conversation. Fixes stablyai#28645
|
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
|
ELI5
When an automation run finished, Orca closed the terminal the run had used. Opening that run's workspace later found nothing inside, so Orca opened a new empty chat (or an empty shell with Chat UI off) and the run's conversation was nowhere to be seen. Now Orca puts the run's terminal to sleep instead of closing it, and opening the workspace wakes it with the conversation back on screen.
What Changed
Before: clicking a finished run's workspace in the sidebar opened a new "Claude Chat" with an empty "Ask anything" box. The run page's "Resume workspace" button opened the same empty workspace.
After: the sidebar click, and "View run" on the run page, open the run's own terminal, which picks up the agent's conversation again (
claude --resume <id>,codex resume <id>,opencode --session <id>).How:
shutdownCompletedAgentPaneForHibernation) instead of closing the tab. The agent process still stops; the tab stays, along with a resume record. The run keeps its tab and pane ids and drops only the stopped process's id.suppressedPtyExitIds). The experimental auto-hibernation uses the same helper, so it gets the same fix.Why
The terminal was closed on purpose in #9493, so recurring runs don't pile up hidden tabs and agent processes. Sleeping the pane keeps that benefit: the process still stops, and the only thing left is one tab in a workspace that exists for that run anyway.
Other options were saving the agent's session id on the run and building a new reopen path, which would repeat what hibernation and its wake already do, and importing the conversation into native chat, which is bigger and changes a terminal run into a chat.
Linked Issue
Fixes #28645
Visual Proof
Opening a finished Claude run's workspace from the sidebar, Chat UI on.
Testing
Tested by hand on macOS in a hidden dev build, with real runs of Claude Code 2.1.300, Codex 0.162.1 and OpenCode 1.18.35:
Not tested: SSH and WSL hosts. An agent with no conversation id and a stop that fails are covered by unit tests only.
Review
Worth a close look: the guard in
pane-agent-identity.ts, since it changes shared terminal-pane behaviour, not only automations.Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)