Skip to content

[Bug]: After an auto-update restart, mail to an idle coordinator is held until the agent works again (9 h late wake) #45906

Open

Description

@FACTERINVURT

Operating system

Windows (WSL2 Ubuntu execution runtime)

Orca version

1.4.266 (auto-updated from 1.4.261 mid-run)

Details

Related: #19025 (same lastAgentStatusObservedLive delivery gate) and #13203 (restored idle pane that never speaks again). This is a concrete end-to-end instance of that dead end, triggered by an auto-update restart, with the evidence that Orca already held a persisted idle status for the pane and did not use it.

A worker sent worker_done to a run whose coordinator tab had been idle at its prompt for 31 minutes. Orca stored the message but did not type the wake line ("You have 1 orchestration message. Run orca orchestration check ...") into the coordinator for 9 h 05 min. It typed it 1 s after the coordinator finished a turn that the user started by hand. Between the coordinator going idle and the message arriving, Orca had auto-updated and restarted. The coordinator's PTY survived the restart (daemon reattach), but the new main process never saw the agent's status "live" again, so pointer delivery refused the terminal as not settled and parked the mail indefinitely.

Timeline (ids from orchestration.db, main.trace.ndjson, daemon.log, and the Claude Code transcript)

UTC Event
10:29:29 Run run_6c22b5f12b67 created; coordinator term_26ffb9e4-7380-4513-8d97-00e87e5e5944, pane af0c8bce-...:f087c885-.... Worker dispatch ctx_66d9f24b589b (runtime_epoch f5b6eebe-..., the pre-update runtime) started in term_33c11f2f-....
10:42:34 Coordinator ends its turn. Claude Code Stop hook runs OK (posted to hook port 60148 of the old instance). Coordinator is idle at its prompt from here on.
10:43:19-10:43:21 updater_update_downloaded 1.4.266 -> updater_quit_and_install_started -> updater_will_quit_cleanup_started {daemonTeardown: "disconnect"} -> backend exits.
10:44:23-10:44:44 New main process (pid 52112) starts; new daemon v61; terminals reattach (session-attached, persistence.pty-binding origin=reattach). New hook endpoint written (port 57145) to ~/.orca-wsl/agent-hooks/instance-*/endpoint.env.
11:13:46 Worker sends msg_1a367705a179 (worker_done) to run:run_6c22b5f12b67. created_at 11:13:46. Dispatch settles succeeded.
11:13 -> 20:18 Nothing. No wake typed. Coordinator still idle (no hook events, no output).
20:18:21 The user types a message into the coordinator by hand. Agent goes working.
20:18:55.643 Coordinator turn ends (Stop).
20:18:55 / 20:18:56 msg_1a367705a179.delivered_at = 20:18:55; wake line appears in the coordinator at 20:18:56.

Root cause (from reading the shipped bundle, resources/app.asar -> out/main/index.js, 1.4.266)

Pointer delivery (class uci, deliver(e, t)):

if (!J8(e) || !this.deps.isAgentSettledForDelivery(a)) { this.parkRedelivery(r, t.reservedTypes); return }
...
function J8(e){ return e.lastAgentStatusObservedLive && $si(e.lastAgentStatus) }   // $si: idle|working

lastAgentStatusObservedLive is set to true only when this main process observes a live agent status (title/OSC/hook processing, ...f.lastAgentStatusObservedLive=!0..., followed by observeAgentIdle and d && this.deliverPendingMessagesForPty(e)). After the update restart the coordinator PTY is reattached with no live observation, so J8 is false. The mail is parked (parkRedelivery), and the only thing that re-drives it is the next live status transition of that PTY. An idle agent emits none, so delivery waited until the user made the agent work and stop again. readTerminalMailHold even classifies this state as {kind: "unverified"}, but nothing re-verifies it.

The persisted last status for that pane (agent-hooks/last-status.db) held the coordinator's Stop/done state from 10:42:34, i.e. Orca had durable evidence that the agent was idle, but the restarted process did not use it for delivery eligibility.

Expected

After a restart/reattach, a terminal whose agent was last known idle (persisted hook status, or a TUI-idle screen probe, which deliveryTuiVerdict already implements) is delivery-eligible, or Orca re-probes a parked mailbox on a timer. Mail to an idle coordinator is delivered within seconds of arrival, not on the next human keystroke.

