Skip to content

[Bug]: sessionTarget isolated not creating isolated sessions in 2026.2.21-2 #24101

@ianbaistowdavies-spec

Description

@ianbaistowdavies-spec

Bug Report: sessionTarget "isolated" Not Creating Isolated Sessions

Version

  • OpenClaw: 2026.2.21-2
  • OS: Windows 10.0.26200 (x64)
  • Node: 22.13.1

Summary

Cron jobs with sessionTarget: "isolated" accumulate context across multiple runs instead of creating fresh, isolated sessions each time. This causes massive token bloat and 3-4× higher API costs.

Expected Behavior

From OpenClaw documentation, sessionTarget: "isolated" should:

  • Create a fresh, clean session for each cron execution
  • Not persist state between runs
  • Be garbage collected after completion
  • Keep context minimal and bounded

Actual Behavior

Sessions with sessionTarget: "isolated" instead:

  • Persist the same session file across hundreds of executions
  • Accumulate all previous context as input for each new run
  • Grow unbounded (74k+ tokens observed over 22 hours)
  • Never get garbage collected despite 15m TTL configuration

Evidence

Session Growth Pattern

Session ID: cfc0e26f-852e-4d04-9b01-98c02e2465d9
Created: 2026-02-22 04:00
Cron schedule: Every 5 minutes (288×/day)

Token growth:
- Run 1 (04:00): ~2k tokens (expected)
- Run 287 (02:50): 74,087 tokens input
- Run 288 (02:55): 74,202 tokens input
- Run 289 (03:00): 74,258 tokens input

Session file: 689 KB (should be <10 KB per run)

Cost Impact

Expected (isolated): ~$0.006/run × 288 runs = $1.73/day
Actual (persistent): ~$0.022/run × 288 runs = $6.34/day
Waste: $4.61/day = $1,683/year per cron job

Reproduction Steps

  1. Create a cron job with sessionTarget: "isolated":
{
  "id": "test-isolated",
  "agentId": "main",
  "name": "test-isolated",
  "enabled": true,
  "schedule": {
    "expr": "*/5 * * * *",
    "kind": "cron"
  },
  "sessionTarget": "isolated",
  "wakeMode": "now",
  "payload": {
    "kind": "agentTurn",
    "message": "Respond with OK",
    "model": "google/gemini-2.5-flash"
  }
}
  1. Let it run for several hours
  2. Check session list: openclaw sessions list
  3. Observe single session growing unbounded instead of fresh sessions per run

Configuration

{
  "agents": {
    "defaults": {
      "contextTokens": 32000,
      "contextPruning": {
        "mode": "cache-ttl",
        "ttl": "15m"
      },
      "compaction": {
        "mode": "safeguard"
      }
    }
  }
}

Additional Context

  • Two different cron jobs observed with identical behavior:
    • pairing-watch: 74k/32k tokens (232%)
    • Heartbeat Poll: 39k/32k tokens (122%)
  • Both jobs marked as sessionTarget: "isolated"
  • Sessions show duplicate IDs in session list (same UUID appearing twice)
  • Disabling the cron jobs stops growth but doesn't clear accumulated sessions
  • Session file format: JSONL with all messages appended sequentially

Workaround

Disable automatic isolated cron jobs and use on-demand execution or manual session cleanup.

Impact

  • Severity: High - causes 3-4× cost increase for all isolated cron jobs
  • Scope: All users with recurring cron jobs using isolated sessions
  • Financial: Potentially $1,500+/year waste per affected cron job

Regression

Unknown if this is new in 2026.2.21-2 or existed in prior versions. Update from 2026.2.19-2 → 2026.2.21-2 performed same day issue was discovered.

Session File Sample

{"type":"session","version":3,"id":"cfc0e26f...","timestamp":"2026-02-22T04:00:01.952Z"}
{"type":"message","id":"c8470b6e","message":{"role":"user","content":[{"type":"text","text":"[cron:3db4f6c4...] Check file..."}]}}
{"type":"message","id":"response1","message":{"role":"assistant","usage":{"input":2000,"output":6}}}
...
[287 more message pairs]
...
{"type":"message","id":"a57f80af","message":{"role":"assistant","usage":{"input":74087,"output":6}}}

All messages persisted in single file; each run loads full history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions