Skip to content

sessions_yield terminates isolated cron sessions instead of waiting for next turn #46298

Description

@lnxg33k

Bug type

Regression (worked before, now fails)

Summary

sessions_yield (introduced in v2026.3.12 via PR #36537) immediately terminates isolated cron sessions instead of pausing and waiting for a follow-up event (like a sub-agent completion). The description says it should "end the current turn and carry a follow-up payload into the next session turn", but in isolated cron sessions there is no next turn, so the session just dies.

Steps to reproduce

  1. Create a cron job with sessionTarget: "isolated" and payload.kind: "agentTurn"
  2. In the agent turn, spawn a sub-agent via sessions_spawn (mode: "run")
  3. Call sessions_yield to wait for the sub-agent completion event
  4. The isolated session terminates immediately (~30 seconds total runtime)
  5. The sub-agent runs and completes, but the orchestrator session is already dead
  6. Steps after the sub-agent (drafting, posting, notifications) never execute

Expected behavior

sessions_yield should keep the isolated cron session alive and waiting for the sub-agent completion event to arrive, then resume execution. Or at minimum, it should be documented that sessions_yield is incompatible with isolated sessions.

Actual behavior

The session terminates immediately after sessions_yield is called. The cron scheduler reports lastStatus: "ok" with very short durations (28-36 seconds) even though the full pipeline should take 3-5 minutes.

OpenClaw version

2026.3.13 (also reproduced on 2026.3.11 which bundles 3.12 changes)

Operating system

Linux (Debian 13)

Install method

No response

Model

anthropic/claude-sonnet-4-6 (subagent), anthropic/claude-opus-4-6 (orchestrator)

Provider / routing chain

openclaw -> anthropic direct

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: Any isolated cron session using sessions_yield with sub-agent orchestration
Severity: High - blocks multi-step pipeline workflows entirely
Frequency: 100% repro - always terminates immediately
Consequence: Multi-step orchestrator pipelines (spawn -> draft -> post -> notify) fail silently. Cron reports lastStatus: "ok" masking the failure. Sub-agents run but their results are never processed.

Additional information

Workaround:
After spawning a sub-agent, simply end the response without calling any tool. The sub-agent completion event arrives as the next message naturally. Do not call sessions_yield in isolated cron sessions.

Additional context:
This affects any orchestrator pattern where an isolated cron session spawns sub-agents and needs to continue processing after they complete. The multi-step pipeline pattern (spawn discovery -> draft -> post -> notify) breaks entirely because the orchestrator dies at the first yield.

Previously working on v2026.2.17 (before sessions_yield existed, agent used natural turn waiting).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions