Repository navigation
Closed
Labels
agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p1Scheduled into the current or next milestone.type: fixSomething is broken and must behave the way it is documented.
Milestone
Description
Context
Each of these needs a rare single failure, but it then takes a whole host down: every turn fails, or the server does not boot. The fixes are cheap. Items 1–3 were verified on main 4b8db90de; item 4 is now confirmed end to end by the native manager regression in #3824.
- Writer-gate release is memoized before it succeeds.
release()setsreleased = trueand cachesreleasingbefore theDELETEcommits (packages/ui-server/src/brain/writer-gate.ts:354-363, delete at:274). If that oneDELETEfails, the hold stays inwriter_gateand every retry returns the same rejected promise.prune()removes only rows of dead processes (:201-204), so an exclusive hold, for example a user revert (packages/ui-server/src/brain/turn-revert.ts:101), blocks every turn until the process exits. - The native recovery index latches on any write error.
remember/forgetsetfailed = truepermanently (packages/ui-sdk/src/server/native-recovery-index.ts:20-34). Every later intent write then throws "restart the manager to rebuild it" (packages/ui-sdk/src/server/native-brain-manager.ts:288-291), so checkpoints, and therefore turns, fail. The index is a disposable copy derived from authoritative JSON intents, so it can rebuild itself.native-reference-pool.ts:410,:548and:955use the same latch. - One corrupt historical journal object blocks boot.
recover()throwsJournalStorageUnavailablewhen a published interrupted object fails verification (packages/ui-server/src/brain/journal-accounting.ts:239). The journal'sreadypromise rejects, andcreateAppawaits it before serving (packages/ui-server/src/brain/turn-journal.ts:109,packages/ui-server/src/app.ts:720). - One invalid native intent file aborts manager startup (
packages/ui-sdk/src/server/native-brain-manager.ts:306-312), and the app awaits the manager (packages/ui-server/src/app.ts:354). Confirmed end to end in CONTRACT: fix(ui-server): contain individual host recovery failures #3824: a malformed JSON intent aborts the startup scan before the manager can serve.
Out of scope
- Accepting corrupt content as a valid undo version.
- Releasing uncertain staging capacity or adopting unknown identities.
Scope
- Writer gate: a failed release stays retryable. Retry the idempotent
DELETEuntil it commits, and never memoize a rejected release. The same goes for waiter dequeue (writer-gate.ts:374). - Recovery index and reference pool: on an index error, rebuild the in-memory index from the durable intents in place, briefly suspending dependent admission. Latch only if the rebuild itself fails, and recover without restarting the process.
- Journal: quarantine an object that fails verification, mark every history entry that references it as non-restorable (incomplete), clear its reservation, and boot normally.
- Native intents: isolate an unreadable intent, keeping its identity and conservative capacity charged. Report it to the owner and boot.
Acceptance criteria
- A writer-gate release whose first
DELETEfails is retried and frees the hold, and the next turn is admitted without a restart. Test fails on the current tree. - A forced recovery-index write error leaves the next checkpoint working after the in-place rebuild. Same for the reference pool. Tested.
- A journal directory with one corrupt published object boots. Only the entries referencing it report as non-restorable, and every other entry restores normally. Tested.
- A store with one malformed intent file boots. The intent is reported, its capacity stays charged, and other identities work. Tested against the confirmed startup trace.
- Mutation receipts for each.
Verification
Unit tests in packages/ui-server/tests and packages/ui-sdk/tests; bun run check:pr --base origin/main.
Contract impact
None expected. Owner-visible quarantine reporting, if added, is additive.
2026-11-10 clarification: Item 4's trace is confirmed. The candidate in #3824 boots with the unreadable receipt fenced and uncertain staging capacity/historical dependencies retained; actual offline native-manager and reference-pool cases pass. Delivery still requires candidate confirmation and merge.
Metadata
Metadata
Assignees
Labels
agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p1Scheduled into the current or next milestone.type: fixSomething is broken and must behave the way it is documented.
Activity
schlessera commentedon Nov 10, 2026
Claiming #3816 for implementation on
fix/contain-host-failures(claim token3816-containment-20261110). The assigned worktree is dedicated to this issue. I have read the epic and containment ruling and verified the four cited failure paths. Known concurrent work may overlap journal startup and app wiring; changes will stay scoped and be reconciled before confirmation.schlessera commentedon Nov 10, 2026
Implementation is in #3824 at
24d218bd41530d522832d7e85ae85246263fd45d. The four failure paths have passing focused regressions and failing/restored guard mutations. Required local preflight passed (1,280 fast invariants), the focused suites passed 72 tests, the provider-history/index run passed 39 tests, and both owned offline Btrfs proofs passed, including malformed-intent boot and in-place index recovery in the actual manager/reference pool. PR and issue milestones read back as0.45.0. Exact-candidate confirmation and merge remain; another candidate currently holds the integration reservation.Item 4 is now traced end to end: an unreadable authoritative native receipt used to abort manager creation. Quarantine keeps its file and identity fenced, its uncertain staging allowance charged, and any historical checkpoint dependencies protected. New native roots created after recovery remain independent.
schlessera commentedon Nov 10, 2026
Implementation handoff: #3824, head
24d218bd41530d522832d7e85ae85246263fd45d.Local acceptance proof is complete: 72 focused tests; 39 provider-history/index tests; four failing/restored guard mutations; clean typecheck, lint and changeset validation; 1,280 passing preflight invariants; and passing actual offline Btrfs reference-pool and native-manager/host proofs with complete owned-resource cleanup. Current draft gates, contract and changeset checks passed; full candidate jobs are intentionally not yet requested. No reviews are present.
bun scripts/integrate.ts confirm 3824 --issues schlessera/brain-kit#3816exited 1 withIntegration busy: #3822 holds lease254c426735add7800103e731b28e6b74. No reservation, candidate confirmation or merge was started for #3824. This is coordination, not a design/human-access blocker, so readiness and milestone0.45.0remain.Resume after that reservation ends: reclaim #3816, fetch/rebase onto current
origin/main, reconcile any changed files and refresh preflight/proof as required, then rerun the confirmation command above. It owns the lease and proof-checked merge. Verify the squash on main, issue closure and both milestones afterwards. The issue stays open and the PR stays draft for now; I am releasing this invocation's assignment. No follow-up issues were needed.CONTRACT: fix(ui-server): contain individual host recovery failures (#…
CONTRACT: fix(ui-server): contain individual host recovery failures (#…