Skip to content

Subagent announce give-up (retry-limit/expiry) does not wake parent waiting on sessions_yield → permanent deadlock #90178

Description

@HendrikHarren

Description

When a subagent finishes and its completion announce to the parent cannot be delivered, the registry retries a few times and then gives up and discards the run — but the parent session, which is waiting via sessions_yield for the child completion event, is never notified. The parent parks in state=processing indefinitely. Any queued user messages stack behind it (queueDepth>=1) and the agent appears completely hung until a manual gateway restart.

Environment

  • OpenClaw 2026.5.26
  • Self-hosted gateway (K8s), Signal channel, reader subagents (Gemini 3.5 Flash)

Steps to Reproduce

  1. Parent (main) agent calls sessions_spawn for two reader subagents in quick succession, then sessions_yield to await both completion events.
  2. Child B finishes while the parent is still briefly busy (e.g. spawning child A / mid model_call), so B's announce is deferred.
  3. Announce retries maxAnnounceRetryCount (3) over ~7s (MIN_ANNOUNCE_RETRY_DELAY_MS=1sMAX_ANNOUNCE_RETRY_DELAY_MS=8s), still can't deliver, then gives up with reason="retry-limit".
  4. The run is discarded. The parent is still yielded, waiting for B's event.

Expected Behavior

On announce give-up (retry-limit OR expiry), inject a synthetic failure/completion event to the parent (requesterSessionKey) so its sessions_yield wakes up and the turn can finish (e.g. report the child as failed/undelivered).

Actual Behavior

Parent waits forever. [diagnostic] long-running session … recovery=none. ANNOUNCE_COMPLETION_HARD_EXPIRY_MS=30min also does not wake the parent.

Code Pointers

  • src/agents/subagent-registry-cleanup.ts — give-up decision (retryCount >= maxAnnounceRetryCount), no parent-notify.
  • src/agents/subagent-registry-helpers.tsMIN/MAX_ANNOUNCE_RETRY_DELAY_MS, ANNOUNCE_EXPIRY_MS=5min, ANNOUNCE_COMPLETION_HARD_EXPIRY_MS=30min, logAnnounceGiveUp() (logs only).
  • Searched for synthetic-completion / notify-parent on give-up: none found.

Severity

High — any lost subagent announce permanently deadlocks the parent session; no built-in recovery.

Proposed Fix

  1. On give-up, deliver a synthetic completion/failure event to requesterSessionKey so the parent unblocks.
  2. Make maxAnnounceRetryCount, retry delays, and expiry configurable (current values are hardcoded constants; 3 retries over ~7s is too tight when the parent is momentarily busy).

Additional Context

Hit in production 2026-06-04: both an interactive Signal session and the 02:00 scheduled briefing deadlocked from this. Downstream mitigations tracked in harren-com/openclaw-deploy#350 (avoid interactive fan-out), #351 (external hang-watchdog auto-restart), #352 (briefing delivery check) — all are workarounds for this root cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.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

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions