lifecycle: ao report completed doesn't terminate the runtime; chain-spawn workers idle until stuck-detection at ~300s
Summary
ao report completed is a state declaration in session-manager.ts:1444-1485 — it writes idle/research_complete to the session's lifecycle and returns. The worker's runtime keeps running; AO's idle-beyond-threshold rule eventually promotes the session to [stuck] after ~300s. This is most visible in chain-spawn flows where the worker's "I'm done" signal fires at the application layer (e.g., after gh pr comment) but the OS process has no obvious reason to exit on its own.
Context
PR #1300 (merged 2026-04-18) redesigned the lifecycle state machine, but the redesign focuses on state vocabulary, not on terminal-state process termination. For workers whose work pattern is "do thing, report done, exit," the gap is invisible — but for workers that could plausibly stay alive after reporting (long-running orchestrator-driven flows, chain-spawn reviewers, workers waiting for follow-up prompts), the gap is real and confusing.
Repro
Our chain-spawn reviewer flow:
- Parent implementer session spawns a sibling reviewer (
ao spawn --agent-type claude-code). - Reviewer fetches the PR diff, runs
/ce-code-review, fires a custom subagent on safe-drawer paths, merges output, and posts a## Review reportPR comment viagh pr comment. - Reviewer calls
ao report completed. AO logs the state transition. Theclaude-codeprocess keeps running (it has nothing to do, but no OS-level signal to exit). - ~300s later, AO's stuck-detection promotes the session to
[stuck]. Operator runsao session kill cd-Nto clear it.
Test 2b (Day 8 of our internal log) had this happen on cd-9 — ao report completed was called explicitly and correctly per the lifecycle vocabulary, and the session still went [stuck].
Local workaround we shipped
Append ao session kill $AO_SESSION_ID to the terminal step of every chain-spawn worker (F3 in our SAS-138 stack):
ao report completed && ao session kill $AO_SESSION_ID
The report writes the state; the kill terminates the runtime. Both required.
Suggested upstream fix
One of:
ao report completed --terminate: opt-in flag that combines the state declaration with an OS-level termination signal to the worker process. Lets workers that intentionally stay alive after reporting (rare) keep current behavior; everyone else just adds the flag.- Default
ao report completedto terminate the runtime, with--keep-alivefor the rare opposite case. Aligns the verbal contract ("completed") with the OS contract ("process exits"). - Document the current behavior explicitly and recommend the
&& ao session kill $AO_SESSION_IDpattern in the docs as the canonical chain-spawn close-out. Lowest-cost fix; doesn't change AO's surface area.
(2) is what most operators expect from "report completed"; (1) is the conservative migration path; (3) is the cheap doc-only option.
Filing fresh because PR #1300 didn't address the runtime-termination dimension, and existing related issues (#1454 inverse case, #1187 zombies, #1503 kill bug) describe different shapes of the same lifecycle-vs-process-exit gap.
Hi, thanks for filing this — really detailed and useful. I'm a contributor on AO and trying to get a sense of how it's working for folks using it in real workflows. Would love to hear a bit more about your experience — happy to hop on a quick 15-min call if that's easier.
Also, the contributors meet on Discord every day at 10pm IST: https://discord.gg/6KgeUjbe — drop in if you're around, good place to see what's being worked on and shape direction directly. @Tonedeath
This issue was created before the AO rewrite and refers to implementation that no longer exists in the current Go/Electron codebase, so we’re closing it as part of the repository cleanup.
If the same user-visible issue still exists in the latest version of AO, feel free to open a new issue with updated details, reproduction steps, logs, and screenshots where applicable. Please describe the current behavior rather than the removed TypeScript implementation.
AO is now available as an app on macOS and Windows, with iOS currently in beta and Android coming soon.
Stay connected with AO:
GitHub: https://github.com/AgentWrapper/agent-orchestrator Discord: https://discord.gg/kGbBRRDPv X: https://x.com/aoagents LinkedIn: https://www.linkedin.com/company/agent-orchestrator Instagram: https://www.instagram.com/aoagents