Skip to content

Remote env: "explicitly killed" ghost terminal tabs accumulate after host runtime restart (not prunable) #9585

Closed

Description

@letjsk

Version: daemon-host 1.4.146
Platform: Windows 11 client + Windows 11 remote host
Setup: Remote environment over Tailscale WebSocket (client machine connects to a remote Orca runtime on another machine).

Symptom

Terminal tabs showing Session "<worktreeId>::<path>@@<hash>" was explicitly killed persist in the workspace, reappear on reconnect, and cannot be removed by closing the tab. They accumulate over time (started with ~40; new ones keep appearing).

Root cause (observed)

  • The workspace session is persisted keyed by the stable environment id (workspaceSessionsByHostId["runtime:<envId>"]), but individual tabs bind to pty handles (<worktreeId>@@<hash>, serve-<uuid>).
  • Each time the remote runtime restarts, a new runtimeId is issued (observed across a single debugging session: c4cf3d77… → 9072f8c6…, etc.). The prior runtime's ptys are marked "explicitly killed".
  • Orca does not prune the tab/pane bindings whose backing pty was killed, and the terminal daemon (orca-terminal-daemon.exe) retains the dead pty sessions in memory.
  • Result: unclosable "explicitly killed" ghost tabs that come back on every reconnect.

Evidence

  • The ghost pty ids are not present in either machine's orca-data.json (full recursive search = 0 hits on both client and host) → they live only in daemon memory / runtime state, not persisted config.
  • Closing the tab does not clear it; it reappears after reconnect.
  • Restarting orca-terminal-daemon.exe on the host purges all of them at once (but kills all live terminals, and they recur on the next host runtime restart).
  • The runtimeId changes on every host runtime restart.

Repro

  1. Set up a remote environment; open terminals in it from the client.
  2. Trigger a host runtime restart: reboot / sleep→wake / Orca app restart / network (Tailscale) drop.
  3. Reconnect → prior ptys are "explicitly killed"; their tabs remain as ghosts.
  4. Repeat → ghosts accumulate. Closing tabs does not remove them.

Expected

On reconnect / runtime restart, prune tabs whose backing pty is dead (or transparently re-establish them), and evict dead pty sessions from the daemon — instead of leaving unclosable "explicitly killed" ghost tabs.

Workaround

Restart the terminal daemon on the host (kills all live terminals). Recurs on the next host runtime restart.

Activity

  1. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Reproduction status: env_blocked (remote env ghost terminals)

    Explicitly-killed ghost tabs after remote runtime restart need Windows remote env + Tailscale WebSocket host restarts.

    Not labeling cannot_repro.

  2. Karnian commented on Aug 4, 2026

    @Karnian

    Still reproduces on 1.4.167, and not only with a Windows remote host — the same symptom appears with a Linux (WSL2) remote runtime.

    Environment

    • Client: Orca desktop 1.4.167 (Windows)
    • Coordinator: macOS host running orca serve 1.4.167
    • Remote runtime: orca-ide serve 1.4.167 on WSL2 Ubuntu, run as a systemd user service, reached over Tailscale WebSocket

    Observed

    The sidebar lists 31 agents, all Done, all stamped with the same relative time — the moment the remote runtime was restarted. Meanwhile the runtime is idle:

    orca worktree ps --environment <env>   ->  live:0  pty:no
    orca terminal list --environment <env> ->  0 terminals
    remote host                            ->  no agent processes, load average 0.00
    

    So these are purely stale list entries, not live PTYs. The CLI and the sidebar disagree: terminal list says 0, the sidebar says 31.

    Where the entries actually persist

    On the remote runtime, in ~/.config/orca/profiles/local-default/orca-data.json:

    workspaceSession
      tabsByWorktree                    dict{1}
      terminalLayoutsByTabId            dict{33}   <-- stale
      terminalPtyIncarnationsByPaneKey  dict{33}   <-- stale
    workspaceSessionsByHostId           dict{0}    <-- empty
    

    Worth noting against the root-cause analysis in the description: workspaceSessionsByHostId is empty on this host. The stale tab state lives under the singular workspaceSession instead.

    terminal-history is a derived artifact, not the source

    ~/.config/orca/terminal-history/ held 33 directories named <worktreeId>::<path>@@<hash>, 59 MB total. Deleting all of them while the runtime was running:

    1. directory count dropped to 0 (verified)
    2. it returned to 33 within minutes, now 400 KB — scrollback gone, directory structure restored

    The directories are regenerated from the two workspaceSession maps above, so clearing history on disk does not clear the sidebar.

    Restarting the runtime does not help

    systemctl --user restart on the remote runtime leaves all 33 entries in place, matching the "reappear on reconnect" behaviour in the report. No CLI command or UI control removes them (see also #10718 for the missing dismiss affordance).

  3. LesleyMurfin commented on Sep 17, 2026

    @LesleyMurfin
    Contributor

    Cross-referencing: PR #21277 improves the dismissal of orphaned tabs when a host runtime or worktree restarts/tears down. When closing a tab whose underlying worktree selector is gone, the host resolves idempotently with selector_not_found and the renderer lifecycle locks the close intent into durable state, allowing orphaned tabs on deleted or restarted worktrees to be dismissed without entering an infinite flicker/resurrection loop.

  4. nwparker commented on Oct 26, 2026

    @nwparker
    Contributor

    Fixed by #17945 (shipped in v1.4.197), which stops reconnects and rotations from holding on to tabs whose sessions are gone, plus #16752. Closing. If killed-session ghost tabs still pile up on a current build, please reopen with your Orca version.

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 workingorca-remote-serverRemote Orca Server / orca serve / paired remote runtime

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions