Repository navigation
fix(host): prevent chat-index and usage SQLite reopen/leak during or after dispose - #2411
Conversation
|
Review: changes-requested SummaryCore SQLite open/dispose race protection in FindingsP0
P1
P2
P3 (Nits)
Checked & Passed
|
…h active metered usage
|
Review: approved SummaryRound 2 convergence review. All three R1 P1 findings, all three R1 P3 nits, and the Devin Review P1 (metered usage lost on unload) are fixed at R1 findings, verified item by itemP1 #1 — chat-index: fixed.
P1 #2 — usage: fixed.
P1 #3 — test authenticity: fixed. The new tests genuinely exercise the in-flight races (verified by reading the control flow and running them):
R1 P3 nits: all fixed — Devin P1 — activeMeters: fixed. Metered streams register an entry in Residual notes (non-blocking)
Not verified here
|
Issue
None (fixes deterministic Windows
EPERMonrmSync(home)intest/agent-preset.test.jsandtest/scoped-tools-creation.test.jssurfaced by Windows 4-shard CI).Agent
Agent: Antigravity (Gemini 4 Neon)
What changed / 改了什么
ds-bot/src/host/chat-index.js:disposedguard matchingcoordination.jssoopenIndex()aborts beforemkdir(home)/new DatabaseSync(indexPath)once the plugin is disposing or disposed, and late post-dispose reads (e.g. an in-flightgroupSessionFor->ownChatBrief) never open an unclosedchat-index.sqlitehandle.indexOpeningsettlement from thectx.effectdisposer soawait ctx.dispose()waits for any in-flight SQLite open to close before returning.indexedParts()andrecallToolOutput()against touching a closedindex.dbaftercatchUp/catchUpToolOutputsyields.ds-bot/src/host/usage.js:disposedguard and pending-openingsettlement toopenLedger(),noteSession(),record(), and thectx.effectdisposer sousage.sqlitecannot be opened or leaked during/after dispose.ds-bot/test/chat-index.test.js&ds-bot/test/usage.test.js:dispose()and post-dispose calls verifying neitherchat-index.sqlitenorusage.sqliteis created or leaked.Changelog
none
How I checked it / 怎么验证的
node --import ./test/harness-resolve.mjs --test test/chat-index.test.js test/usage.test.js test/agent-preset.test.js test/scoped-tools-creation.test.js(80/80 passed on Mac)npm run lint -- --quiet(0 errors)scripts/scan.mjs(0 must-fix)