You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug]: Daily reset leaves orphaned session transcript files on disk
Environment
OpenClaw version: 2026.3.2
OS: macOS (Darwin 25.3.0, arm64)
Node: v25.6.1
Model: anthropic/claude-opus-4-6
Channels: Telegram (DM + group topics) + Discord
Summary
When the daily session reset (default 4:00 AM local time) triggers, the old session transcript file (.jsonl) is left on disk with no reference in sessions.json. This creates "orphaned" (headless) files that accumulate over time, wasting disk space and making it difficult to distinguish intentional resets from bugs.
By contrast, auto-compaction correctly archives old transcripts by renaming them with a .reset.<timestamp> suffix.
Steps to Reproduce
Configure a gateway with Telegram group topics (default session.reset config — daily at 4:00 AM)
Have an active conversation in a topic before 4:00 AM (e.g., last message at 00:27 JST)
Wait until after 4:00 AM
Send a new message to the same topic
What Happened
sessions.json mapping for the topic key was updated to point to a newsessionId
A new 3KB transcript file was created
The old transcript file (656KB, with full conversation history) was left on disk with no reference — orphaned
Before (13:33 JST):
sessions.json → sessionId: 7c52aa72
disk: 7c52aa72-topic-398.jsonl (656KB) ← active
After sending a message (13:38 JST):
sessions.json → sessionId: 8dfa557a ← new
disk: 7c52aa72-topic-398.jsonl (656KB) ← ORPHANED, no reference
disk: 8dfa557a-topic-398.jsonl (3KB) ← new active
Expected Behavior
Daily reset should archive the old transcript file the same way auto-compaction does:
Prevent disk space leaks from accumulating orphan files
Make it clear when and why a session was reset (traceable via .reset.<timestamp> suffix)
Align behavior with auto-compaction, which already handles archival correctly
Evidence of Accumulation
In a 3-day period with ~14 Telegram topics, 12 orphaned session files accumulated (totaling ~4MB), none of which are referenced by sessions.json. Meanwhile, compaction-archived files are clearly marked:
session.maintenance.mode defaults to warn, so these orphan files are never cleaned up automatically unless the user explicitly runs openclaw sessions cleanup --enforce
The orphan files have no metadata (no .reset. suffix, no timestamp) to indicate they were intentionally archived vs. produced by a bug
Telegram group topics (chatType: "group") and DMs (chatType: "direct") are both affected; Discord channel sessions (chatType: "channel") appear unaffected by the default daily reset
Suggested Fix
In the daily reset code path (likely initSessionState() in src/auto-reply/reply/session.ts), rename the old transcript file with a .reset.<timestamp> suffix before creating the new session, matching the existing compaction archival behavior.
[Bug]: Daily reset leaves orphaned session transcript files on disk
Environment
Summary
When the daily session reset (default 4:00 AM local time) triggers, the old session transcript file (
.jsonl) is left on disk with no reference insessions.json. This creates "orphaned" (headless) files that accumulate over time, wasting disk space and making it difficult to distinguish intentional resets from bugs.By contrast, auto-compaction correctly archives old transcripts by renaming them with a
.reset.<timestamp>suffix.Steps to Reproduce
session.resetconfig — daily at 4:00 AM)What Happened
sessions.jsonmapping for the topic key was updated to point to a newsessionIdBefore (13:33 JST):
After sending a message (13:38 JST):
Expected Behavior
Daily reset should archive the old transcript file the same way auto-compaction does:
This would:
.reset.<timestamp>suffix)Evidence of Accumulation
In a 3-day period with ~14 Telegram topics, 12 orphaned session files accumulated (totaling ~4MB), none of which are referenced by
sessions.json. Meanwhile, compaction-archived files are clearly marked:Additional Context
session.maintenance.modedefaults towarn, so these orphan files are never cleaned up automatically unless the user explicitly runsopenclaw sessions cleanup --enforce.reset.suffix, no timestamp) to indicate they were intentionally archived vs. produced by a bugchatType: "group") and DMs (chatType: "direct") are both affected; Discord channel sessions (chatType: "channel") appear unaffected by the default daily resetSuggested Fix
In the daily reset code path (likely
initSessionState()insrc/auto-reply/reply/session.ts), rename the old transcript file with a.reset.<timestamp>suffix before creating the new session, matching the existing compaction archival behavior.