Repository navigation
Description
Part of #4426. Follow-up to the amended ruling on #4487.
Context
When the private-state alias check cannot finish, the host refuses boot. The owner then loses status, diagnostics and settings, and can't see why from the UI. A first attempt in PR #4490 booted the full host and tried to gate each brain reader instead. Review showed the gate could not be proven complete: file routes, the graph index, voice orientation, chat attachments, the MCP bridge and boot steps all read the brain directly. createApp (packages/ui-server/src/app.ts) is one function of about 1,600 lines with about 70 uses of config.brainPath. Auth, status and settings are built after steps that touch the brain.
Ruling (maintainer, 2026-11-23)
Option 3: no brain-kit host runs in this state. The embedder reports the refusal itself, for example as a static page or a log line, and the owner repairs the layout and restarts. brain-kit does not split createApp, does not add a diagnostic listener, and opens no app database while its own isolation is unverified. The owner-facing rendering belongs to the hosting template, filed as a template task.
Scope
Make the refusal that createApp already throws a documented embedder contract. The error is named OperationalStateInBrainError and its status is attached (assertOperationalStateOutsideBrain, packages/ui-server/src/brain/operational-state.ts:159-166; called at packages/ui-server/src/app.ts:427-433). Its reasons are private_state_in_brain and database_in_brain, plus private_state_unverified once #4487 / PR #4490 lands.
- Document the shape (error name,
status.available,status.reason,status.detail) and its reasons for embedders indocs/integration-contract.md. - Pin it with tests: each reason rejects
createAppbefore any listener starts orui.dbis opened, and the attached status matches the documented shape. - The
detailtext stays owner-actionable and never carries secrets.
Out of scope
- Splitting
createApp, a diagnostic listener, or any brain-kit route in this state (ruled out). - Rendering in the hosting template (template task).
- Recovering without a restart.
Acceptance criteria
-
docs/integration-contract.mddocuments the refusal's error name, itsstatusfields and every reason, as an additive contract entry. - A test per reason proves that
createApprejects with that shape, and that no HTTP listener is created and noui.dbfile is opened before the rejection. - A mutation that drops the attached
statusfails the named test on its assertion.
Verification
bun run test packages/ui-server/tests
bun run typecheck
bun run lintContract impact
- Additive integration-contract entry, so the commit is prefixed
CONTRACT:. - Changeset for
@schlessera/brain-ui-server.
Blocked by #4487
Decision record
The ruling on #4487 (2026-11-23, amended) says only that a host booting with no brain-reading surface is a separate issue. It doesn't choose how. The approach in Scope above is a proposal, not a ruling.
Question: how should a host whose private-state alias check cannot finish show its owner why, without any surface that reads the brain?
Pointers at main 356fa7d76: createApp (packages/ui-server/src/app.ts:373, file of 1,592 lines, 68 uses of config.brainPath); the boot refusal (assertOperationalStateOutsideBrain, packages/ui-server/src/app.ts:427-433, and packages/ui-server/src/brain/operational-state.ts:159-166), which already attaches its status to the thrown error "so an embedder can show the same diagnostic even though a refused app has no HTTP listener"; route mounting from createHealthRoutes (app.ts:1135) onward.
Options:
- Split
createAppinto a part that never receives the brain path and a part that does, with a fetch and WebSocket handover (the Scope above). Consequence: complete by construction, but it is the largest refactor of the host's assembly, and every later route must be placed on the right side. - A separate diagnostic listener built before
createAppfrom route factories that take no brain path (auth, status, a settings subset), replaced by the full app once a check verifies. Consequence: no split ofcreateApp, but two assemblies of auth and status to keep consistent. - No brain-kit host at all in that state. The embedder (the hosting template) reports the refusal's attached
statusitself, for example as a static page or log line; the owner repairs and restarts. Consequence: smallest change, no settings, and recovery needs a restart.
Each must settle whether opening or writing the app database is allowed while its own isolation (database_in_brain) is unverified: a settings write could land inside the brain if the database aliases into it.
Recommendation (not a ruling): option 3 first, as the smallest outcome under a p3 priority; option 2 only if a driving use case needs settings in this state.
Ruled 2026-11-23: option 3. Previous completion note: a dated maintainer ruling on this issue, folded into Scope and the acceptance criteria; then needs: decision comes off. The owner-facing design (see the design prompt in the comments) follows the ruling and keeps needs: design until approved.
2026-11-23 triage at main 356fa7d: the issue had needs: design but no prompt, and its central choice is architectural, so needs: decision was added with the question and options above; a design prompt for the owner-facing state is posted as a comment.
2026-11-23 triage at main 356fa7d76: folded the option 3 ruling into the body and rescoped the issue to the embedder contract. Removed needs: decision and needs: design: no brain-kit surface remains to design, and the template rendering carries its own design.
Activity
schlessera commentedon Nov 23, 2026
Needs design: the owner's view of a host that can't verify private-state isolation (prompt 2026-11-23, main
356fa7d76). Settled: a confirmed exposure refuses boot; a persistentprivate_state_unverifiedalso refuses boot withOperationalStateAliasVerificationUnavailable(amended ruling on #4487); no surface in this state may read the brain. Open, in order: the architecture (needs: decisionin the body), then what the owner sees and may do in that state, which code can't decide. Run this prompt after the ruling and pass the chosen option in.Paste to Claude:
schlessera commentedon Nov 23, 2026
Decision (maintainer, 2026-11-23): option 3. No brain-kit host runs while private-state isolation is unverified. The embedder reports the attached refusal status, and the owner repairs and restarts. This issue is rescoped to documenting and pinning that refusal as an embedder contract. The template rendering is filed separately, and the design prompt above applies to it.
schlessera commentedon Nov 23, 2026
Unblocked: #4487 is closed, so
scripts/sync-project.tsis removing theblockedlabel.