Skip to content

ACP parent session stuck until refresh when yielded waiting for child completion #52249

@dapzthelegend

Description

@dapzthelegend

When an ACP child session completes while a parent session is yielded waiting for the result, the parent session remains stuck/non-responsive until the user manually refreshes the UI.

Root cause: The ACP parent-stream relay was using transcript inspection (isYieldedParentAwaitingResume()) and direct gateway re-entry (resumeYieldedParent()) instead of the normal system-event + heartbeat wake path. This ad-hoc resumption path can leave parent session state wedged.

Steps to Reproduce

  1. Open control-ui or web chat
  2. Spawn ACP child: sessions_spawn({ runtime: "acp", agentId: "codex", task: "..." })
  3. Yield parent: sessions_yield()
  4. Wait for child to complete
  5. Observe: Parent session appears stuck, not responsive
  6. Verify: Manual refresh required to unblock chat

Expected Behavior

Parent session automatically resumes when child completes, without manual intervention.

Root Cause

In src/acp/parent-stream-relay.ts (compiled to dist/auth-profiles-CCgh0vEZ.js):

The emitOrResume(...) helper was doing:

if (isYieldedParentAwaitingResume(transcript)) {
  resumeYieldedParent(...)  // ← direct gateway re-entry
} else {
  enqueueSystemEvent() + requestHeartbeatNow()
}

This transcript-sniffing + direct-re-entry approach bypasses the normal session wake scheduler, causing state inconsistency.

The Fix Applied

We deployed a Phase A stabilization patch that changed the relay to:

always: enqueueSystemEvent() + requestHeartbeatNow()
never: direct resumeYieldedParent() call

This forces all ACP completion follow-ups back onto the existing system-event + heartbeat wake path.

Files Affected

  • src/acp/parent-stream-relay.ts (source)
  • dist/auth-profiles-CCgh0vEZ.js (compiled, where patch was applied)

Workaround Status

Phase A patch deployed locally. Tests show parent now auto-resumes on child completion (without manual refresh), but relies on heartbeat wake machinery rather than dedicated yield-resume path.

This is a stabilization patch. The proper long-term fix is:

Proper Fix (Phase B)

Implement explicit yieldWait state tracking in the runtime:

  1. Persist parent yield-wait state when sessions_yield is called
  2. Emit formal ParentYieldWaitLifecycleEvent on child completion
  3. Use dedicated resumeAcpYieldWaitingParent() path (code already exists but unused)
  4. Clear wait state on completion
  5. Do not rely on transcript inspection or ad-hoc gateway calls

System Information

  • OpenClaw: 2026.3.13 (61d171a)
  • Node: 25.8.1
  • Affected: All ACP spawn + yield workflows in browser UIs

Impact

Severity: High

  • Makes ACP tasks in threads/web chat appear frozen
  • User must manually refresh to proceed
  • Degrades UX for code review, long-running tasks in browser
  • Affects: control-ui, web chat, any browser-based ACP spawn

Current Status

Phase A patch has been applied and partially tested. Parent auto-resume now works, but the architecture still couples to heartbeat wake machinery rather than having proper yield-resume semantics.

Full proper fix requires implementing the Phase B architecture with explicit yield-wait state and lifecycle events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions