Repository navigation
Description
Operating system: Linux (Ubuntu 24.04, headless orca serve AppImage)
Orca version: v1.4.201
Short summary:
On orca serve (headless AppImage) with a mobile client paired over WSS, clicking into a workspace sometimes resurrects previously closed tabs. Two resurrection paths race with tab close:
- Orphan PTY adoption —
closeTabfirespty.killviaPromise.allSettled(fire-and-forget, failures onlyconsole.warn). If the kill doesn't land before the next workspace activation, the activation path (pty.listSessions→createTabfor any session with no owning tab) re-materializes the tab with the still-running agent. - Persisted-state rehydration without tombstone check —
hydrateHeadlessMobileSessionTabsFromWorkspaceSessionruns before everysession.tabs.list/closeand rebuildsmobileSessionTabsByWorktreefrom persistedworkspaceSession.tabsByWorktree;s9i()expands tabs purely from the persisted records and never consultsclosedTerminalTabTombstonesByTabId/terminalSurfaceTombstonesByPaneKey. Any close that fails to persist (session.patch throttling,remoteWorkspacepush failure on WSS) leaves a record that rehydrates the closed tab.
All anti-resurrection guards (closedTerminalTabTombstonesByTabId, recentlyClosedAgentStatusTabIds, daemon-side closedAgentStatusTabIds) are in-memory only — lost on client reload / daemon restart.
What happened?
Closed terminal/agent tabs (pi, codex sessions) reappear with some probability when re-entering a workspace on the mobile client. orca terminal list --json on the host afterwards shows the agent processes still connected — i.e. the close removed the tab but did not kill the PTY.
How can we reproduce it?
- Run
orca serveheadless; pair a mobile client over WSS. - Open a workspace, run an agent in a terminal tab.
- Close the tab (×), then leave and re-enter the workspace — repeat. Some fraction of the time the tab returns.
orca terminal list --jsonshows the PTY stillconnected: true, orphaned: false.
Anything else that might help:
- Host evidence:
~/.config/orca/profiles/local-default/orca-data.jsonworkspaceSession.tabsByWorktreeretains tab records whose PTYs were loggedsession-killed/session-exitedindaemon.log— the same persisted-residue shape described in Phantom terminal tabs survive close and are restored from persisted layout state (SSH host) #10342 and [Bug]: Session restore duplicates editor tab records in orca-data.json — closed editor tab resurrects on every restart #17185, but on the serve/headless + mobile path rather than SSH. - Closing the process first (agent
/exit, shellexit) before closing the tab prevents resurrection — consistent with the orphan-adoption diagnosis. - Related: Phantom terminal tabs survive close and are restored from persisted layout state (SSH host) #10342 (phantom tabs, SSH variant), [Bug]: Session restore duplicates editor tab records in orca-data.json — closed editor tab resurrects on every restart #17185 (editor-tab variant), [Bug]: Duplicate pi terminal tab spawned on worktree switch (session restore), even with Agent sleep off #10208 (duplicate agent tab on worktree switch); PRs fix(remote-workspace): stop closed SSH terminal tabs from resurrecting — add close tombstones #16571 and fix(terminal): prune explicitly-killed SSH tabs on create #10365 were abandoned, fix(ssh): stop remote workspace pulls from resurrecting closed tabs #12339 is still open.
- Suggested fixes: make
pty.killincloseTabawaited/retried so unowned live PTYs can't be re-adopted; makes9i()/headless rehydration honorterminalSurfaceTombstonesByPaneKeyandclosedTerminalTabTombstonesByTabId; persist the closed-tab tombstones so they survive client reload.
Activity
AmethystLiang commentedon Sep 16, 2026
thanks for reporting. looking into it
feat(runtime): durable host tombstones for closed terminal tabs and p…
nwparker commentedon Oct 26, 2026
Thanks @Shujakuinkuraudo for the detailed write-up. We think this is fixed now. v1.4.225 (#27125) stores closed-tab records with the session, so a later session write can't bring a closed tab back. v1.4.238 (#31711) stops quick closes on the phone from reviving each other. Headless
orca serveon Linux has also run on a new server (orcad) since v1.4.224. Could you check on v1.4.241, host and phone both? If a tab still comes back, the output oforca terminal list --jsonright after it reappears would help. We'll close this in two weeks if we don't hear back.