openclaw - 💡(How to fix) Fix subagents tool should expose 'kill' and 'reap-stale' actions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
RAW_BUFFERClick to expand / collapse

Problem

The subagents tool currently only exposes action='list'. When a child run goes ghost (parent waiting on a child that will never complete), there is no in-tool way to terminate it. The only recovery path is a full gateway restart, which is destructive — it kills every healthy subagent and session along with the stuck one.

Requested actions

action='kill'

Args: runId (or sessionKey, or taskName as a stable alias). Effects:

  1. Terminate the underlying child process / session.
  2. Emit a synthetic completion event to the parent so sessions_yield unparks.
  3. Remove the run from the active list.

action='reap-stale'

Optional helper. Args: olderThanMs (default 600000). Effects:

  1. Iterate active runs whose last activity is older than olderThanMs.
  2. Apply 'kill' semantics to each.
  3. Return a summary { reaped: [...], skipped: [...] }.

Motivation

Today (2026-05-27) two stuck subagent chains in the same workspace forced two gateway restarts (TSK-20260527-0006 and TSK-20260527-0010 v1). The restart disrupts other healthy work, breaks session continuity for unrelated channels, and is the wrong granularity of recovery.

Related: upstream issue for gateway-enforced runTimeoutSeconds (filed separately) would prevent most ghost cases; subagents kill is the manual escape hatch when prevention isn't enough.

Acceptance

  • subagents action='kill' target=<runId|sessionKey|taskName> terminates the target and emits a completion event to its parent.
  • subagents action='reap-stale' (optional) does the same in bulk.
  • Tool schema documents both actions in the allowed values enum.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix subagents tool should expose 'kill' and 'reap-stale' actions