openclaw - 💡(How to fix) Fix Bug: isolatedSession: true does not isolate heartbeat conversation — context accumulates across runs [1 comments, 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#70172Fetched 2026-04-23 07:28:18
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1

When isolatedSession: true is set on agents.defaults.heartbeat, the documentation states each heartbeat run should use a "fresh session with no prior conversation history" and reduce token cost from ~100K to ~2-5K per run.

In practice, the heartbeat session (sessionKey agent:main:main:heartbeat) maps to the same LCM conversation (conversation=3) as the main session. Each heartbeat run's input/output is appended to the shared conversation history, causing unbounded context growth.

Error Message

  • Heartbeat configured with isolatedSession: true, lightContext: true, every: "30m"
  • LCM conversation context grows across runs instead of resetting:
    • 09:22 → 171 items / ~101K tokens
    • 19:52 → 252 items / ~115K tokens
    • 20:02 → 539 items / ~130K tokens (duplicate session started here)
    • 22:32 → 1,431 items / ~174K tokens
    • Post-reset → grew again to 2,867 items / ~83K tokens
  • LCM logs show sessionKey=agent:main:main:heartbeat resolving to conversation=3
  • A timeout occurred when the accumulated context reached ~83K tokens (via OpenRouter free tier)

Root Cause

When isolatedSession: true is set on agents.defaults.heartbeat, the documentation states each heartbeat run should use a "fresh session with no prior conversation history" and reduce token cost from ~100K to ~2-5K per run.

In practice, the heartbeat session (sessionKey agent:main:main:heartbeat) maps to the same LCM conversation (conversation=3) as the main session. Each heartbeat run's input/output is appended to the shared conversation history, causing unbounded context growth.

Code Example

{
     "agents": {
       "defaults": {
         "heartbeat": {
           "every": "30m",
           "isolatedSession": true,
           "lightContext": true,
           "target": "none"
         }
       }
     }
   }
RAW_BUFFERClick to expand / collapse

Description

When isolatedSession: true is set on agents.defaults.heartbeat, the documentation states each heartbeat run should use a "fresh session with no prior conversation history" and reduce token cost from ~100K to ~2-5K per run.

In practice, the heartbeat session (sessionKey agent:main:main:heartbeat) maps to the same LCM conversation (conversation=3) as the main session. Each heartbeat run's input/output is appended to the shared conversation history, causing unbounded context growth.

Observed behavior

  • Heartbeat configured with isolatedSession: true, lightContext: true, every: "30m"
  • LCM conversation context grows across runs instead of resetting:
    • 09:22 → 171 items / ~101K tokens
    • 19:52 → 252 items / ~115K tokens
    • 20:02 → 539 items / ~130K tokens (duplicate session started here)
    • 22:32 → 1,431 items / ~174K tokens
    • Post-reset → grew again to 2,867 items / ~83K tokens
  • LCM logs show sessionKey=agent:main:main:heartbeat resolving to conversation=3
  • A timeout occurred when the accumulated context reached ~83K tokens (via OpenRouter free tier)

Expected behavior

Per the docs:

isolatedSession: when true, each heartbeat runs in a fresh session with no prior conversation history. Uses the same isolation pattern as cron sessionTarget: "isolated". Dramatically reduces per-heartbeat token cost.

Each heartbeat run should start with a clean context, not accumulate history from prior runs.

Steps to reproduce

  1. Configure heartbeat:
    {
      "agents": {
        "defaults": {
          "heartbeat": {
            "every": "30m",
            "isolatedSession": true,
            "lightContext": true,
            "target": "none"
          }
        }
      }
    }
  2. Let heartbeat run for several hours
  3. Check LCM logs for conversation=N and contextItems= in the assemble: done entries for the heartbeat session
  4. Observe that context items grow across runs instead of remaining small/flat

Environment

  • OpenClaw version: v2026.4.9
  • OS: Ubuntu 24.04.4 bare-metal
  • Heartbeat model: MiMo flash (OpenRouter), later switched to Nemotron free
  • Lossless-claw plugin active

Additional context

  • There were also duplicate heartbeat sessions (two runs within 0-2 minutes of each other), possibly triggered by config reloads restarting the heartbeat timer without cancelling the old one. This compounded the accumulation rate but is a separate issue.
  • The #admins Discord channel heartbeat conversation stayed small (12 items), suggesting the issue may be specific to how the main session conversation is shared.

extent analysis

TL;DR

The isolatedSession: true configuration for heartbeat may not be functioning as expected, causing conversation history to accumulate across runs instead of being reset.

Guidance

  • Verify that the isolatedSession feature is correctly implemented and functioning as described in the documentation for the specific OpenClaw version (v2026.4.9) being used.
  • Check the LCM logs to confirm that each heartbeat run is indeed using the same conversation ID (conversation=3) and that the context items are being appended instead of reset.
  • Investigate the possibility of a bug or misconfiguration in the isolatedSession feature, particularly in how it interacts with the main session conversation.
  • Consider testing the isolatedSession feature with a different heartbeat configuration or model to see if the issue is specific to the current setup.

Example

No code snippet is provided as the issue seems to be related to the configuration and functionality of the isolatedSession feature rather than a specific code implementation.

Notes

The issue may be specific to the main session conversation, as suggested by the fact that the #admins Discord channel heartbeat conversation remained small. Additionally, the presence of duplicate heartbeat sessions may be compounding the issue, but it is considered a separate problem.

Recommendation

Apply a workaround by closely monitoring the conversation history growth and manually resetting the context as needed, until the root cause of the isolatedSession feature malfunction can be identified and addressed.

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

Per the docs:

isolatedSession: when true, each heartbeat runs in a fresh session with no prior conversation history. Uses the same isolation pattern as cron sessionTarget: "isolated". Dramatically reduces per-heartbeat token cost.

Each heartbeat run should start with a clean context, not accumulate history from prior runs.

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: isolatedSession: true does not isolate heartbeat conversation — context accumulates across runs [1 comments, 1 participants]