Skip to content

fix(sqlite): retry the WAL switch when another opener holds a lock (#22865) - #23920

Merged
buluoray merged 1 commit into
mainfrom
fix/wal-switch-race-22865
Oct 25, 2026
Merged

buluoray merged 1 commit into
mainfrom
fix/wal-switch-race-22865

Conversation

@buluoray

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Several connections opening the same new memory file at once all succeed, instead of some failing with "database is locked".

When four openers call VectorMemoryStore.init() on one fresh v1 file at the same moment, some raise sqlite3.OperationalError: database is locked at PRAGMA journal_mode=WAL in _init_database. Measured on main (8fdb1bb), 4 threads released by a barrier: 7 of 100 rounds had a failed open, every one at that pragma.

Why it matters

A store open that fails this way surfaces as a broken memory read or write for whichever crewmate, subagent or gateway path lost the race, and nothing retries it. The same bare pragma sits on the open path of the member database, history index, knowledge store, skill search index and research campaign store.

Not a goal

  • Changing any store's journal mode policy (the task store's WAL/DELETE choice is untouched).
  • Changing busy timeouts other than setting the memory store's before the switch.
  • Converting the personal-shopper app store or the security-conductor skill script, which open their file once from a single opener.

What changed (motivation → approach → change)

Symptom: a second concurrent opener of a new file fails at once at PRAGMA journal_mode=WAL.

Root cause: leaving a rollback journal for WAL takes an exclusive lock by upgrading the read lock the pragma already holds. SQLite reports a conflict on that upgrade straight away without calling the busy handler, so busy_timeout does not cover it. Measured here: with another connection holding a write lock (BEGIN IMMEDIATE), the switch fails after 0.0 s even with busy_timeout=2000. A file already in WAL needs no lock to report its mode.

Change: a new module src/kiro_crew/sqlite_wal.py with enable_wal(conn, *, timeout_secs, clock, sleep). It reads PRAGMA journal_mode first and returns when it is already wal, so an up-to-date file takes no write lock. Otherwise it runs the switch and retries an OperationalError whose message holds "locked" (SQLITE_BUSY or SQLITE_LOCKED) with a doubling wait from 5 ms capped at 100 ms, until the deadline, then re-raises. Any other error is raised at once, so a damaged file still fails the open the same way (file is not a database comes from the read pragma now, and is_damaged_database_error still matches it). It accepts both the compat and the stdlib SQLite error classes, because the campaign store uses the stdlib module.

Call sites, each with the window its store already uses:

  • vector_memory_lifecycle._init_database: busy_timeout now set before the switch; 5 s.
  • vector_memory_member.create_member_database: 5 s (the connect default on the line above).
  • history_index: busy_timeout set before the switch; 10 s.
  • knowledge/store.py: 10 s, its own busy window rather than the 30 s connect timeout, because some callers still open it on the event loop and a wait past the loop-stall exit budget (25 s) would kill the gateway.
  • skill_search_index: 2 s.
  • auto_research/campaign/storage.py: 30 s. Its process-wide init lock stays; it cannot see another process, so the switch retries too.

Backwards compatibility

Compatible: every open that succeeded before still succeeds with the same journal mode; an open that hit the lock race now waits for at most the store's existing busy window instead of failing.

Removes nothing: the diff adds a retry around an existing statement and takes no path, record or key away.

Tests

test/test_sqlite_wal.py (new):

  • TestEnableWal::test_a_held_write_lock_is_waited_out[compat|stdlib]: another connection holds a write lock on a rollback-journal file; the test first shows a bare switch fails at once despite busy_timeout, then enable_wal with a fake clock waits, the holder commits on the second wait, and the file ends in WAL. No real sleep.
  • test_a_lock_that_outlasts_the_deadline_is_raised: the error is re-raised once the fake clock passes the deadline; waits never exceed the cap.
  • test_a_file_already_in_wal_is_not_switched_again: a trace callback shows only PRAGMA journal_mode runs on a WAL file.
  • test_an_error_that_is_not_a_lock_is_raised_at_once: a non-lock OperationalError is not retried.
  • TestMemoryStoreOpen::test_concurrent_first_opens_of_a_fresh_file_all_succeed: four VectorMemoryStore.init() calls on one fresh v1 file, released by a threading.Barrier, for 20 rounds; zero failed opens.
  • TestMemoryStoreOpen::test_an_open_waits_out_a_held_write_lock_then_switches: a store open against a held write lock waits (fake clock) and ends in WAL.

Proof: not provable -- other: prove.py reverts every production hunk, which deletes the new sqlite_wal module, so the test file only errors at import; the hand reverts below show the reds.

Hand reverts, each run alone on a clean tree:

  • vector_memory_lifecycle.py restored to main: the held-lock store test failed 10 of 10 runs; the 4×20 concurrency test failed 8 of 10 runs.
  • Retry loop removed from enable_wal: 4 tests fail. Already-WAL check removed: the trace test fails. Retry on any error: the non-lock test fails. Only the compat error class caught: the [stdlib] case fails.
  • With the fix: the whole file passed 20 of 20 repeated runs (-n0, no sleeps, barrier-released threads).

Also run, all passing: test_vector_memory.py, test_vector_memory_schema_transaction.py, test_member_memory_upgrade.py, test_member_memory_database.py, test_history_index.py, test_skill_search_index.py, test_knowledge_store_{damaged_file,onloop_db,sources}.py, test_auto_research_campaign_{contract,store}.py, test_flake_pattern_ratchet.py; plus check_file_line_cap.py, check_comment_history.py, mypy, flake8 and isort on the changed files.

Manual verification

A standalone script (4 and 8 threads, a barrier, init() on a fresh file) failed 7 of 100 rounds on main and 0 of 200 with the fix, on Linux with Python 3.12 and the bundled pysqlite3. Windows and macOS were not run: the lock-upgrade behaviour is SQLite's own and not platform code, but it is unverified on those hosts.

Related Issues

Closes #22865. Refs #13732, #21034, #22866.

Sibling sweep

Swept: git grep -n "journal_mode=WAL" -- src/
Sibling: src/kiro_crew/vector_memory_member.py:124 -- changed here
Sibling: src/kiro_crew/history_index.py:329 -- changed here
Sibling: src/kiro_crew/knowledge/store.py:482 -- changed here
Sibling: src/kiro_crew/skill_search_index.py:369 -- changed here
Sibling: src/kiro_crew/apps/builtins/auto_research/campaign/storage.py:160 -- changed here
Sibling: src/kiro_crew/apps/builtins/personal_shopper/backend/store.py:148 -- not affected -- one connection per app process, opened once at startup
Sibling: src/kiro_crew/builtin_skills/security-conductor/scripts/ledger.py:382 -- not affected -- standalone skill script that cannot import the package helper; one opener per run
Sibling: src/kiro_crew/taskq/store.py:681 -- not affected -- not a bare WAL switch: it picks WAL or DELETE per filesystem and reports what SQLite kept; left for its own change

Pattern harvest

Rule candidate: review-prompt
Pattern: a bare PRAGMA journal_mode=WAL on a connection open path; busy_timeout does not cover the switch, so route it through sqlite_wal.enable_wal.

Decision for the owner

The decision is whether the WAL switch race on concurrent first opens is fixed with a shared retry helper applied to every open path that runs a bare WAL switch. This draft adds sqlite_wal.enable_wal (skip when already WAL, retry a lock conflict until each store's existing busy window) and uses it at six open sites, rather than serializing openers with a lock, which cannot cover other processes.

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

…22865)

When several connections opened the same new memory file at once, some
failed with "database is locked" at PRAGMA journal_mode=WAL. Leaving a
rollback journal for WAL takes an exclusive lock by upgrading a read lock,
and SQLite reports a conflict on that upgrade at once without calling the
busy handler, so busy_timeout did not cover it.

The new kiro_crew.sqlite_wal.enable_wal reads the journal mode first and
returns when the file is already in WAL, which takes no write lock. Otherwise
it retries the switch on a lock conflict with a short doubling wait, until the
store's own busy timeout, and raises anything else at once. The memory store
open now sets busy_timeout first and calls it; the member database, history
index, knowledge store, skill search index and research campaign opens use
it too. The knowledge store waits at most its own 10 s busy window, since
some of its callers still open it on the event loop.

Closes #22865
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. The retry addresses the actual cause: busy_timeout doesn't cover the lock upgrade that the WAL switch needs. It is one shared helper used at every open site that runs a bare switch, and it removes nothing.

Notes

  • On knowledge/store.py, the loop-stall concern is narrowed, not closed. An open on the event loop can now block that loop for up to 10 s of time.sleep during a lock conflict, where before it failed at once. Moving those callers off the loop is the real fix; track it separately.

[DESIGN-REVIEWED] 9a380c8

Description read

[DESCRIPTION-READ] ceac7311935994bf47d3b4150ec32fe2c9644416f73953dc0c6c083aea239586

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 9a380c82ec32fcbac5a0df88fcc42dcf3b661709 — 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

Nothing to check.

Inventory (6 items) — 6 justified

Intent: let several connections open the same new memory file at once without some of them failing with "database is locked". This is a FIX.

  1. Concurrent first opens of a fresh memory store now wait out the WAL-switch lock instead of failing — justified
  2. The same retry now runs on the open paths of the member database, history index, knowledge store, skill search index and campaign store — justified
  3. A file already in WAL now only has its mode read, and is not switched again or locked — justified
  4. The memory and history stores now set their busy timeout before the switch instead of after — justified
  5. A new shared helper, sqlite_wal.enable_wal, with injectable clock and sleep, used at 6 sites — justified
  6. The campaign store now retries the switch even though it also holds its in-process init lock, because another process can still hold the file — justified

[FIRST-PRINCIPLES-REVIEWED] 9a380c8

Description read

[DESCRIPTION-READ] c270246a41242fc7e283079237694b88e164b435eac79217f2498208cf57bda3

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 9a380c82ec32fcbac5a0df88fcc42dcf3b661709 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 9a380c8

Verdict parsed from the review's SHA-scoped output markers for commit 9a380c82ec32fcbac5a0df88fcc42dcf3b661709.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 9a380c82ec32fcbac5a0df88fcc42dcf3b661709 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 9a380c82ec32fcbac5a0df88fcc42dcf3b661709 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 9a380c8

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

@buluoray

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: disposition of the Design Review note on 9a380c82ec (knowledge store, up to 10 s on the loop).

Acknowledged, no change in this PR. The wait can only happen on a file that is not in WAL yet while another connection holds its write lock: WAL is persistent in the file header, so after a store's first open the helper returns from its read pragma without waiting. The on-loop callers of this store are already a tracked backlog, recorded in docs/system-specs/modules/knowledge.md (the watcher's self-heal rebuild finalize on the cancellation path), and moving them off the loop is that work, not this fix. The 10 s cap stays well under the 25 s loop-stall exit budget, where the old code failed the open at once.

@buluoray
buluoray marked this pull request as ready for review October 25, 2026 05:21
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners October 25, 2026 05:21
@buluoray
buluoray requested a review from CrysisDeu October 25, 2026 05:21
@buluoray
buluoray enabled auto-merge (squash) October 25, 2026 05:21
@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 25, 2026

@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.