Suggested fixes (any one)

  1. On reattach, seed lastAgentStatus/lastAgentStatusObservedLive from the persisted hook row when the agent process identity (agentPresence.process pid + start time) still matches.
  2. When deliver parks for !J8(e) on a reattached PTY, run the existing TUI-idle verdict (deliveryTuiVerdict) and deliver if it reads idle; or arm a re-check timer, as checkDeliverySettledAndArmRecheck does for other refusals.
  3. At minimum, surface the held state ("1 message held: agent status unverified since restart") in the UI so the user knows to poke the tab.

Repro sketch

  1. Start an orchestration run with a Claude Code coordinator in a terminal tab; start a worker.
  2. Let the coordinator end its turn (idle at prompt).
  3. Restart Orca (or let it auto-update) while the worker runs; the coordinator PTY reattaches.
  4. Have the worker orchestration send a worker_done to run:<id>.
  5. Observe: no wake line in the coordinator. Type anything into the coordinator; the wake line appears right after that turn ends.

Evidence locations (this machine)

  • %APPDATA%\orca\logs\main.trace.ndjson (updater breadcrumbs 10:43:19-10:44:33; no delivery activity 11:13-20:18)
  • %APPDATA%\orca\logs\daemon.log (reattach at 10:44:42-44)
  • %APPDATA%\orca\orchestration.db -> messages row msg_1a367705a179 (created_at 2026-11-20 11:13:46, delivered_at 2026-11-20 20:18:55); worker_dispatches.ctx_66d9f24b589b.runtime_epoch = pre-update epoch
  • %APPDATA%\orca\agent-hooks\last-status.db (persisted coordinator status)

🤖 Generated with Claude Code

Activity

  1. Jinwoo-H commented on Nov 24, 2026

    @Jinwoo-H
    Contributor

    Thanks for the detailed timeline. We found the remaining cause: since the agent status cache moved to batched saves (#39995), a pane's "turn ended" status could be up to 3 minutes old on disk. So after an exit that skips the normal quit flush (an update relaunch, a crash), the restored idle coordinator couldn't be proven at rest, and its mail was held until it worked again. #47887 (merged) saves a pane's turn start and end right away and keeps everything else batched. With it, mail to an idle Claude coordinator was delivered within seconds after a relaunch or a crash in our tests. Together with the earlier repaint fixes (#46286, #46378), this should cover the case here; please let us know if you still see it on the next build.

  2. a-meledin commented on Nov 27, 2026

    @a-meledin

    Still reproduces on 1.4.279 (Windows 10, native — not WSL; Claude Code coordinator in a terminal tab).

    • 08:47:52 UTC: auto-update to 1.4.279 (updater_quit_and_install_started, daemonTeardown: "disconnect"); terminals reattached.
    • After the restart, wake lines reached the coordinator only right after it finished a turn the user had started by hand.
    • From ~09:11 UTC the coordinator sat idle at its prompt. Mail piled up with no wake: a worker ask (the worker stayed blocked on it) and a worker_done at 10:19 UTC (dispatch auto-released). Both were seen only after the user typed into the coordinator by hand at ~10:20 UTC.
    • Workaround that works: the coordinator keeps a background orca orchestration check --peek --wait --timeout-ms <n> running. It returns when mail arrives, and the agent harness then wakes the coordinator (first hit: a worker_done at 10:34 UTC).

    So #47887 does not seem to cover this case on Windows native. I can pull specific rows from orchestration.db / last-status.db if useful.

  3. stanleytejakusuma commented on Dec 1, 2026

    @stanleytejakusuma

    Another data point, for Pi terminal panes on 1.4.282 (Linux, headless orca serve):

    • After the serve restart for the 1.4.282 upgrade, 32 of 41 live Pi terminal panes are missing from orca agent list. The 9 that are listed are exactly the panes that ran a turn after the restart. All 41 have the right ORCA_PANE_KEY, and the managed orca-agent-status extension reads the fresh endpoint file, so reporting itself works once an event fires.
    • The Pi-specific part: the managed Pi extension posts session_start on startup/resume, but deliberately skips it on reason === 'reload' ("Reload replaces registration without ending the turn; preserve status"). After a serve restart there's no status left to preserve, so /reload can't bring an idle pane back into view. Only its next turn does, which matches the held-mail symptom here.
    • Possible fix on the Pi side: when the extension sees session_start with reason: 'reload' and no turn is in flight, post the idle status again, or re-post once whenever the endpoint file's mtime or port changes. That would let a reload re-register idle panes after a restart, independent of the persisted-status work in fix(agent-hooks): save a pane's turn changes within a second so a crash or Relaunch keeps idle mail flowing #47887.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions