openclaw - 💡(How to fix) Fix Bug: Subagent completion events lost when parallel spawns finish within 5-8s

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…

When two subagents are spawned in parallel via sessions_spawn and both complete within 5-8 seconds of each other, their completion events fail to arrive at the parent session. The sessions_yield call returns without a subagent completion notification.

Root Cause

Suspected Root Cause

Fix Action

Fix / Workaround

This prevents reliable parent-subagent orchestration. Our workaround is to call subagents list after every sessions_yield return to manually check for silently-completed subagents, but this adds latency (60s+ polling intervals).

Likely a race condition in the event dispatch layer when two sub-sessions complete almost simultaneously -- the second completion signal may be dropped or overwritten by the first.

RAW_BUFFERClick to expand / collapse

Description

When two subagents are spawned in parallel via sessions_spawn and both complete within 5-8 seconds of each other, their completion events fail to arrive at the parent session. The sessions_yield call returns without a subagent completion notification.

Reproduction

Environment: OpenClaw (edge), deepseek/deepseek-v4-pro, Windows 10 x64, openclaw-weixin channel.

Steps:

  1. Spawn two subagents simultaneously via sessions_spawn with mode="run"
  2. Both subagents complete quickly (25-32s runtime each, 5-8s gap between completions)
  3. Call sessions_yield on parent session

Expected: Parent session receives completion events for both subagents.

Actual:

  • When completion gap > 40s: both events arrive normally (2/2)
  • When completion gap = 8s: only 1 of 2 events arrived (1/2)
  • When completion gap = 5s: both events lost (0/2)

Evidence

TaskXiaoHeiXiaoBaiGapEvents Arrived
humanizer_review31s80s49s2/2
poller_review_v127s19s8s1/2
poller_final_v232s27s5s0/2

Transcript analysis: In the lost-event sessions, the last assistant message has an empty stopReason field (should be "stop"), and the transcript file contains no session-end event. The sub-session appears to never properly signal completion.

Impact

This prevents reliable parent-subagent orchestration. Our workaround is to call subagents list after every sessions_yield return to manually check for silently-completed subagents, but this adds latency (60s+ polling intervals).

Suspected Root Cause

Likely a race condition in the event dispatch layer when two sub-sessions complete almost simultaneously -- the second completion signal may be dropped or overwritten by the first.

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 Bug: Subagent completion events lost when parallel spawns finish within 5-8s