fix(tasks): wake parent on blocked subagent delivery#95080
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 20, 2026, 9:29 PM ET / 01:29 UTC. Summary PR surface: Source +20, Tests +136. Total +156 across 4 files. Reproducibility: yes. at source level: current main records failed subagent announce delivery and a blocked required completion, but suppresses non-cancelled subagent terminal fallback before requester wake delivery. I did not run the live Signal/K8s timing scenario. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the constrained failed-delivery wake path after exact-head checks if maintainers accept the runtime-level proof, while keeping retry and expiry configurability as separate canonical-issue work. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main records failed subagent announce delivery and a blocked required completion, but suppresses non-cancelled subagent terminal fallback before requester wake delivery. I did not run the live Signal/K8s timing scenario. Is this the best way to solve the issue? Yes for the narrow bug-fix slice: the PR reuses the existing terminal delivery path and gates the new behavior to the required-completion delivery-failure contract. Broader retry/expiry configurability or a formal yielded-parent lifecycle contract should stay separate. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e012f2cd3cc8. Label changesLabel justifications:
Evidence reviewedPR surface: Source +20, Tests +136. Total +156 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
bd85be5 to
30ce8fa
Compare
|
@clawsweeper re-review Updated head: a849bfd Author-side fix:
Fresh local verification:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
failed, then the same run becomesterminalOutcome: blockedwith the required-completion delivery-failure summary.Reviewers should focus on the
subagentblocked completion delivery policy and thefailed -> pending -> session_queuedtransition in the task registry.Linked context
Addresses the parent wake-up bug in #90178.
Related: #91650, #87330.
Requested by maintainer workflow through issue #90178.
Real behavior proof (required for external PRs)
sessions_yield.OPENCLAW_STATE_DIR.OPENCLAW_STATE_DIR=$(mktemp -d) node --import tsx --eval '<create subagent task; mark delivery failed; mark terminalOutcome blocked; print final task/events/heartbeat>'{ "deliveryStatus": "session_queued", "terminalOutcome": "blocked", "eventCount": 2, "events": [ "Background task blocked: Subagent task (run run-suba). Required completion delivery failed before reaching the requester: retry-limit.", "Task needs follow-up: Subagent task (run run-suba). Required completion delivery failed before reaching the requester: retry-limit." ], "heartbeatWake": true }shouldAutoDeliverTaskTerminalUpdate()return false for non-cancelled subagent tasks, so the blocked task update created by the give-up path was not auto-delivered to the requester session.Tests and validation
pnpm install --frozen-lockfilenode scripts/run-vitest.mjs src/agents/subagent-registry-cleanup.test.ts src/agents/subagent-registry-lifecycle.test.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.tsnode scripts/run-vitest.mjs src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.tspnpm -s exec oxfmt --check src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.ts src/tasks/task-registry.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode branch --base upstream/mainRegression coverage added:
src/tasks/task-executor-policy.test.ts: blocked subagent completions are eligible for terminal delivery only when they carry the explicit delivery-failure summary and recorded error; normal subagent success and ordinary blocked completions remain suppressed.src/tasks/task-registry.test.ts: real failed-delivery then blocked-terminal sequence queues parent events, triggers heartbeat, and stays idempotent on replay.src/tasks/task-registry.test.ts: ordinary progress-only blocked subagent completion stays pending with no task event, no heartbeat wake, and no direct channel send.Risk checklist
Did user-visible behavior change? (
Yes/No)Yes. A previously silent subagent completion give-up now surfaces as a blocked background task event in the parent session.
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No.
What is the highest-risk area?
Duplicate or misrouted completion delivery.
How is that risk mitigated?
The policy still suppresses ordinary non-cancelled subagent terminal updates. The recovery path requires
subagent + succeeded + terminalOutcome: blockedplus the required-completion delivery-failure summary and recorded error. The registry only requeues fromdeliveryStatus: failed, and tests cover replay idempotency plus the ordinary blocked-completion sibling path.Current review state
What is the next action?
ClawSweeper re-review on head
30ce8faa80.What is still waiting on author, maintainer, CI, or external proof?
Nothing known from the author side beyond normal CI/ClawSweeper re-review. Maintainers may still decide separately whether #90178 should add retry/expiry configurability.
Which bot or reviewer comments were addressed?
Addressed ClawSweeper's finding to constrain blocked subagent task delivery to the announce give-up recovery path, and added sibling regression coverage for ordinary blocked required completions.