fix(subagents): retire stale unended runs

Co-authored-by: HCL <chenglunhu@gmail.com>
This commit is contained in:
Peter Steinberger
2026-04-25 05:14:41 +01:00
parent 97fd45a8c1
commit 757aee4cdd
12 changed files with 464 additions and 9 deletions

View File

@@ -343,6 +343,18 @@ Sub-agents use a dedicated in-process queue lane:
- Lane name: `subagent`
- Concurrency: `agents.defaults.subagents.maxConcurrent` (default `8`)
## Liveness and recovery
OpenClaw does not treat `endedAt` absence as permanent proof that a sub-agent
is still alive. Unended runs older than the stale-run window stop counting as
active/pending in `/subagents list`, status summaries, descendant completion
gating, and per-session concurrency checks.
After a gateway restart, stale unended restored runs are pruned unless their
child session is marked `abortedLastRun: true`. Those restart-aborted child
sessions remain recoverable through the sub-agent orphan recovery flow, which
sends a synthetic resume message before clearing the aborted marker.
## Stopping
- Sending `/stop` in the requester chat aborts the requester session and stops any active sub-agent runs spawned from it, cascading to nested children.