ui-server: an in-memory database gets a quarantine temp directory that nothing removes
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bun, typescript
Direzione di ricerca
Inizia in packages/ui-server/src/brain/host-execution.ts e segui quarantineDirFor, createHostExecution e release() per vedere in cosa differiscono i percorsi in memoria e quelli basati su file. Aggiungi la copertura di pulizia richiesta ai test indicati nei criteri di accettazione, inclusi i casi di chiusura e di errore durante l’avvio. Il lavoro è completo quando al rilascio viene rimosso solo il directory in memoria, mentre una directory di quarantena basata su file rimane; aggiungi anche il changeset richiesto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
Quarantined files go to a host-private directory beside the database. For a database path of ":memory:"
there is no "beside", so quarantineDirFor (packages/ui-server/src/brain/host-execution.ts:27-30) creates a
fresh directory with mkdtempSync(join(tmpdir(), "brain-ui-quarantine-")).
createHostExecution creates it the first time manifests are opened (open,
packages/ui-server/src/brain/host-execution.ts:84-85), which happens on every boot through attach
(:115-129), and exposes it as quarantinePath() (:99). release() (:130-133) closes an early database
handle and nothing else. The app calls release() on boot failure and on close
(packages/ui-server/src/app.ts:511, :1574), so the directory has no owner that removes it: the file
contains no rmSync or rm call at all.
The in-memory path is a supported configuration, not an accident of tests: it has its own layout test
("an in-memory database refuses private quarantine storage inside the brain",
packages/ui-server/tests/operational-state-layout.test.ts:112-121). 27 test files boot an app or a host
execution with DB_PATH or dbPath set to ":memory:", and each boot leaves one empty directory in the
shared temp root. On a machine that runs the suite repeatedly these accumulate without bound; the audit
counted several hundred left behind within three days on one development machine.
Related: #4467 (the test app's teardown leaves the journal database behind) is the same kind of leak in a
test helper; this one is in production code that tests run.
Scope
- A quarantine directory that
createHostExecutioncreated for an in-memory database is removed,
recursively and best-effort, whenrelease()runs. - A file-backed database's
<dir>/brain-ui-quarantineis never removed byrelease().
Out of scope
- Creating the directory lazily on first quarantine. The path is handed to the manifest store when it opens
andquarantinePath()is reported to storage accounting (packages/ui-server/src/app.ts:1280-1281);
removing what was created is the smaller change. - The journal database a test app leaves behind (#4467) and other temp directories tests create.
- The two cleanup lists of
createApp(#2514). - Requiring callers that pass
":memory:"to supply their own quarantine directory. That changes a
published option's meaning.
Acceptance criteria
- A test boots an app with
DB_PATH: ":memory:", readsquarantinePath()(or the "Quarantined changes"
store path the app reports), closes the app and asserts the directory no longer exists. It fails on
the tree before the change. Mutation: remove the cleanup fromrelease()and the directory is still
there. - A test asserts the same for a boot that fails after the host execution was created (the boot-failure
path also callsrelease()). - A test with a file-backed
DB_PATHplaces a file under<dir>/brain-ui-quarantine, closes the app and
asserts the file is still there. Mutation: remove the directory unconditionally inrelease()and
this test fails. -
packages/ui-server/tests/operational-state-layout.test.tsand
packages/ui-server/tests/host-execution-boundary.test.tspass with no expected value changed.
Verification
bun run test packages/ui-server/tests/operational-state-layout.test.ts
bun run test packages/ui-server/tests/host-execution-boundary.test.ts
NODE_OPTIONS=--max-old-space-size=6144 bun run typecheck
bun run lint
bun run check:pr --base origin/main
Contract impact
- This touches the integration contract, so it needs the
contractlabel, aCONTRACT:commit prefix, and the doc updated in the same commit. - This changes a published package's behaviour, so it needs a changeset.
An embedder that boots @schlessera/brain-ui-server on an in-memory database no longer finds the temporary
quarantine directory after close().
Found by a repository audit on 2026-11-26 (main 87b96b10c); independently reviewed before filing.
- Lingua principale
- TypeScript
- Stelle
- 5
- Fork
- 0
- Merge medio
- 8h 3m
- PR unite (30g)
- 606
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di schlessera/brain-kit
-
agent-ready area: ui-server priority: p3 type: refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
schlessera/brain-kit#4833 ·
I maintainer di solito rispondono entro 1 giorno
-
ui-sdk: the turnId doc comment tells client authors echoing is optional, which a rev 3 host refusesApertaagent-ready area: ui-sdk priority: p3 type: docs
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
schlessera/brain-kit#4824 ·
I maintainer di solito rispondono entro 1 giorno
-
ui-react: the recordings tray and the associate dialog import each other for two label helpersApertaagent-ready area: ui-react blocked priority: p3 type: refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
schlessera/brain-kit#4819 ·
I maintainer di solito rispondono entro 1 giorno
-
jobs: every command writes on open, so a read fails with "database is locked" during a long writeApertaagent-ready area: modules priority: p2 type: fix
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
schlessera/brain-kit#4809 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-ready area: ui-server priority: p2 type: refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
schlessera/brain-kit#4806 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di schlessera/brain-kit
Issue simili
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
backend enhancement priority:P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
geolens-io/geolens#4161 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
xdelmo/Portfolio-minimal#667 ·
I maintainer di solito rispondono entro 1 giorno
-
external-issue to-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
supabase/supabase#54162 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
BUG: WebGPU finds no adapter on Linux when a DRM card has no vendor file (ONNX Runtime 1.24.4)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
CyberTimon/RapidRAW#2303 ·
I maintainer di solito rispondono entro 1 giorno