Skip to content

fix(memory): keep the shared -wal when another process closes the memory store (0.11.0 backport of #25852) - #26465

Closed
bolichen97 wants to merge 1 commit into
release/0.11.0from
backport/0.11.0-pr25852
Closed

bolichen97 wants to merge 1 commit into
release/0.11.0from
backport/0.11.0-pr25852

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Ship #25852 on the 0.11.0 release line, so a 0.11.0 build no longer lets another process's close delete the memory store's shared -wal.

#25852 merged to main after release/0.11.0 was cut, so no 0.11.0 build has it. Users on 0.10 and 0.11 builds are still reporting database disk image is malformed from a split memory.db, and a gateway that will not start after it.

Why it matters

A split memory.db loses the rows written after the split, and every backup taken afterwards carries the damage. The release line is what users install; a fix only on main reaches them one release late.

Not a goal

What changed (motivation → approach → change)

One commit: git cherry-pick -x of dc63bb6, the #25852 squash commit on main. It applied with no conflict. Same change as #25852:

  • src/kiro_crew/sqlite_wal.py: adds keep_wal_on_close and truncate_wal_before_close.
  • src/kiro_crew/vector_memory_lifecycle.py and src/kiro_crew/vector_memory.py: the store's write connections keep the -wal on close and empty it before closing.
  • src/kiro_crew/diagnose_probes.py: the settings diagnosis probe opens memory.db with the store's driver instead of the stdlib sqlite3.
  • .github/black-baseline.txt: drops the row for test/test_bench_round9.py, which is now black-clean.

Backwards compatibility

Compatible: same change as #25852 on main. A closed store leaves an empty memory.db-wal and memory.db-shm instead of deleting them; SQLite reads or resets both on the next open.

Removes nothing: the change only stops a close from deleting files; no API, key, row or path is removed.

Tests

  • test/test_vector_memory_wal_split.py, test/test_sqlite_wal.py, test/test_bench_round9.py, test/test_memory_backup.py on this branch: 99 passed.
  • scripts/local-gate.py --base origin/release/0.11.0: backend related set 6522 passed, 33 skipped; frontend related set 400 files, 11840 tests passed.
  • black, isort, flake8 clean on the changed Python files; mypy clean on the four changed modules; flake-pattern ratchet and the repository's semgrep rules pass on the diff.

Proof: PROVEN test/test_vector_memory_wal_split.py::test_another_process_close_keeps_the_wal_a_lockless_writer_uses (head 3a6c06c)

Determinism: the tests are #25852's own, unchanged; their repeat and shuffled-order runs are recorded on #25852.

Manual verification

N/A - verified on #25852 itself; this is the same commit on the release branch.

Screenshots / video

Why no screenshot: backend-only change with no visible output.

Related Issues

Part of #25846

Backport of #25852.

Sibling sweep

Siblings: none -- a backport of one main fix; its sibling sweep is on #25852

Pattern harvest

Not generalizable: backport of #25852; its harvest is recorded on that PR.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

…ory store (#25852)

Co-authored-by: w <w@k.local>
(cherry picked from commit dc63bb6)
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 30, 2026 22:53
@bolichen97
bolichen97 requested review from CrysisDeu and removed request for a team October 30, 2026 22:53
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 3a6c06cd596d20c8267048628dc93357b58abc59 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 3a6c06cd596d20c8267048628dc93357b58abc59 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this is a clean cherry-pick of #25852 onto the release line, with the same design and tests. The only things it takes away are side-file deletions, and the restore and backup readers already handle a leftover empty -wal.

[DESIGN-REVIEWED] 3a6c06c

Description read

[DESCRIPTION-READ] 89ea0e62a9621dd5ecde63f4216ae22644651b016336511f5dcf73381f3b8996

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 3a6c06cd596d20c8267048628dc93357b58abc59 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

This is a clean -x cherry-pick of #25852, which is already merged. The two deleted pins ("no -wal left behind") are the behaviour this fix changes on purpose, and the diff explains why each was rewritten.

What this change ships

Inventory (6 items) — 6 justified

Intent: ship the fix on the 0.11.0 release line so that another process closing the memory store can no longer delete the shared -wal and split memory.db. This is a FIX.

  1. Closing the memory store's write connection no longer checkpoints and deletes -wal/-shm (keep_wal_on_close) — justified
  2. A closing store first empties its -wal in place with a TRUNCATE checkpoint and leaves a zero-byte file — justified
  3. The settings diagnosis probe opens memory.db with the store's own SQLite driver, not the stdlib one — justified
  4. After a closed store, the backup and restore tests accept an empty -wal/-shm, and the restore test leaves superseded sidecars out of its count — justified
  5. The ingest-leak test now checks for an open handle with an exclusive-lock probe, not by looking for missing sidecar files — justified
  6. The black-baseline row for test_bench_round9.py is dropped because that file is now black-clean — justified

[FIRST-PRINCIPLES-REVIEWED] 3a6c06c

Description read

[DESCRIPTION-READ] e30bcae7d6cab7962a089ee7bc7f0f45c72db1d683a3be4a2d94a2ef54a218d9

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 3a6c06cd596d20c8267048628dc93357b58abc59 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 3a6c06c

Verdict parsed from the review's SHA-scoped output markers for commit 3a6c06cd596d20c8267048628dc93357b58abc59.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 3a6c06cd596d20c8267048628dc93357b58abc59 false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 3a6c06cd596d20c8267048628dc93357b58abc59 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 3a6c06c

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 3a6c06cd596d20c8267048628dc93357b58abc59 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 30, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 3a6c06cd596d20c8267048628dc93357b58abc59: the base branch is release/0.11.0, not main.

The commit is a faithful -x cherry-pick of dc63bb6fbb (#25852). Its added and removed lines match the main commit exactly. Its checks are green, and no AI lane raised a finding. It also changes what the memory store deletes on close (-wal/-shm are now kept). Release-line backports and data-deletion behaviour both need a maintainer. To clear this, a release owner should confirm that #25852 belongs in 0.11.0 and approve.

— crew-pr-reviewer (r137)

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head, UX skipped or pass, no conflict, no open change request.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Folded into the combined 0.11.1 hotfix backport #26487, which carries the same git cherry-pick -x of dc63bb6 (#25852) as its own commit, after #24290 and #24414. Closing this one so the release branch gets a single backport PR.

@bolichen97 bolichen97 closed this Oct 31, 2026
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 31, 2026
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.

3 participants