Skip to content

feat(checkpoints): allow disabling workspace checkpoints via features.checkpoints and OMB_CHECKPOINTS - #65

Merged
zereight merged 1 commit into
mainfrom
feat/disable-workspace-checkpoints
Nov 26, 2026
Merged

zereight merged 1 commit into
mainfrom
feat/disable-workspace-checkpoints

Conversation

@zereight

Copy link
Copy Markdown
Owner

Summary

  • Adds an opt-out for per-turn workspace shadow-git checkpoints (~/.openmausbot/checkpoints):
    • config.json: "features": { "checkpoints": false } (also writable via PATCH /api/config and exposed on GET /api/config as features.checkpoints).
    • Environment variable: OMB_CHECKPOINTS=off / 0 / false / no (or on / 1 / true / yes), which overrides config.json and causes conflicting PATCH /api/config requests to fail with 409 (code: "checkpoints_env").
  • Default remains true so existing digest file-diff behavior and upstream compatibility are preserved.
  • When disabled:
    • Pre-turn checkpoints.snapshot(...), post-turn checkpoints.diffWorkingTree(...), and read-ahead checkpointSeeds priming are skipped (zero shadow git creation/I/O).
    • Switching off at runtime via PATCH /api/config cancels queued/in-flight read-ahead primes (clearing queued so re-enabling later works cleanly) and drops pending/in-flight shadow GC collections without re-queueing them; any in-flight turn still releases its pin without triggering GC.
    • Toggling features.checkpoints does not invalidate engine CLI status snapshots (NO_ENGINE_EFFECT.features).
    • Bot deletion cleanup (delete-leftovers.ts) stays active so existing shadow folders are still cleaned up when a bot is deleted.
  • Updates skills/openmausbot-docs/SKILL.md to reflect that checkpoints/ is used for turn digest file diffs (rollback routes were removed earlier) and documents the opt-out.

Why

  • File rollback/restore routes (GET /api/bots/:id/checkpoints, POST /api/bots/:id/checkpoints/restore) were already removed in 6dd4403d8. Today server/checkpoints.ts only powers the optional files diff section on turn digests, yet shadow git repos per (botId, cwd) can accumulate gigabytes on disk (observed: 13 GB across 25 bots) with no way to disable them — deleting ~/.openmausbot/checkpoints only led to immediate re-creation on the next turn or startup seed pass.

Verification

Automated tests & checks

  • pnpm typecheck — passed
  • pnpm lint (oxlint --deny-warnings .) — passed
  • pnpm exec vitest run server/digest.e2e.test.ts server/checkpoints.test.ts server/host/checkpoint-seeds.test.ts server/routes/config-engine-effect.test.ts — 4 files / 60 passed (1 skipped)
  • pnpm exec vitest run server/checkpoints-perf.test.ts scripts/testing/file-size-ratchet.test.ts scripts/testing/comment-history.test.ts scripts/testing/index-route-ratchet.test.ts — all passed
  • pnpm exec vitest run server/bot-box/env.test.ts — OMB_CHECKPOINTS accepted; pre-existing failure on main for 4 unrelated OMB_WORKTREE_* names remains untouched.

Before / After (Isolated real server execution)

Launched isolated OpenMyBot server fixtures (disposable OMB_DATA_DIR, temp git repos, fake claudeAgent CLI):

  • Before (default features.checkpoints: true):
    • GET /api/config → features.checkpoints: true
    • Bot with project git cwd runs a turn → DATA_DIR/checkpoints/<botId>/ created (beforeShadowCount: 1), digest includes files: { changed: [], added: [], deleted: [] }.
  • After 1 (Runtime PATCH /api/config { features: { checkpoints: false } }):
    • PATCH /api/config → 200, features.checkpoints: false, persisted to config.json.
    • New bot with project git cwd runs a turn → DATA_DIR/checkpoints/<newBotId> not created (afterPatchShadowCreatedForNewBot: false), turn & digest succeed (afterPatchDigestExists: true, afterPatchDigestFiles: null).
  • After 2 (Server started with OMB_CHECKPOINTS=off):
    • GET /api/config → features.checkpoints: false
    • PATCH /api/config { features: { checkpoints: true } } → 409 (code: "checkpoints_env")
    • Bot with project git cwd runs a turn → DATA_DIR/checkpoints root directory never created (checkpointsRootDirCreated: false), turn & digest succeed (digestExists: true, digestFiles: null).

Notes / Follow-ups (out of scope for this PR)

  • Orphan shadow-folder pruning (e.g. removing unused <shadowHash> folders when a bot changes cwd or a worktree/thread is removed) and per-file/per-shadow size bounds can be addressed in a separate PR.

@zereight
zereight merged commit 29c0e6a into main Nov 26, 2026
16 of 18 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.

1 participant