openclaw - 💡(How to fix) Fix [Bug] Cron job reports status 'ok' immediately after sessions_yield, before subagent completes [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73813Fetched 2026-04-29 06:14:44
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1

When a cron job with sessionTarget: isolated calls sessions_yield after spawning a subagent, the cron infrastructure immediately marks the job as status: "ok" and records a short durationMs (~25 seconds), even though the subagent continues running for several minutes and the parent session later resumes to process the result.

This is a monitoring/observability bug — the work completes successfully, but the cron job's recorded status and duration are misleading.

Root Cause

When a cron job with sessionTarget: isolated calls sessions_yield after spawning a subagent, the cron infrastructure immediately marks the job as status: "ok" and records a short durationMs (~25 seconds), even though the subagent continues running for several minutes and the parent session later resumes to process the result.

This is a monitoring/observability bug — the work completes successfully, but the cron job's recorded status and duration are misleading.

Fix Action

Workaround

None known. The work completes successfully, but cron monitoring is misleading.

Code Example

{
  "action": "finished",
  "status": "ok",
  "durationMs": 25182,
  "runAtMs": 1777410618539
}
RAW_BUFFERClick to expand / collapse

Summary

When a cron job with sessionTarget: isolated calls sessions_yield after spawning a subagent, the cron infrastructure immediately marks the job as status: "ok" and records a short durationMs (~25 seconds), even though the subagent continues running for several minutes and the parent session later resumes to process the result.

This is a monitoring/observability bug — the work completes successfully, but the cron job's recorded status and duration are misleading.

Version

OpenClaw 2026.4.28 (latest)

Steps to Reproduce

  1. Create a cron job with sessionTarget: "isolated" and payload.kind: "agentTurn"
  2. In the agent turn: a. Write a timestamp to a file b. Spawn a subagent with a task that sleeps for 180 seconds: sleep 180 && echo "done" >> file.txt c. Call sessions_yield to yield to the subagent
  3. Observe the cron run log

Expected Behavior

The cron job should remain in a "running" state until the subagent completes and the parent session finishes processing, OR the durationMs should reflect the actual total time including subagent execution.

Actual Behavior

From the cron run log (~/.openclaw/cron/runs/<job-id>.jsonl):

{
  "action": "finished",
  "status": "ok",
  "durationMs": 25182,
  "runAtMs": 1777410618539
}

But the subagent ran for 3+ minutes (180 seconds sleep + overhead). The parent session transcript shows:

  • Parent yields at 21:10:43
  • Subagent completion event arrives at 21:13:54 (3m11s later)
  • Parent resumes and reads file at 21:13:58

The cron infrastructure recorded the job as "finished" at ~21:10:43 (25s after start), but the actual work didn't complete until ~21:14:01.

Impact

  • False positives in monitoring: Cron jobs appear to succeed quickly when they're actually still running
  • Incorrect duration metrics: Makes it impossible to track actual job execution time
  • Confusing debugging: The cron run log says "ok" but the subagent may still be running or may fail later

Related Issues

  • #46298 (closed) — sessions_yield terminates isolated cron sessions — this was about the session actually dying; our session survives and completes
  • #49572 (closed) — sessions_yield only survives one LLM turn — this was about aborting after one turn; our session continues for multiple turns

This appears to be a new variant where the cron infrastructure prematurely marks the job as finished while the underlying session continues.

Workaround

None known. The work completes successfully, but cron monitoring is misleading.

extent analysis

TL;DR

The cron job is being marked as finished prematurely due to a monitoring bug, and a potential fix could involve modifying the cron infrastructure to wait for the subagent to complete before marking the job as finished.

Guidance

  • Investigate the cron infrastructure's logic for determining when a job is finished, specifically when sessionTarget: "isolated" and sessions_yield are used.
  • Consider adding a mechanism to track the status of subagents spawned by the cron job and wait for their completion before marking the job as finished.
  • Review the related issues (#46298 and #49572) to ensure that the fix does not reintroduce previously resolved problems.
  • Test any potential fixes with the provided steps to reproduce to ensure that the cron job's status and duration are accurately recorded.

Example

No code snippet is provided as the issue is related to the cron infrastructure's logic and not a specific code snippet.

Notes

The provided information suggests that this is a new variant of a previously reported issue, and the fix may require modifications to the cron infrastructure. The workaround is currently unknown, and the issue may require further investigation to resolve.

Recommendation

Apply a workaround by modifying the cron infrastructure to wait for the subagent to complete before marking the job as finished, as this is the most likely solution to accurately record the cron job's status and duration.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug] Cron job reports status 'ok' immediately after sessions_yield, before subagent completes [1 comments, 2 participants]