Tier 1 auto-approve: fix (8 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: bug fix that routes every store's WAL switch through one helper that retries a lock conflict, which busy_timeout does not cover, with tests for concurrent first opens.

@buluoray
buluoray merged commit 03f3b2a into main Oct 25, 2026
109 checks passed
@buluoray
buluoray deleted the fix/wal-switch-race-22865 branch October 25, 2026 06:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 25, 2026
bolichen97 added a commit that referenced this pull request Oct 29, 2026
Cherry-picks these main commits onto release/0.11.0, in merge order:

- fix(schedule): return focus to the cron folder toggle after rename (#23907)
  (cherry picked from commit a5b78da)
- fix(probes): declare an undated duplicate check's conservative bucket on the reading (#23912)
  (cherry picked from commit 95640ac)
- fix(skill-projection): coalesce end prunes so a fan-out cannot hold the start queue (#23913)
  (cherry picked from commit 47e0b8f)
- fix(optimizer): keep the user's ask and add no requirements or solutions (#23915)
  (cherry picked from commit 1f0e872)
- fix(sqlite): retry the WAL switch when another opener holds a lock (#22865) (#23920)
  (cherry picked from commit 03f3b2a)
- fix(slack): post a quiet nudge cycle's outcome to the linked thread (#23911)
  (cherry picked from commit 32faa11)
- feat(crew): run each crewmate's worker in its own git worktree (#23563)
  (cherry picked from commit 6b21419)
- fix(members): finish the phone crewmates single top bar (#19629)
  (cherry picked from commit a6150d5)
- fix(channels): stop Discord, Teams and Webex re-announcing while held (#23916)
  (cherry picked from commit 1f3210d)
- fix(subagent): macOS spawn floor reads host_available_mib (#23914)
  (cherry picked from commit ed83ad2)
- feat(crew): run a crewmate's worker on claude as well as KAS (#23538)
  (cherry picked from commit 32362f8)
- fix(dashboard): read every body integer through body_int (#22502) (#23921)
  (cherry picked from commit dad46e9)
iamwhatever pushed a commit that referenced this pull request Oct 29, 2026
Cherry-picks these main commits onto release/0.11.0, in merge order:

- fix(schedule): return focus to the cron folder toggle after rename (#23907)
  (cherry picked from commit a5b78da)
- fix(probes): declare an undated duplicate check's conservative bucket on the reading (#23912)
  (cherry picked from commit 95640ac)
- fix(skill-projection): coalesce end prunes so a fan-out cannot hold the start queue (#23913)
  (cherry picked from commit 47e0b8f)
- fix(optimizer): keep the user's ask and add no requirements or solutions (#23915)
  (cherry picked from commit 1f0e872)
- fix(sqlite): retry the WAL switch when another opener holds a lock (#22865) (#23920)
  (cherry picked from commit 03f3b2a)
- fix(slack): post a quiet nudge cycle's outcome to the linked thread (#23911)
  (cherry picked from commit 32faa11)
- feat(crew): run each crewmate's worker in its own git worktree (#23563)
  (cherry picked from commit 6b21419)
- fix(members): finish the phone crewmates single top bar (#19629)
  (cherry picked from commit a6150d5)
- fix(channels): stop Discord, Teams and Webex re-announcing while held (#23916)
  (cherry picked from commit 1f3210d)
- fix(subagent): macOS spawn floor reads host_available_mib (#23914)
  (cherry picked from commit ed83ad2)
- feat(crew): run a crewmate's worker on claude as well as KAS (#23538)
  (cherry picked from commit 32362f8)
- fix(dashboard): read every body integer through body_int (#22502) (#23921)
  (cherry picked from commit dad46e9)
bolichen97 pushed a commit that referenced this pull request Oct 31, 2026
Backports these main PRs to release/0.11.0, in pick order. Each was a
`git cherry-pick -x` of its squash commit on main:

- fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c)
- fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c)
- fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6)
- fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23)
- perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348)
- fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f)
- fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127)
- fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910)
- fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4)
- fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e)
- fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282)
- fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb)
- fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270)
- fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2)
- fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb)

Conflicts resolved by hand:
- #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry
  (the embeddings_child.py entry names a module 0.11.0 lacks);
  test/test_page_cache_prefetch.py takes main's file.
- #25328: test/test_dashboard_server_composition_contract.py lazy-import
  count 93 -> 96 (the three names it adds).
- #25705: test/test_cli_restart_refused_message.py takes main's file.
- #26085: dashboard/handlers/workflows.py adds import math, keeps the
  release typing import.

Left out: #23920 (already on release/0.11.0), #26144 (needs
sandbox_launch_mark from #24709), #26088 (fences a main-only port).
bolichen97 pushed a commit that referenced this pull request Oct 31, 2026
Backports these main PRs to release/0.11.0, in pick order. Each was a
`git cherry-pick -x` of its squash commit on main:

- fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c)
- fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c)
- fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6)
- fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23)
- perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348)
- fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f)
- fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127)
- fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910)
- fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4)
- fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e)
- fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282)
- fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb)
- fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270)
- fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2)
- fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb)
- fix(kas): auto-approve granted built-ins after Crew's own checks (#25339) (cherry picked from commit dba4de5)
- fix(kas): mount web_search as the engine's remote_web_search (#26435) (cherry picked from commit 65c21b5)
- fix(kas): answer a spec's shell.allowedCommands at the gate, after Crew's checks (#25539) (cherry picked from commit 39d07d9)
- fix(kas): relay an MCP server's boolean env flags, never its secrets (#25331) (cherry picked from commit b734a68)
- fix(security): read the -c script past options and redirections (#26087) (cherry picked from commit fea0920)
- fix(kas): refuse a shell command a denyByDefault spec does not allow (#26501) (cherry picked from commit 9f0d02f)
- fix(kas): name a deniedCommands deny aimed at a redirect as not carried (#26489) (cherry picked from commit 4951c0c)
- fix(security): delete the curl-upload deny rule (#26469) (cherry picked from commit 70e206e)

Conflicts resolved by hand:
- #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry
  (the embeddings_child.py entry names a module 0.11.0 lacks);
  test/test_page_cache_prefetch.py takes main's file.
- #25328: test/test_dashboard_server_composition_contract.py lazy-import
  count 93 -> 96 (the three names it adds).
- #25705: test/test_cli_restart_refused_message.py takes main's file.
- #26085: dashboard/handlers/workflows.py adds import math, keeps the
  release typing import.
- #25339: platform/governance.py keeps the release rule for a missing
  ceiling (main's enterprise-baseline clause is not on 0.11.0).
- #26435: harness-parity.md H6 row edited in place on the release text.
- #25539: its acp-client.md and agent-spec-fields.md lines are left out;
  the paragraphs they edit are not on 0.11.0 (security.md carries it).
- #25331: the test and two doc mentions use hoist_managed_servers /
  resume=, the 0.11.0 names of main's renamed hoist_servers_for_session.
- #26087: security package line budget 32,552 -> 32,714 (re-measured).
- #26501: kas_permissions.py comment keeps 0.11.0's shapes (main's
  subagent rules are absent); its acp-client.md line is left out, and the
  agent-spec-fields.md toolsSettings row says denyByDefault is gate-enforced.
- #26489: its agent-spec-fields.md sentence is added to the 0.11.0 row.
- #26469: test_denied_commands_security.py keeps 0.11.0's comment; count 113 -> 112.

Test fixes (host-dependent tests made hermetic; none loosens an assertion):
- tmpdir_helpers.short_tmp_path: a tmp_path override for modules whose code
  judges a path by its components (a .kiro/crew data-home part); an agent
  session's TMPDIR under ~/.kiro/crew made every test path the data home.
  Used by the file-explorer, design-tweak (both), spawn-offload, launch-copy,
  home-pin, native-skill and auto-improvement-members tests; the sage
  ancestor-chain test creates its dir under /tmp for the same reason.
- pi-gate tests and the remote-session Python 3.9 test take the first real
  binary on PATH (playwright_cli_installer_helpers._native_tool_on_path): a
  mise shim under a scratch HOME hangs or writes to stdout.
- snapshot-merge ACL test names its own uid; nobody (65534) is the overflow
  uid inside a user namespace and cannot be named in an ACL.
- installer-step and push_guard interrupt tests spawn with SIGINT at its
  default; a background pytest run starts with SIGINT ignored, which a shell
  trap and Python both keep.

Left out: #23920 (already on release/0.11.0), #26144 (needs
sandbox_launch_mark from #24709), #26088 (fences a main-only port),
#25346 (11 of its tests fail on 0.11.0: the kiro-cli skill scope it
compares against differs there), #26397 (needs #26152's new download
route, not on 0.11.0), #26428 (not merged).
bolichen97 added a commit that referenced this pull request Oct 31, 2026
…26487)

Backports these main PRs to release/0.11.0, in pick order. Each was a
`git cherry-pick -x` of its squash commit on main:

- fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c)
- fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c)
- fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6)
- fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23)
- perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348)
- fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f)
- fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127)
- fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910)
- fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4)
- fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e)
- fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282)
- fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb)
- fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270)
- fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2)
- fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb)
- fix(kas): auto-approve granted built-ins after Crew's own checks (#25339) (cherry picked from commit dba4de5)
- fix(kas): mount web_search as the engine's remote_web_search (#26435) (cherry picked from commit 65c21b5)
- fix(kas): answer a spec's shell.allowedCommands at the gate, after Crew's checks (#25539) (cherry picked from commit 39d07d9)
- fix(kas): relay an MCP server's boolean env flags, never its secrets (#25331) (cherry picked from commit b734a68)
- fix(security): read the -c script past options and redirections (#26087) (cherry picked from commit fea0920)
- fix(kas): refuse a shell command a denyByDefault spec does not allow (#26501) (cherry picked from commit 9f0d02f)
- fix(kas): name a deniedCommands deny aimed at a redirect as not carried (#26489) (cherry picked from commit 4951c0c)
- fix(security): delete the curl-upload deny rule (#26469) (cherry picked from commit 70e206e)

Conflicts resolved by hand:
- #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry
  (the embeddings_child.py entry names a module 0.11.0 lacks);
  test/test_page_cache_prefetch.py takes main's file.
- #25328: test/test_dashboard_server_composition_contract.py lazy-import
  count 93 -> 96 (the three names it adds).
- #25705: test/test_cli_restart_refused_message.py takes main's file.
- #26085: dashboard/handlers/workflows.py adds import math, keeps the
  release typing import.
- #25339: platform/governance.py keeps the release rule for a missing
  ceiling (main's enterprise-baseline clause is not on 0.11.0).
- #26435: harness-parity.md H6 row edited in place on the release text.
- #25539: its acp-client.md and agent-spec-fields.md lines are left out;
  the paragraphs they edit are not on 0.11.0 (security.md carries it).
- #25331: the test and two doc mentions use hoist_managed_servers /
  resume=, the 0.11.0 names of main's renamed hoist_servers_for_session.
- #26087: security package line budget 32,552 -> 32,714 (re-measured).
- #26501: kas_permissions.py comment keeps 0.11.0's shapes (main's
  subagent rules are absent); its acp-client.md line is left out, and the
  agent-spec-fields.md toolsSettings row says denyByDefault is gate-enforced.
- #26489: its agent-spec-fields.md sentence is added to the 0.11.0 row.
- #26469: test_denied_commands_security.py keeps 0.11.0's comment; count 113 -> 112.

Test fixes (host-dependent tests made hermetic; none loosens an assertion):
- tmpdir_helpers.short_tmp_path: a tmp_path override for modules whose code
  judges a path by its components (a .kiro/crew data-home part); an agent
  session's TMPDIR under ~/.kiro/crew made every test path the data home.
  Used by the file-explorer, design-tweak (both), spawn-offload, launch-copy,
  home-pin, native-skill and auto-improvement-members tests; the sage
  ancestor-chain test creates its dir under /tmp for the same reason.
- pi-gate tests and the remote-session Python 3.9 test take the first real
  binary on PATH (playwright_cli_installer_helpers._native_tool_on_path): a
  mise shim under a scratch HOME hangs or writes to stdout.
- snapshot-merge ACL test names its own uid; nobody (65534) is the overflow
  uid inside a user namespace and cannot be named in an ACL.
- installer-step and push_guard interrupt tests spawn with SIGINT at its
  default; a background pytest run starts with SIGINT ignored, which a shell
  trap and Python both keep.

Left out: #23920 (already on release/0.11.0), #26144 (needs
sandbox_launch_mark from #24709), #26088 (fences a main-only port),
#25346 (11 of its tests fail on 0.11.0: the kiro-cli skill scope it
compares against differs there), #26397 (needs #26152's new download
route, not on 0.11.0), #26428 (not merged).

Co-authored-by: w <w@k.local>
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.

Concurrent first opens of a fresh memory file fail at PRAGMA journal_mode=WAL

2 participants