Skip to content

Bug: sessions_yield wakes parent with yield continuation instead of child completion event #84839

Closed as not planned

Description

@lileilei-camera

Environment

  • OpenClaw version: v2026.5.19
  • Model: deepseek-v4-pro
  • Agent: coder (using sessions_spawn + sessions_yield to delegate to subagent)

Symptoms

When a parent agent calls sessions_spawn → sessions_yield to wait for a child subagent, and the child completes, the parent never receives a completion notification. The parent is only awakened by a timer-based yield continuation, sees the old yield context ("waiting for child"), assumes the child is still running, and stops — never processing the completion.

The child subagent's work is fully successful, but the parent never learns about it.

Evidence

Parent transcript (c10a8206-5248-4089-9c09-623895716f40.jsonl)

[05:25:26] sessions_spawn → child c329eb41 created
[05:25:34] sessions_yield → "status": "yielded"
[05:25:34] custom_message: openclaw.sessions_yield (yield note)
                                           ← 6 minutes of nothing
[05:31:25] assistant: "子 agent 正在执行,等待完成通知。" → stop
           ↑ parentId = yield note (62054bbe)
           ↑ No child completion event between yield and this

Child transcript (cd255cda-0103-45bf-b25f-98e3e65c6091.jsonl)

[05:26:23] 6 tool + 2 feature directories deleted
[05:29:08] src/index.ts rewritten (imports + registrations removed)
[05:30:48] npm run build ✅
[05:30:58] npx tsc --noEmit ✅
[05:31:02] todo-4 → completed  ← ALL WORK DONE
[05:31:14] "All done. Here's the summary..."  ← LAST MESSAGE

Gateway log (openclaw-2026-05-21.log) — 13:31:00–13:31:26 CST

13:31:02  [lcm] child afterTurn (todo-4 completed, persisted)
13:31:15  ⇄ res ✓ agent.wait 349006ms  ← timer-based return, NO payload
13:31:15  [lcm] child afterTurnTranscriptReconcile (last child turn)
13:31:16  "All done. Here's the summary..." (console.log — NOT a dispatch)
13:31:18  persona-bootstrap → agent:coder:main  ← parent session restarts
13:31:18  [lcm] parent bootstrap + assemble (restores yield context)
13:31:26  "子 agent 正在执行,等待完成通知。" → stop

Root Cause

The Gateway does not dispatch child completion events to a yielded parent period.

There is no subagent_announce, deliverToRequester, wakeParent, or any similar event anywhere in the gateway log. A full-text search of the entire 7438-line log file confirmed zero matches for any child→parent completion delivery mechanism.

The two lifecycles are fully decoupled in the Gateway:

Child:  work completes → session end (status=done) → LCM persist → END
                                                      ↑
                                                      No event dispatched to parent
                                                      
Parent: sessions_yield → agent.wait(timer) → timer fires → return bare
                                                              ↓
                                                     LCM restore yield context
                                                              ↓
                                                     Model sees "still waiting" → stop

The agent.wait call (L5816) returned after 349,006ms with no payload whatsoever — it is purely a timer-based yield continuation, not triggered by child completion.

Expected Behavior

When a child session completes while the parent is yielded via sessions_yield:

  1. The Gateway should dispatch a child completion event to the parent
  2. This event should wake the parent from the yielded state
  3. The parent transcript should contain the child's completion summary or metadata
  4. The parent can then process completion, verify results, and respond to the user

Affected Sessions

Role Session Status Runtime Tokens
Parent agent:coder:main (c10a8206) done 6,819ms —
Child agent:omoc_coder:subagent:c329eb41 (label: remove-7-tools) done 343,443ms 37,162

Impact

  • Parent agent never learns child work is complete → no verification, no result reporting to user
  • User sees incomplete response ("still waiting")
  • All child work is actually correct and complete — no data loss, but UX is broken
  • sessions_spawn + sessions_yield cannot be used to reliably wait for child completion

Activity

  1. clawsweeper commented on May 21, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

    Close as duplicate: the remaining bug is already tracked by the open yielded-parent completion thread, which now includes native sessions_spawn plus sessions_yield evidence matching this report; this issue’s detailed logs are useful supporting context, but they do not need a separate tracker.

    Canonical path: Track and fix the yielded-parent completion/resumption contract through #52249, preserving this issue’s transcript/log evidence as supporting data for that canonical work.

    So I’m closing this here and keeping the remaining discussion on #52249.

    Review details

    Best possible solution:

    Track and fix the yielded-parent completion/resumption contract through #52249, preserving this issue’s transcript/log evidence as supporting data for that canonical work.

    Do we have a high-confidence way to reproduce the issue?

    Yes, at source and related-report level: current main still has separate hidden yield-context persistence and completion handoff paths, and the canonical open issue contains matching native sessions_spawn plus sessions_yield production evidence. I did not run a fresh live provider reproduction in this read-only review.

    Is this the best way to solve the issue?

    Yes for triage cleanup: closing this duplicate while routing the fix through the broader open tracker is the best maintainer path. A separate issue would split the same yielded-parent completion contract across multiple queues.

    Security review:

    Security review: Non-PR issue review; no patch security or supply-chain review applies.

    What I checked:

    Likely related people:

    • steipete: Peter Steinberger dominates git shortlog for the central subagent/yield files and authored yielded subagent pause and related sessions-yield behavior commits. (role: feature-history and recent area contributor; confidence: high; commits: 42514156e03c, 6f3b5f8666f3, 3b2db583cdb1; files: src/agents/pi-embedded-runner/run.ts, src/agents/subagent-announce-delivery.ts, docs/tools/subagents.md)
    • galiniliev: Galin Iliev authored the recent merged stale subagent completion recovery work in subagent-announce-delivery.ts, directly adjacent to the wake and requester-agent handoff path. (role: recent native completion delivery contributor; confidence: high; commits: 04eac15f43d5, 57ec361682e2; files: src/agents/subagent-announce-delivery.ts, src/agents/subagent-announce-delivery.test.ts)
    • vincentkoc: Vincent Koc has recent commits in subagent lifecycle and embedded-run final-text handling that are near the yielded-parent completion and run-finalization surfaces. (role: adjacent subagent lifecycle contributor; confidence: medium; commits: 48042c387556, 8fce663861a7, a4c81c6f3583; files: src/agents/subagent-registry-run-manager.ts, src/agents/pi-embedded-runner/run.ts)

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 229490a48924.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    on May 21, 2026
  3. locked as resolved and limited conversation to collaborators on May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions