Files
Peter Steinberger c2495c5420 fix(reset): remove canonical SQLite session history (#159419)
* fix(reset): remove canonical SQLite session history

Route standalone and onboarding reset through session lifecycle teardown, including retained transcripts and owned archives, while preserving auth profiles and unrelated agent state. Preview the selected history and archive files without writable database admission.

* fix(reset): adapt canonical session reset to current session store

Run canonical session cleanup inside the acquired offline-maintenance scope. Main commit 8b16e5328e added shared-state admission checks; holding the lock without entering its scope made repository discovery reject reset as competing maintenance.

Keep canonical deletion, in-flight refusal, pre-commit revalidation, unrelated-state preservation, and archive identity verification unchanged.

Validation: Blacksmith Testbox tbx_01m3jgya0sqmzr6rj90n3n9tyz passed all 157 tests across reset.sessions, reset, cleanup-utils, onboard-helpers, uninstall, and SQLite deletion, cleanup-reclamation, and archive-read suites. node scripts/check-changed.mjs and git diff --check passed remotely. Existing tests are unchanged.
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-09-27 17:36:43 -07:00

3.8 KiB

summary, read_when, title
summary read_when title
CLI reference for `openclaw reset` (reset local state/config)
You want to wipe local state while keeping the CLI installed
You want a dry-run of what would be removed
Reset

openclaw reset

Reset local config/state (keeps the CLI installed).

openclaw reset
openclaw reset --dry-run
openclaw reset --scope config --yes --non-interactive
openclaw reset --scope config+creds+sessions --yes --non-interactive
openclaw reset --scope full --yes --non-interactive

Options

  • --scope <scope>: config, config+creds+sessions, or full
  • --yes: skip confirmation prompts
  • --non-interactive: disable prompts. Requires --scope and --yes.
  • --dry-run: print actions without removing files

Scopes

Scope Removes Stops gateway first
config config file only no
config+creds+sessions config file, OAuth/credentials dir, canonical SQLite session history and its archive files yes
full state dir (including the shared SQLite database) plus workspace directories yes

config+creds+sessions and full stop a running managed gateway service before deleting state.

The sessions scope removes current and archived sessions, retained transcript generations, cold history, and session-owned artifacts from configured and discovered agent stores, including agents no longer in config. It keeps the per-agent database files because they also contain auth profiles, memory, and other agent state. Workspace files and auth profiles survive. There is no standalone --scope sessions option.

--dry-run lists the databases, session keys, transcript/archive counts, and owned archive files selected for removal without writing SQLite state. Legacy JSON/JSONL imports remain owned by Doctor; reset does not recursively delete session directories.

Notes

  • Run openclaw backup create first for a restorable snapshot before removing local state.
  • Both scopes that remove sessions require exclusive state ownership. If an unmanaged or externally supervised Gateway is still running, reset refuses and asks you to stop it first.
  • Workspace setup state and attestations are rows in the shared SQLite database. full removes them with the state directory. There are no current attestation sidecar files to remove separately.
  • If archive-file removal fails after session rows are deleted, reset reports the exact remaining files for manual cleanup. It never deletes unrelated files merely because their names look like session archives.
  • Session cleanup failures do not skip other agent stores or the independent config and OAuth directory cleanup. Failed stores retain any history whose removal was refused.
  • Without --scope, openclaw reset prompts interactively for the scope to remove.
  • --non-interactive is only valid when both --scope and --yes are set.
  • config+creds+sessions and full print Next: openclaw onboard --install-daemon when done.
  • Failed removals or session-directory inspection exit nonzero. Resolve the reported errors, then retry the reset; incomplete resets do not print the onboarding completion hint.