Repository navigation
Branch preloads never outlive the codebase - #6337
Merged
Merged
Conversation
preloadBranch forked an untracked thread that opened its own connection. A branch switch just before the codebase closed left that connection open (or closing) after withCreatedCodebase returned, so deleting the codebase directory raced SQLite deleting its WAL file: on Windows the MCP runner test 'a branch created by an earlier command can be named' failed in the merge queue with DeleteFile unison.sqlite3-wal: does not exist. The preload threads are now children of a ki scope that sqliteCodebase opens around the codebase's lifetime; closing it cancels any preload still running and waits for it.
Member
Author
|
Ki looks great btw I haven't really used it before. |
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Nov 10, 2026
# Conflicts: # .github/workflows/proofs/formatting/65c888d835d8453df021501c966d9f1850bc386c6a0f8c6e3ad7ef5c7df0f582.txt # .github/workflows/proofs/tests/f6c623e5124c43ae9fad43b4f432cefb5114650268d0b03464a3b484d82e588d.txt # .github/workflows/proofs/transcripts/94069090a42b3051b35c2dfd18d51af8f914dcf02bfd9833185020122964310f.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes a flaky Windows failure of the MCP runner test "a branch created by an earlier command can be named". It removed #6324 from the merge queue (run):
The cause is in ucm, not the test:
Cli/Monad.hs) callspreloadProjectBranch, which calledpreloadBranch.preloadBranchforked a thread withforkIOthat nobody tracked. The thread opens its own SQLite connection to load the branch into the cache.Implementation approach and notes
sqliteCodebaseopens a ki scope for the codebase's lifetime (withPreloads). The scope is inside the codebase lock.preloadBranchforks into that scope. When the codebase closes, ki cancels any preload still running and waits for it to finish. No connection outlives the codebase.parser-typecheckernow depends onki, whichunison-clialready uses.Test coverage
Loose ends
None.