Skip to content

feat: clear all BotHarness data from Settings and the CLI - #2429

Merged
DoodleBears merged 1 commit into
mainfrom
claude/project-thread-03f4ye
Oct 20, 2026
Merged

DoodleBears merged 1 commit into
mainfrom
claude/project-thread-03f4ye

Conversation

@DoodleBears

Copy link
Copy Markdown
Contributor

Requested by Vain · project thread

Why the change

Uninstalling the plugin leaves the database, Bots, Memory and IM settings on disk, so a reinstall brings the old Bots back; users need a way to start fresh.

Closes #2426

Special things to note

  • Merge risk: one-way door for users who run it (cleared data only comes back from a backup), two-way door for the code (revert this PR to remove the entry); medium blast radius — only the Host owner can trigger it, behind a preview, a ticked confirmation and a 10-minute token bound to the exact scope. Review focus: what dataResetPlan removes and keeps (packages/core/src/data-reset/reset.ts), and the exit-time / next-start removal.
  • Verification: vitest related for the diff (3544 passed; workspace-grant-roundtrip fails identically on main with Cannot bundle node:sqlite), pnpm lint, format:check, typecheck. On an isolated Host (verify-app, DSH_HOME=/tmp/bh-verify-reset): cleared once from the UI and once from the CLI; each time the Host restarted itself, the old Tob and botharness/, integrations/dsh-feishu and ~/.botharness were gone, .credentials.yaml kept the same md5, and a reused token was refused with data-reset-preview-stale. Not run: Windows (locked files fall back to the next-start removal), a Host without appExit (restart-required path covered by unit tests only).
  • CI test plan: affected; no new rule needed.

Change outline

  • Host data-reset/reset.ts: preview() lists existing targets with size and file count ($DSH_HOME/botharness, bundled IM Provider folders under $DSH_HOME/integrations, ~/.botharness) and what stays (DSH .credentials.yaml, Memory folders a Human chose, even inside a removed folder, and BotHarness Exports). confirm(token) writes $DSH_HOME/botharness-reset.json, closes the operational database, then restarts through appExit; the folders are removed while the old process exits, and again at the next start (applyPendingDataReset, first thing in apply()) if anything is left or the Host could not restart.
  • Bridge: dataResetPreview, dataResetConfirm.
  • CLI parity: deepseekbot data-reset-preview, data-reset-confirm --confirmation-stdin --confirm (token on stdin, like bot-delete-confirm); documented in docs/bot-cli*.md.
  • Client: a new last row in Data & privacy, reusing DangerTextButton, FormDialog (danger) and Callout, matching the Bot deletion dialog. DSH sessions, DSH settings and other plugins are not touched.

Data & privacy — 1440 × 900

Before — the page had only backup and usage statistics. After — a new “Clear all BotHarness data” row.

After: Data and privacy row, light

After: Data and privacy row, dark

Preview and second confirmation

The button stays disabled until the checkbox is ticked.

Preview dialog, light

Preview dialog, dark

After confirming

Restarting message


Generated by Claude Code

Settings → Data & privacy → Clear all BotHarness data, and the matching
`deepseekbot data-reset-preview` / `data-reset-confirm` commands, preview
every folder that is removed ($DSH_HOME/botharness, the bundled IM Provider
folders, ~/.botharness) and what stays (DSH credentials, Memory folders a
Human chose, exports), then require a second confirmation. Confirming stops
BotHarness writing, records a reset marker and restarts the Host; the
folders are removed while the old process exits, or at the next Host start
when it cannot restart itself.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Bj3xgpNLb4rSz519tNeFh
@DoodleBears DoodleBears self-assigned this Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2d90c35-4b83-4603-b925-0aeb7ea23231
📥 Commits

Reviewing files that changed from the base of the PR and between 9d0c4fb and 953c1cd.

⛔ Files ignored due to path filters: 5
  • .github/pr-screenshots/2426/dlg-d.png is excluded by !**/*.png
  • .github/pr-screenshots/2426/dlg-l.png is excluded by !**/*.png
  • .github/pr-screenshots/2426/done-l.png is excluded by !**/*.png
  • .github/pr-screenshots/2426/row-d.png is excluded by !**/*.png
  • .github/pr-screenshots/2426/row-l.png is excluded by !**/*.png
📒 Files selected for processing: 23
  • .agents/skills/verify-deepseekbot/features/README.md
  • .agents/skills/verify-deepseekbot/features/data-reset.md
  • changes/data-reset.md
  • docs/bot-cli.md
  • docs/bot-cli.zh.md
  • packages/client/src/client/bot-settings-sections.tsx
  • packages/client/src/client/bridge.ts
  • packages/client/src/client/data-reset-settings.tsx
  • packages/client/src/client/locale.ts
  • packages/client/src/client/settings-search.tsx
  • packages/client/test/data-reset-settings.test.ts
  • packages/core/src/bots/bot-create-cli.ts
  • packages/core/src/bots/cli-host-admin.ts
  • packages/core/src/bridge/methods.ts
  • packages/core/src/bridge/rpc.ts
  • packages/core/src/data-reset/reset.ts
  • packages/core/src/plugin.ts
  • packages/core/test/bridge-rpc.test.ts
  • packages/core/test/cli-host-admin.test.ts
  • packages/core/test/data-reset.test.ts
  • packages/core/test/plugin.test.ts
  • scripts/cli-ui-inventory.json
  • scripts/verification-inventory.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DoodleBears
DoodleBears merged commit a5672a5 into main Oct 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clear all BotHarness data before uninstall or reinstall

2 participants