openclaw - ✅(Solved) Fix [Bug]: sessionTarget: isolated not honored — cron job messages accumulate in main session [1 pull requests, 1 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#61426Fetched 2026-04-08 02:58:48
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1

Cron jobs configured with sessionTarget: isolated are not running in isolated sessions. Instead, their messages accumulate silently in the main conversation session (conversation_id 6 in lcm.db), causing context overflow and agent crashes.

Error Message

Agent crashed again with identical context limit error

Root Cause

Not critical because:

Fix Action

Fix / Workaround

Agent availability — Icarus crashes completely when context fills. No graceful degradation, no warning, just a hard reset that drops all active context. Data loss risk — Any in-progress task or reasoning at the time of collapse is lost entirely. Recurring — The bug is silent and inevitable. Without manual intervention it will always recur. Current rate is roughly every 10 days. No workaround within OpenClaw — The only fix is manual lcm.db surgery. There's no config option that prevents it. Affects all cron jobs — Not one misconfigured job, all 8 isolated jobs are affected. This means the isolation feature is effectively non-functional.

Workaround Manually clear conversation_id 6 periodically: bashsqlite3 ~/.openclaw/lcm.db "DELETE FROM messages WHERE conversation_id = 6;" Monitor message count as early warning: bashsqlite3 ~/.openclaw/lcm.db "SELECT COUNT(*) FROM messages WHERE conversation_id = 6;" At current accumulation rate (~200 messages/day), context collapse occurs within approximately 10 days of clearing.

PR fix notes

PR #61658: fix: stop implicit isolated cron delivery from mirroring to main

Description (problem / solution / changelog)

Fixes #61426

Summary

  • only queue main-session cron awareness for isolated runs when the delivery target is explicit
  • keep default implicit announce delivery isolated so it does not accumulate mirrored system events in the main session
  • add regression coverage for the implicit channel: last path and preserve explicit-target awareness behavior

Root cause

dispatchCronDelivery() queued a main-session awareness system event after every successful isolated delivery. That included the default implicit announce path, so isolated jobs still wrote mirrored text into the main session over time.

Verification

  • targeted Vitest run for src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts passed using a temporary isolated config wrapper because the repo's shared non-isolated runner is broken in this checkout
  • src/cron/isolated-agent.delivery-awareness.test.ts is included in the patch, but its local run is blocked here by a missing @modelcontextprotocol/sdk/client/index.js dependency from the browser extension import path

Changed files

  • src/cron/isolated-agent.delivery-awareness.test.ts (modified, +31/-0)
  • src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts (modified, +48/-3)
  • src/cron/isolated-agent/delivery-dispatch.ts (modified, +18/-5)

Code Example

First incident — April 2, 2026:

conversation_id 6 accumulated ~2,394 messages from cron jobs
Agent crashed with context limit exceeded
Session was manually cleared via: sqlite3 ~/.openclaw/lcm.db "DELETE FROM messages WHERE conversation_id = 6;"

Second incident — April 5, 2026:

conversation_id 6 accumulated 631 messages in approximately 3 days after being cleared
Agent crashed again with identical context limit error
Session cleared again manually

Affected Jobs
All 8 cron jobs are set to sessionTarget: isolated — none are behaving as isolated:
JobsessionTargetCerberus Gateway WatchdogisolatedIcarus Alive Pingisolatedmemory-save-middayisolatedmemory-save-endofdayisolatedWeekly Security AuditisolatedWeekly Library SyncisolatedCerberusAgent SOUL.md Integrity MonitorisolatedIcarus System Statusisolated
Config
Relevant jobs.json structure (representative example):
json{
  "id": "841d7abf-e756-496c-a1c4-fba17d5715cf",
  "name": "memory-save-endofday",
  "sessionTarget": "isolated",
  "payload": {
    "kind": "agentTurn",
    "model": "moonshot/kimi-k2.5"
  }
}
payload.kind is set to agentTurn on all jobs (confirmed per docs that systemEvent causes jobs to be skipped entirely).
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Cron jobs configured with sessionTarget: isolated are not running in isolated sessions. Instead, their messages accumulate silently in the main conversation session (conversation_id 6 in lcm.db), causing context overflow and agent crashes.

Steps to reproduce

  1. Configure one or more cron jobs with "sessionTarget": "isolated" in ~/.openclaw/cron/jobs.json
  2. Allow cron jobs to run normally over several days
  3. Monitor lcm.db: sqlite3 ~/.openclaw/lcm.db "SELECT COUNT(*) FROM messages WHERE conversation_id = 6;"
  4. Observe message count climbing continuously despite isolated setting

Expected behavior

Each cron job run should create its own isolated session with a fresh context. No messages from cron job runs should appear in the main agent session (conversation_id 6).

Actual behavior

Cron job messages accumulate in conversation_id 6 (the main session). Over time this causes:

Context window fills to capacity Agent (Icarus) crashes with: "Context limit exceeded. I've reset our conversation to start fresh" Agent suggests setting compaction.reserveTokensFloor to 20000 — but this setting is already applied and does not prevent the accumulation

OpenClaw version

2026.4.1 (da64a97)

Operating system

macOS (Mac Mini M4, Apple Silicon)

Install method

LaunchAgent (gui/502/ai.openclaw.gateway) — not a global daemon, runs under the dedicated OpenClaw user account

Model

Primary model: moonshot/kimi-k2.5

Provider / routing chain

Primary model: moonshot/kimi-k2.5 (Moonshot direct API) Fallback: deepseek/deepseek-chat Local: ollama/llama3.2:3b (lightweight tasks only) Credentials: macOS Keychain via object-format SecretRef in models.providers No .env file in use

Additional provider/model setup details

Account type: Dedicated Standard user account (not admin) Gateway: LaunchAgent (gui/502/ai.openclaw.gateway)

Logs, screenshots, and evidence

First incident — April 2, 2026:

conversation_id 6 accumulated ~2,394 messages from cron jobs
Agent crashed with context limit exceeded
Session was manually cleared via: sqlite3 ~/.openclaw/lcm.db "DELETE FROM messages WHERE conversation_id = 6;"

Second incident — April 5, 2026:

conversation_id 6 accumulated 631 messages in approximately 3 days after being cleared
Agent crashed again with identical context limit error
Session cleared again manually

Affected Jobs
All 8 cron jobs are set to sessionTarget: isolated — none are behaving as isolated:
JobsessionTargetCerberus Gateway WatchdogisolatedIcarus Alive Pingisolatedmemory-save-middayisolatedmemory-save-endofdayisolatedWeekly Security AuditisolatedWeekly Library SyncisolatedCerberus — Agent SOUL.md Integrity MonitorisolatedIcarus System Statusisolated
Config
Relevant jobs.json structure (representative example):
json{
  "id": "841d7abf-e756-496c-a1c4-fba17d5715cf",
  "name": "memory-save-endofday",
  "sessionTarget": "isolated",
  "payload": {
    "kind": "agentTurn",
    "model": "moonshot/kimi-k2.5"
  }
}
payload.kind is set to agentTurn on all jobs (confirmed per docs that systemEvent causes jobs to be skipped entirely).

Impact and severity

Severity: High Impact:

Agent availability — Icarus crashes completely when context fills. No graceful degradation, no warning, just a hard reset that drops all active context. Data loss risk — Any in-progress task or reasoning at the time of collapse is lost entirely. Recurring — The bug is silent and inevitable. Without manual intervention it will always recur. Current rate is roughly every 10 days. No workaround within OpenClaw — The only fix is manual lcm.db surgery. There's no config option that prevents it. Affects all cron jobs — Not one misconfigured job, all 8 isolated jobs are affected. This means the isolation feature is effectively non-functional.

Not critical because:

Icarus recovers after the crash No data corruption in the vault or config files The manual clear is simple once you know to do it

Additional information

compaction.reserveTokensFloor is set to 20000 — this does not prevent the accumulation The bug is silent — no warnings are logged when isolated sessions fail to isolate The agent (Icarus) does not detect the accumulation until context limit is hit Lossless Claw compaction plugin is active and wired correctly — does not prevent this issue

Workaround Manually clear conversation_id 6 periodically: bashsqlite3 ~/.openclaw/lcm.db "DELETE FROM messages WHERE conversation_id = 6;" Monitor message count as early warning: bashsqlite3 ~/.openclaw/lcm.db "SELECT COUNT(*) FROM messages WHERE conversation_id = 6;" At current accumulation rate (~200 messages/day), context collapse occurs within approximately 10 days of clearing.

extent analysis

TL;DR

The cron jobs configured with sessionTarget: isolated are not running in isolated sessions, causing messages to accumulate in the main conversation session, which can be mitigated by manually clearing the conversation_id 6 periodically.

Guidance

  • Verify that the sessionTarget configuration is correctly set to "isolated" for all affected cron jobs in ~/.openclaw/cron/jobs.json.
  • Monitor the message count in the main conversation session using sqlite3 ~/.openclaw/lcm.db "SELECT COUNT(*) FROM messages WHERE conversation_id = 6;" to detect potential accumulation.
  • Manually clear the conversation_id 6 periodically using sqlite3 ~/.openclaw/lcm.db "DELETE FROM messages WHERE conversation_id = 6;" to prevent context overflow and agent crashes.
  • Review the OpenClaw configuration and logs to ensure that the Lossless Claw compaction plugin is correctly wired and functioning as expected.

Example

No code snippet is provided as the issue is related to configuration and database management.

Notes

The provided workaround is temporary and may not prevent the issue from recurring. Further investigation is needed to determine the root cause of the sessionTarget: isolated configuration not being respected.

Recommendation

Apply the workaround of manually clearing the conversation_id 6 periodically, as it is the most straightforward way to mitigate the issue until a more permanent fix is found. This recommendation is based on the fact that the workaround is simple to implement and can prevent agent crashes and data loss.

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…

FAQ

Expected behavior

Each cron job run should create its own isolated session with a fresh context. No messages from cron job runs should appear in the main agent session (conversation_id 6).

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 - ✅(Solved) Fix [Bug]: sessionTarget: isolated not honored — cron job messages accumulate in main session [1 pull requests, 1 participants]