Skip to content

deleteThreads

deleteThreads(db, threadIds): ReclaimSummary

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/history/checkpointRetention.ts:354

Delete every checkpoint and pending write of the named threads, and report what went.

The single-thread spelling on the saver (GthSqliteSaver.deleteThread) routes through here, so there is one implementation of the delete rather than two that can drift.

Both tables go in one transaction. A thread’s rows live in checkpoints and in checkpoint_writes, and only the first of those is what anything looks for: every candidate query in this module reads FROM checkpoints. So a failure between the two statements would leave checkpoint_writes rows belonging to a thread that no longer appears in checkpoints — bytes the readout still counts as stored, that no later pass can find, and that no reader can reach. Not a self-healing leak; a permanent one. Either both deletes land or neither does.

The caller must not already be inside a transaction: the rollback here would discard theirs. No caller is — the two entry points are the close hook and gth history prune.

DatabaseSync

readonly string[]

ReclaimSummary