Skip to content

Dreaming sessions pollute UI agent switcher — sessions.json not cleaned up after dream runs #70402

Description

@antaoaee

Description

The Memory Dreaming Promotion cron job (runs daily at 03:00) creates 5-7 dreaming-narrative-{light,rem,deep}-xxx sessions under the main agent. These sessions appear in the Control UI agent switcher dropdown, cluttering the interface with "梦境叙事" (dream narrative) entries.

Steps to Reproduce

  1. Enable Dreaming (default setting)
  2. Wait for the daily cron trigger (or run manually)
  3. Open Control UI → click agent switcher (top-left)
  4. Observe 5-7 dreaming-narrative-xxx entries mixed with real agents

Root Cause

After dreaming completes, the .jsonl session files remain in agents/<agent>/sessions/, and the sessions.json registry retains dreaming session entries. The UI reads from sessions.json, so even deleting .jsonl files alone does not fix the display.

Expected Behavior

Dreaming sessions should either:

  1. Be automatically cleaned from sessions.json after completion
  2. Be filtered out from the UI agent switcher (e.g., using a hidden session kind)
  3. Use a separate session namespace that the UI ignores

Current Workaround

Manual cleanup after each dream run:

# Step 1: Delete dreaming .jsonl files
for f in agents/main/sessions/*.jsonl; do
  grep -q "Write a dream" "$f" 2>/dev/null && rm "$f"
done

# Step 2 (critical): Remove dreaming entries from sessions.json registry
python3 -c "
import json
path = 'agents/main/sessions/sessions.json'
with open(path) as f:
    data = json.load(f)
for k in [k for k in data if 'dreaming' in k]:
    del data[k]
with open(path, 'w') as f:
    json.dump(data, f, indent=2)
"

# Step 3: Restart Gateway
openclaw gateway restart

Without Step 2, the UI continues to show dreaming sessions even after files are deleted.

Environment

  • OpenClaw version: 2026.4.21
  • OS: macOS Sequoia (ARM64)
  • Node: v22.22.0
  • Dreaming: enabled (default)
  • Cron job: Memory Dreaming Promotion (0 3 * * *)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions