Skip to content

[Bug]: openclaw doctor fails on large session store with stale sessions.json.*.tmp accumulation #56827

Description

@jean-de-bot

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

openclaw doctor fails on one long-lived installation where ~/.openclaw/agents/main/sessions contains a 154 MB sessions.json and 67 stale sessions.json.*.tmp files totaling about 787 MB.

Steps to reproduce

  1. Use an installation where ~/.openclaw/agents/main/sessions has grown to approximately 1.2 GB total, including a large monolithic sessions.json and many sessions.json.*.tmp files.
  2. Run openclaw doctor.
  3. Observe that doctor fails with a V8 deserialization stack trace ending near ValueDeserializer::ReadObjectWrapper() / ValueDeserializer::ReadValue(...).

Expected behavior

openclaw doctor should complete successfully on long-lived installations with large session history and should not be destabilized by stale sessions.json.*.tmp files.

Actual behavior

openclaw doctor failed, and the observed stack trace ended near:

ValueDeserializer::ReadObjectWrapper()
ValueDeserializer::ReadValue(...)

On the affected installation, the sessions directory measured approximately:

  • total size: ~1.2 GB
  • sessions.json: 154,466,795 bytes
  • sessions.json.*.tmp: 786,956,288 bytes across 67 files
  • *.jsonl: 200,251,621 bytes across 2154 files
  • *.reset.*: 75,188,435 bytes across 48 files

OpenClaw version

2026.3.28

Operating system

Linux arm64

Install method

npm global

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw -> openai-codex/gpt-5.4

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

Observed failure tail:
ValueDeserializer::ReadObjectWrapper()
ValueDeserializer::ReadValue(...)

Measured session-store facts on the affected installation:
- entries in sessions.json: 2378
- top-level key distribution:
  - openresponses: 1236
  - openai: 675
  - discord: 202
  - cron: 194
  - subagent: 47

Largest files in ~/.openclaw/agents/main/sessions included:
- sessions.json — 154 MB
- multiple sessions.json.<uuid>.tmp files in the 40–79 MB range
- largest .jsonl files were roughly 10–12 MB

Impact and severity

Affected: at least one long-lived high-activity installation with a large session store
Severity: high (diagnostic command failure)
Frequency: observed on the affected installation when running openclaw doctor
Consequence: health/diagnostic workflow fails, and the session store can consume significant extra disk space due to stale temp files

Additional information

This appears to have two grounded aspects:

  • openclaw doctor failure on a large session store
  • substantial accumulation of stale sessions.json.*.tmp files

Suggested long-term direction: replace the monolithic sessions.json catalog with a SQLite-backed session metadata store while keeping per-session transcripts as append-only JSONL files. That would allow indexed/incremental reads, safer updates, and lower memory pressure for doctor/status/session inspection paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions