Skip to content

[Bug]: After an orca serve restart, surviving terminals come back with no title and unknown agent status #22809

Closed

Description

@mmarabel

Operating system

Linux

Orca version

1.4.210 (headless orca serve). The code involved is unchanged on main at f5d2ce5, which includes 1.4.211.

Details

Short summary: when a headless orca serve runtime restarts and picks up the terminals that survived in the terminal daemon, those terminals come back with no title, an empty preview, no agent identity and status: null from terminal.agentStatus. They stay that way until the agent prints or reports something new, and an idle agent sitting at its prompt never does. The restore seeding added in #12579 exists, but this path never reaches it.

What happens

Two terminals in a throwaway serve instance: one sets a Claude-style idle title and sleeps, the other runs an idle Pi. Here is terminal list plus the terminal.agentStatus RPC, before and after systemctl --user restart of the runtime. The daemon PID is the same both times, and both terminals report connected: true afterwards:

title agentIdentity preview agentStatus
A before ✳ Claude Code claude shell text running, idle
A after null null "" not running, null
B (Pi) before π - repo pi Pi footer running, idle
B (Pi) after null pi "" running, null

orca terminal read still returns the output from before the restart, so the daemon has the history; it just never gets back into the runtime's records. On a real host, all 11 terminals had title: null after two serve restarts, and every idle agent that had not reported anything since the restart read as unknown.

How can we reproduce it?

The daemon has to survive the runtime restart. That is the case when serve runs as a systemd user unit (the daemon goes into its own orca-daemon-*.scope) or under a macOS LaunchAgent.

  1. Start an isolated runtime:
    systemd-run --user --unit=orca-repro --setenv=XDG_CONFIG_HOME=/tmp/repro/config /usr/bin/orca-ide serve --port 6799 --no-pairing
  2. export ORCA_USER_DATA_PATH=/tmp/repro/config/orca, then orca repo add --path <scratch repo>.
  3. Create two terminals:
    • orca terminal create --worktree path:<repo> --command "sh -c 'printf \"\033]0;✳ Claude Code\007\"; echo repro; exec sleep 3600'"
    • orca terminal create --worktree path:<repo> --command pi (any agent left idle at its prompt works)
  4. Check orca terminal list --json and the terminal.agentStatus RPC for each handle. Both show a title and idle.
  5. Run systemctl --user restart orca-repro and wait for ready. The daemon PID is unchanged.
  6. Check the same things again. You get the "after" rows above.

Expected: re-adopted terminals keep their last title (and with it the title-based status and agent identity) and their preview, the same as terminals that come back through the reattach spawn path.

Why (at f5d2ce5)

  • With no renderer re-spawning panes, serve adopts surviving daemon sessions from the controller inventory: refreshPtyWorktreeRecordsWithControllerInventory calls recordPtyWorktree(session.id, …, { connected: true }) (orca-runtime-refresh-pty-worktree-records-with-controller-inventory.ts:212). No restore payload is involved, so seedTerminalRestoreRecordsFromSpawnResult and seedTerminalRestoreTail, which are only called from the two spawn-commit.ts files, never run. fix(runtime): seed terminal previews and titles from restore payloads #12579 assumed that restart restores go through the renderer spawn handler. Seeding now also runs on the runtime-controller spawn path, but inventory adoption is a third path that never reaches it. agent-session-owners.ts:24 warns that without the seed "headless/CLI-created reattaches stay blank", and that is what happens here.
  • The inventory can't carry the title either. DaemonPtySessionInventory.listProcesses hardcodes title: 'shell' (daemon-pty-session-inventory.ts:62), and SessionInfo (daemon/types.ts:369) has no title field. Yet the daemon tracks lastTitle and already sends it with the reattach snapshot (daemon-pty-spawn-result.ts:325).
  • RuntimeTerminalAgentStatusQuery is then left with no hook row (restored rows are restoredUnconfirmed by design, fix(agent-status): restore hydrated nonterminal statuses as unconfirmed #12346) and no title, so it returns status: null (runtime-terminal-agent-status-query.ts:129).

Impact

Anything that gates on agent status sees every idle agent as unknown after a serve restart or update, and it stays that way until someone prompts that agent. For example, an automated updater that waits until no agent is mid-turn has to treat unknown as busy, so it waits indefinitely. #13203 describes the same root cause (an idle pane stays silent after a restore) for orchestration mail delivery, but its fix is limited to that path.

Possible fix

  • When the inventory adopts a live session whose record was never written (restoredTerminalTailSeedAllowed), fetch the daemon's restore snapshot and run it through seedTerminalRestoreTail, with the same seed rules as today (no waiters, no lastOutputAt). Or, lighter:
  • Add an optional lastTitle to SessionInfo / PtyProcessInfo from the daemon's title tracking, and seed it with applySeededAgentStatus on adoption. Older protocol adapters would simply omit it.

Related: #12579, #13203, #16538, #12346

Activity

  1. AmethystLiang commented on Sep 25, 2026

    @AmethystLiang
    Contributor

    Thanks for reporting. Looking into it.

  2. brynnclaw commented on Sep 30, 2026

    @brynnclaw
    Contributor

    A related case on Linux, for anyone who lands here with blank or missing terminals after a restart. It has a different cause, and #22834 is not expected to fix it.

    On a headless Linux host (Ubuntu 24.04, systemd 255, orca serve as a system unit with User=<account>, Linger=no), the terminals did not come back at all. The service had been restarted while an SSH login of that account was open, so the daemon was placed in orca-daemon-<nonce>.scope under the account's user@<uid>.service, which that login had started. About 10 s after the account's last SSH session closed, the user journal showed Stopping orca-daemon-<nonce>.scope / Stopped orca-daemon-<nonce>.scope, and every terminal in it was gone.

    How to tell the two apart:

    • This issue ([Bug]: After an orca serve restart, surviving terminals come back with no title and unknown agent status #22809): the daemon PID is the same before and after the restart, terminal list shows the terminals as connected: true, and orca terminal read still returns the old output. Only the title, preview, agent identity and status are missing.
    • The linger case: the daemon PID is gone or new, the old terminals are not in the inventory, and the user journal shows the orca-daemon-*.scope being stopped around the time the last login closed. Nothing survived, so there is nothing for the adoption path to restore.

    A note for reproducing #22809 with systemd-run --user over SSH: with lingering off, the user manager (and the transient unit with it) stops shortly after you log out, so keep the session open or run loginctl enable-linger for the test account first.

    The cause of the linger case is that the durable-scope probe accepts a user manager that exists only because a login session is open. I filed it separately as #24201.

    AI disclosure: written with Claude Opus 5.5 (claude-opus-5-5), Anthropic; the journal lines are from the affected host.

  3. nwparker commented on Oct 24, 2026

    @nwparker
    Contributor

    Thanks for the detailed report and repro, mmarabel. Two fixes shipped in v1.4.228: #29623 keeps the tab titles of terminals a restarted server adopts, and #29654 republishes tabs when a restored title lands. Could you retest after an orca serve restart on the latest build? If title, preview or agent status still come back empty, please reply or reopen and we will take another look.

  4. Sangkwun commented on Oct 29, 2026

    @Sangkwun

    Retested on 1.4.244 (macOS 27.0.1, headless orca serve under a LaunchAgent). The restart was an in-place update from 1.4.243 through the runtime updater (updater.check, download, install). The terminal daemon and the agent processes survived it. I did not capture the terminal list before the restart.

    About 65 minutes after the restart, orca terminal list --json on that host showed 19 terminals:

    terminals
    created before the restart 18
    of those, title: null 18
    of those, lastOutputAt: null 18
    created after the restart, with a title and lastOutputAt 1

    Two of the 18 were Claude Code sessions that had started a new turn two to three minutes earlier and were still working. Both still had title: null, lastOutputAt: null and preview: "", while orca terminal read --screen returned the current screen for both. Five other terminals of the 18 had their Claude Code process exit and start again in the same terminal one to five minutes before the list, and they also stayed at title: null and lastOutputAt: null. So the output reaches the runtime, but the restored records are not updated. On this build, printing something new does not bring a surviving terminal back.

    The missing state also has a safety side effect. A Claude permission menu that was open across the restart was not treated as a wait, and a retried orca terminal send --text … --enter was accepted and typed into the menu. I filed that separately as #35962.

  5. Sangkwun commented on Oct 30, 2026

    @Sangkwun

    Two corrections to my comment above. "Five other terminals" should be "five terminals", because one of the five was also one of the two working sessions. And "returned the current screen for both" is not fully right: on one of the two screens, two rows near the bottom still showed a line from about seven hours before the restart, but the rest was current, so the conclusion stands. About 14 hours after the restart, the same 18 terminals still have title: null and lastOutputAt: null.

  6. added a commit that references this issue on Nov 6, 2026
    5d770b7
  7. added a commit that references this issue on Nov 6, 2026
    9f9dbcf
  8. nwparker commented on Nov 8, 2026

    @nwparker
    Contributor

    Thanks Sangkwun for the detailed retest. That shows what was wrong: after a restart, a headless server never attached to the terminals it adopted, so their title, last output and preview were never updated. #36137 (v1.4.246) and #38760 (v1.4.252) fix this, and #38704 (v1.4.251) re-attaches after the daemon connection is rebuilt. Please update to v1.4.252 or later and restart serve once. If adopted terminals still show title: null / lastOutputAt: null on that version, please open a new issue and link this one.

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

Metadata

Metadata

Assignees

Labels

os:linuxIssues affecting Linux

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions