Skip to content

[Bug]: Cron isolated sessions still break with sessions_spawn — "do not poll" note causes premature turn completion (2026.2.25) #27308

@Lukavyi

Description

@Lukavyi

Summary

Cron jobs that use sessions_spawn inside isolated sessions still fail on 2026.2.25 (commit c5d040bbe). The agent spawns subagents, sees the SUBAGENT_SPAWN_ACCEPTED_NOTE ("do not poll/sleep"), immediately responds with text like "Waiting for sub-agents...", and the cron run ends. Subagent results are never collected.

This was reported as part of #26867 (Bug 1) and allegedly fixed via commit 4258a3307 — but that fix only addressed the announce delivery pipeline (Bug 2). The root cause for cron + sessions_spawn (the "do not poll" note causing premature turn completion) was not addressed.

Related

Root Cause

SUBAGENT_SPAWN_ACCEPTED_NOTE in src/agents/subagent-spawn.ts:

export const SUBAGENT_SPAWN_ACCEPTED_NOTE =
  "auto-announces on completion, do not poll/sleep. The response will be sent back as an user message.";

In a regular session, this is correct — the agent should not poll because announce will deliver the result back.

In a cron isolated session, agent turn = entire run. When the model sees "do not poll", it immediately produces a text response ("Waiting for sub-agents...") → turn ends → cron finalizes with that text as summary → subagents finish later but cron session is dead.

This note was introduced in the refactor from sessions-spawn-tool.ts to subagent-spawn.ts. Before this change (v2026.2.6-3), the tool result had no note, and the agent would poll/wait for subagent results, keeping the turn alive.

No changes were made to src/cron/isolated-agent/run.ts between v2026.2.23 and v2026.2.25 to address this.

Evidence

Manual run triggered 26 Feb ~08:09 CET on commit c5d040bbe — 84 commits after the #26867 fix (4258a3307):

Date             Duration  Commit      Summary
─────────────────────────────────────────────────
26 Feb 08:09      55s      c5d040bbe   "Dev feeds are mostly Medium
(manual run)                            clickbait... [Waiting for
                                        sub-agent completions...]"

delivered: true — the message was actually delivered to the Telegram topic (confirming Bug 2 / announce delivery IS fixed). But the summary is just the "waiting" text, not the actual news digest.

The same cron job worked correctly on v2026.2.6-3 (before SUBAGENT_SPAWN_ACCEPTED_NOTE was introduced), running 85-280 seconds and producing full digests with 30+ news items.

Steps to Reproduce

openclaw cron add \
  --name "test-spawn-in-cron" \
  --schedule "once:2m" \
  --deleteAfterRun \
  --sessionTarget isolated \
  --payload '{"kind":"agentTurn","message":"Use sessions_spawn to create 2 subagents: one to search web for AI news, another for Ukraine news. Collect their results and compile a summary.","timeoutSeconds":600}' \
  --delivery '{"mode":"announce","channel":"telegram","to":"<your_chat_id>"}'

Expected: Agent spawns subagents, waits for results, compiles summary, cron delivers full output.
Actual: Agent spawns subagents, immediately responds "waiting for sub-agents", cron delivers that incomplete text.

Suggested Fixes

  1. Suppress SUBAGENT_SPAWN_ACCEPTED_NOTE for cron isolated sessions — let the agent poll naturally
  2. Cron runner waits for pending subagent runs before finalizing the turn
  3. Block sessions_spawn in cron isolated sessions and return an error suggesting synchronous execution

Environment

cc @tyler6204 @steipete @Takhoffman

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions