Repository navigation
fix: prevent large session migrations from stalling - #104737
Conversation
|
Land-ready proof for
Known proof gap: production-scale live migration will run immediately after landing because deploying the pre-fix migration would risk an extended Gateway outage. The change is covered by focused real-filesystem migration/restore tests and the repository changed gate before that live rollout. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 791526b485
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ### Fixes | ||
|
|
||
| - **Session SQLite migration scale:** batch recovery-manifest checkpoints for unreferenced JSONL archive moves and replace manifests atomically, preventing large pre-flip stores from incurring quadratic startup I/O while preserving crash recovery. Fixes #104731. |
There was a problem hiding this comment.
Remove the normal-fix changelog entry
For this non-release fix commit, the root AGENTS.md Docs / Changelog rule says CHANGELOG.md is release-only and that release generation owns it; normal PRs/direct main fixes should not edit it. Keeping this line makes the unreleased changelog diverge from the generated release-note flow and creates avoidable release conflicts, so this entry should be dropped from the fix commit.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
* fix: scale session SQLite migration manifests * chore: leave release notes to release workflow
Closes #104731
Related: #98236
AI-assisted: Codex
What Problem This Solves
Fixes an issue where operators upgrading a long-lived OpenClaw state directory could experience a prolonged Gateway startup stall when the SQLite session migration encountered many unreferenced legacy JSONL artifacts. The archive operation itself is a same-filesystem rename, but the recovery manifest was fully serialized twice per file and grew after every move.
Why This Change Was Made
The migration now persists the complete bulk move plan once before the first rename, reserves unique archive destinations across the batch, and checkpoints all successful moves once afterward. Recovery manifests are replaced atomically, preserving the existing crash-recovery contract without per-file quadratic write amplification.
User Impact
Large pre-flip session stores migrate with bounded manifest persistence instead of quadratic serialization and disk I/O. Interrupted migrations still retain every source/destination mapping needed by
openclaw doctor --session-sqlite restore.Evidence
corepack pnpm test src/commands/doctor-session-sqlite.test.ts— 33/33 passed on Blacksmith Testboxtbx_01kx9kn6jtsb2cwxn7fhj0rmdh(run).env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed— passed format, core and core-test tsgo, core lint, and all selected architecture guards on Testboxtbx_01kx9kndwx88v80ae3ht7200mk(run)..agents/skills/autoreview/scripts/autoreview --mode local --engine codex --model gpt-5.6-sol --thinking high --codex-speed fast— clean after accepting and fixing the archive-path collision finding.