Skip to content

[Bug]: crontab/skill parent hangs after subagent yield_session — completion announce dropped when parent is inactive #80310

Description

@cychen2021

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

When a crontab or skill parent invokes a subagent and then yields (sessions_yield), the subagent's completion announce is never delivered to the parent because maybeQueueSubagentAnnounce short-circuits on isActive === false. The parent session stays idle forever and the scheduled work never proceeds.

Steps to reproduce

  1. Configure a crontab entry (or a skill) whose agent spawns a subagent and then calls sessions_yield to wait for the subagent to finish.
  2. Let the subagent finish normally.
  3. Observe that the parent never resumes; no completion announce is delivered.

Expected behavior

Parent receives the subagent completion announce (as introduced by fix: yield while waiting for subagent completions, commit 42514156e0, and fix(subagent-announce): defer drain while parent session is busy, commit 1841dd9977, PR #71706) and the crontab/skill turn proceeds.

Actual behavior

The guard in src/agents/subagent-announce-delivery.ts at around line 524 is:

if (
  isActive &&
  (shouldFollowup || queueSettings.mode === \"steer\" || queueSettings.mode === \"queue\")
) {
  ...
  shouldDefer: (item) => resolveRequesterSessionActivity(item.sessionKey).isActive,
}

After sessions_yield, the parent's embedded Pi run exits with stopReason: \"end_turn\" and is removed from ACTIVE_EMBEDDED_RUNS (see src/agents/pi-embedded-runner/runs.ts). At that point isActive is false, so the completion announce never enters enqueueAnnounce and the shouldDefer hook below never gets a chance to hold the item until the parent becomes idle. The function returns \"none\" and the parent is never resumed.

OpenClaw version

v2026.5.7 (also verified on v2026.5.5 and v2026.5.10-beta.1)

Operating system

Linux

Install method

npm global

Model

Claude Sonnet 4.6 on Amazon Bedrock

Provider / routing chain

openclaw -> amazon-bedrock

Logs, screenshots, and evidence

Relevant lines on origin/main HEAD 6d31a42851 (2026-05-10):

src/agents/subagent-announce-delivery.ts:497   const { sessionId, isActive } = resolveRequesterSessionActivity(canonicalKey);
src/agents/subagent-announce-delivery.ts:524   if (
src/agents/subagent-announce-delivery.ts:525     isActive &&
src/agents/subagent-announce-delivery.ts:526     (shouldFollowup || queueSettings.mode === \"steer\" || queueSettings.mode === \"queue\")
src/agents/subagent-announce-delivery.ts:527   ) {
src/agents/subagent-announce-delivery.ts:545       shouldDefer: (item) => resolveRequesterSessionActivity(item.sessionKey).isActive,

Git history:

  • 42514156e0 fix: yield while waiting for subagent completions — landed the yield flow.
  • 1841dd9977 fix(subagent-announce): defer drain while parent session is busy (#71706) — introduced shouldDefer, but did not remove the isActive gate for completion announces, so a yielded (inactive) parent still never enters the queue.
  • f9eb7d993c fix(agents): queue subagent completion announces (2026-05-03) — added a forceCompletionQueue parameter that bypassed the isActive gate when expectsCompletionMessage was set. This commit was present on origin/main on 2026-05-06 but is no longer reachable from origin/main as of 2026-05-10 (6d31a42851). No revert commit is present; the branch appears to have been force-rewritten.
  • Releases checked (all still have the isActive gate, none contain f9eb7d993c): v2026.5.5, v2026.5.7, v2026.5.9-beta.1, v2026.5.10-beta.1.
  • Post-drop related commits that do not fix this path: e74347bbe7 fix(agents): retry overloaded subagent announces, 335e5456d0 fix(agent): respect delivery status evidence, 1ed50b0ced fix: expose active-run queue failure reasons, 92284bc460 fix(agents): clean subagent fallback scaffolding (#78700).

Impact and severity

  • Affected: any crontab or skill-invoked agent that uses sessions_yield while waiting on a subagent.
  • Severity: High (blocks crontab/skill workflows end-to-end).
  • Frequency: Reproduces reliably; the gate is deterministic and unconditional.
  • Consequence: Scheduled/automated work silently stalls, requiring manual intervention to unstick.

Additional information

Last known good state: f9eb7d993c on origin/main on 2026-05-06 (never tagged into a release). First known bad release: v2026.5.5 (first release combining sessions_yield with the current completion-announce queueing code), still bad through v2026.5.10-beta.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions