Power-off: terminal ENDED and OSC flash while session stays idle/no_signal and not terminated (Cursor)
Summary
On Linux, a Cursor worker can show TERMINAL ENDED / [process exited] and a brief OSC escape flash in the embedded terminal after full power-off, while the session remains isTerminated: false with activity idle and display status no_signal.
Upstream reference: 038547a74 on main.
Root cause: Not proven yet — needs reaper/reconcile logs (ProbeDead vs ProbeFailed, and whether boot Reconcile ran vs the daemon stayed up through sleep).
UI: terminal pane shows process ended; summary shows Idle / no signal; session still treated as live.
Screenshots
TERMINAL ENDED — terminal process ended, session not marked terminated (Permission repro, session 33):

OSC escape sequences in the terminal pane (Referenced from Cursor hook audit session because Permission repro,session 33's couldn't be captured due to speed):

Session loads and Activity Idle in the rail while the chat still shows permission / approval pause (Permission repro):

What upstream main does (relevant paths)
| Layer | Behavior on 038547a74 |
|---|---|
| Activity observer | Cursor is not a continuous terminal reconciler (unlike Muse). Reconciliation mostly targets active + stale output, not blocked. |
Sticky blocked |
applyToolPrecedence only clears blocked on turn boundaries or a correlated post-tool event — not generic terminal-idle. |
Agent exited hook |
ActivityExited does not set IsTerminated; reaper or explicit kill/shutdown does. |
| Reaper | ProbeDead → may terminate only if runtimeClearlyDead (#6726 if still blocked; if idle, must pass 60s defaultRecentActivityWindow since LastActivityAt). |
| Probe ambiguity (conpty) | Dial refused → dead (false, nil); timeout/other → (false, err) → reaper ProbeFailed → no terminate (by design). |
Boot Reconcile |
For live DB rows: if runtime is definitively dead → saveAndTeardownOne → MarkTerminated + restore marker. If probe errors → leave session live (reconcileLive returns error, logged). |
Plausible RCA (needs log confirmation)
idle+no_signalafter relaunch:MarkSpawnedseedsidleand clearsFirstSignalAt;deriveStatuscan showno_signalafter the 90s grace even when the terminal looks empty — consistent with restore/relaunch, not necessarily the permission hook receipt.- Runtime probe not conclusively dead: After reboot or flaky loopback,
ProbeFailed(timeout) leaves the row live while the Electron terminal shows process exited (UI truth ≠ reaper fact). blocked→idlewithout terminate: Not explained by the terminal observer alone for Cursor+blocked. Candidates: turn-boundary hook during crash/teardown, activity API update,MarkSpawnedafter partial recovery, or staleExpectedUpdatedAtreconciliation. Needs logs:reaper:,ApplyActivitySignal,reconcile, conpty probe outcome.
Evidence strength: API snapshots + UI are strong; a single root cause needs ProbeDead vs ProbeFailed at reaper time and whether Reconcile ran vs daemon stayed up through sleep.
Expected behavior
If the Cursor/PTY runtime is gone after power-off (terminal ENDED), the session should converge to terminated or a clear dead-runtime state while AO keeps running, not only on app/daemon shutdown.
Graceful shutdown SaveAndTeardownAll already MarkTerminated by design — “fixed when I quit AO” may be that path, not the reaper catching up.
What to capture for investigation
One session id and timestamps; grep daemon/Electron logs for that id across the power cycle:
- Reaper facts per tick:
ProbeDeadvsProbeFailedvs alive - Activity state at probe time
reconcile: adopt vs save-teardown vs probe error- Any
MarkSpawned/RestoreAllon boot
Environment
- Linux (kernel 7.x), AO data under
~/.ao/data, loopback daemon (port 3001 in testing) - Cursor runtime handles:
ptyhost-v1:<session-id>(no tmux on this machine) - Logs often in the Electron Forge terminal, not a stable
~/.ao/daemon.log
Related
- #6726 — separate confirmed logic bug: sticky
blocked/waiting_inputpreventsruntimeClearlyDeadwhen activity stays sticky withProbeDead
@codebanditssss any updates on this issue?