Skip to content

[Bug]: serve/headless: closed workspace tabs resurrect on workspace re-entry — orphan PTYs re-adopted, persisted tabs rehydrated without tombstone check #21066

Closed

Description

@Shujakuinkuraudo

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:

  1. Orphan PTY adoption — closeTab fires pty.kill via Promise.allSettled (fire-and-forget, failures only console.warn). If the kill doesn't land before the next workspace activation, the activation path (pty.listSessions → createTab for any session with no owning tab) re-materializes the tab with the still-running agent.
  2. Persisted-state rehydration without tombstone check — hydrateHeadlessMobileSessionTabsFromWorkspaceSession runs before every session.tabs.list/close and rebuilds mobileSessionTabsByWorktree from persisted workspaceSession.tabsByWorktree; s9i() expands tabs purely from the persisted records and never consults closedTerminalTabTombstonesByTabId / terminalSurfaceTombstonesByPaneKey. Any close that fails to persist (session.patch throttling, remoteWorkspace push 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?

  1. Run orca serve headless; pair a mobile client over WSS.
  2. Open a workspace, run an agent in a terminal tab.
  3. Close the tab (×), then leave and re-enter the workspace — repeat. Some fraction of the time the tab returns.
  4. orca terminal list --json shows the PTY still connected: true, orphaned: false.

Anything else that might help:

Activity

  1. AmethystLiang commented on Sep 16, 2026

    @AmethystLiang
    Contributor

    thanks for reporting. looking into it

  2. added
    bugSomething isn't working
    orca-remote-serverRemote Orca Server / orca serve / paired remote runtime
    os:linuxIssues affecting Linux
    on Sep 19, 2026
  3. added theissue type on Sep 19, 2026
  4. nwparker commented on Oct 26, 2026

    @nwparker
    Contributor

    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 serve on 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 of orca terminal list --json right after it reappears would help. We'll close this in two weeks if we don't hear back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmobileorca-remote-serverRemote Orca Server / orca serve / paired remote runtimeos:linuxIssues affecting Linux

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions