Independent OpenClaw reporting, releases, guides, and community coverage
Releases

OpenClaw Gateway Archive Pruning Moves Off Main Thread

OpenClaw now moves cold archive-pruning validation through guarded async acquisition, reducing Gateway main-thread pauses during cleanup.

Filed under Releases 3 min read Updated Sep 9, 2026
OpenClaw Gateway Archive Pruning Moves Off Main Thread

OpenClaw's Gateway has a storage-maintenance fix aimed at preventing archive pruning from blocking the main thread during cold database validation.

The change landed in PR #143379, titled fix: prevent cold archive pruning from blocking the Gateway. The pull request says disk-budget archive pruning could pause the Gateway's main thread when a cached database connection closed between free-page drain steps, measurements, or archive file removal.

Archive pruning is not a flashy feature, but it matters for systems that run continuously. OpenClaw agents accumulate session data, archive records, and durable state. Cleanup needs to be correct, but it should not stall the control plane while doing cold validation work.

What Changed

Queued pruning now uses the existing guarded asynchronous acquisition owner for its cold database phases. Each free-page pass keeps checkpoints, freelist reads, and bounded vacuum work together on one admitted connection.

The PR also notes that archive queries now read current rows after validation, and the complete canonical transaction runs after reacquisition following file removal.

The author explicitly calls out what did not change:

  • Existing writer sections are preserved.
  • Full integrity and foreign-key checks remain in place.
  • The initial freelist bound and 512-page steps are unchanged.
  • Archive ordering and unpublished exclusions stay intact.
  • File-before-row recovery behavior is preserved.

That framing is important. The fix is not a new retention policy or a broader storage rewrite. It moves cold validation through the right acquisition path while keeping the cleanup semantics stable.

User Impact

The user impact is mostly operational: cold full-file validation at five queued pruning boundaries no longer runs on the Gateway's main thread.

For a single small instance, that may simply mean fewer odd pauses during cleanup. For busier OpenClaw installations, especially those with long-lived agents and large session archives, storage maintenance needs to stay out of the way of normal Gateway responsiveness.

The PR says pruning continues to retain the canonical recovery row if acquisition fails after a derived file was removed. That preserves the recovery story while avoiding a main-thread cold path.

No schema change, retry behavior change, Worker reuse change, or new writer section is introduced.

Validation

The evidence is broad for a storage-maintenance change. The PR reports that five cold cases completed real maintenance on original main but failed the off-parent validation assertion. The final targeted proof passed all 13 new cases plus the existing large-freelist regression.

Those cases covered warm and cold free-page behavior, canonical presence, ordered rows, unpublished names, post-file-removal boundaries, FIFO exclusion, revocation during drain and after file removal, and fresh unpublished-row protection.

The final changed-file gate passed, including typechecks, lint, dependency and boundary guards, and runtime import-cycle checks. A Linux Testbox run also passed 99 tests across five suites and the full build.

For OpenClaw, the headline is straightforward: archive cleanup should remain reliable, but the Gateway has one fewer reason to pause while it does maintenance work.

Daily Briefing

Get the Open-Source Briefing

The stories that matter, delivered to your inbox every morning. Free, no spam, unsubscribe anytime.

Join 45,000+ developers. No spam. Unsubscribe anytime.