-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Subagent announce give-up (retry-limit/expiry) does not wake parent waiting on sessions_yield → permanent deadlock #90178
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper 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 does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, 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.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper 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 does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, 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.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
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_yieldfor the child completion event, is never notified. The parent parks instate=processingindefinitely. Any queued user messages stack behind it (queueDepth>=1) and the agent appears completely hung until a manual gateway restart.Environment
Steps to Reproduce
sessions_spawnfor two reader subagents in quick succession, thensessions_yieldto await both completion events.maxAnnounceRetryCount(3) over ~7s (MIN_ANNOUNCE_RETRY_DELAY_MS=1s…MAX_ANNOUNCE_RETRY_DELAY_MS=8s), still can't deliver, then gives up withreason="retry-limit".Expected Behavior
On announce give-up (retry-limit OR expiry), inject a synthetic failure/completion event to the parent (
requesterSessionKey) so itssessions_yieldwakes 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=30minalso 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.ts—MIN/MAX_ANNOUNCE_RETRY_DELAY_MS,ANNOUNCE_EXPIRY_MS=5min,ANNOUNCE_COMPLETION_HARD_EXPIRY_MS=30min,logAnnounceGiveUp()(logs only).Severity
High — any lost subagent announce permanently deadlocks the parent session; no built-in recovery.
Proposed Fix
requesterSessionKeyso the parent unblocks.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.