-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
[Feature]: Script to restore session history archived by new daily-reset mechanism (introduced v2026.2+) #45003
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestimpact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestimpact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
A utility script to automatically restore and re-index session transcript files
that were archived as
.reset.<timestamp>by the new daily session-reset mechanism.Problem to solve
Starting with PR #14949 (Feb 13, 2026) and PR #35493 (Mar 6, 2026), OpenClaw
began archiving old transcript files as
<session>.jsonl.reset.<timestamp>whena session resets — both on manual
/new//resetand on the scheduled dailyreset (default: 4 AM).
Users who upgraded to v2026.3.12 (the first release containing both changes)
found that all their session history had disappeared from the UI sidebar.
This happened because the daily reset ran for the first time after upgrade and
archived all existing sessions at once — not because of a migration script.
The data is not lost; it exists in
.reset.*archive files. But re-indexingdozens of files manually is tedious.
Proposed solution
A script that automates the restoration: it renames
.reset.*archive filesback to
.jsonland rebuilds thesessions.jsonindex.Script: https://github.com/CadanHu/openclaw/blob/feat/session-restore/scripts/restore-sessions.mjs
Alternatives considered
Manual renaming, which is error-prone and time-consuming for users with large
chat histories.
Impact
Additional information
Note: future daily resets will continue to archive sessions. Users should be
aware that
.reset.*files are subject to automatic pruning viasession.maintenance.resetArchiveRetention(defaults topruneAfter).If restoration is needed, it should be done before the retention window expires.
Related issues and root cause analysis
After further investigation, this issue is part of a broader systemic gap rather than an isolated upgrade problem.
The real problem has three layers:
1. Archiving was introduced without access tooling
Sessions are archived to
.reset.<timestamp>files by design (PR #14949, PR #35493), but no UI, agent tool, or API was built to surface these archives. From the user's perspective the history is gone, even though the data still exists on disk.2. The archiving trigger is too aggressive
The current logic (
updatedAt < lastDailyResetAt) archives any session last updated before today's 4 AM reset — which on first upgrade includes all existing sessions regardless of age. Only sessions that were active within the current reset window should be archived on daily reset.3. Archives are time-limited with no recovery path
Archived files are subject to automatic pruning via
session.maintenance.resetArchiveRetention. Users who don't know to act quickly will permanently lose their history with no built-in recovery option.Related open issues:
/new(read-only access)/newor/resetsessions_historysessions_historyshould support reading archived/reset sessionsAll of the above are open as of April 2026, suggesting this is a known but unresolved area. The utility script in this issue addresses the symptom; the root fix requires either (a) correcting the reset freshness evaluation logic, or (b) exposing archived sessions through existing tools and UI.