Problem
Brain status during startup and auto-ingest (before any session exists) was never received by the TUI. The bus publishing logic skipped publishing when no session ID was available, and the TUI's useServiceBus bailed when sessionId was undefined.
Additionally, updateStatus("ready") fired immediately after launching auto-ingest, creating a race condition: TUI saw busy → ready → busy → success instead of a clean busy → success.
Root cause
Brain status was session-scoped (brain/{sessionId}/status) but brain state (ingest, memories, knowledge) is project-wide — one brain per directory, shared across all sessions.
Fix
status.ts: Always publish to brain/{projectId}/status via forProject(deriveProjectId(directory)) — no ALS session routing, no withSessionId in write()
tui.tsx: Use useProjectBus only — subscribes to brain/{projectId}/status for both sidebar and home slots; reads directory from api.state.path.directory
four-opencode-brain.ts: Fix startup race — updateStatus("ready") only fires when no ingest is running; auto-ingest transitions to ready itself. Fix timeoutMs scope, project?.id, implicit any hook params.
Requires
four-opencode-plugin-lib v0.6.7 (adds BusClient.forProject())
Problem
Brain status during startup and auto-ingest (before any session exists) was never received by the TUI. The bus publishing logic skipped publishing when no session ID was available, and the TUI's
useServiceBusbailed whensessionIdwas undefined.Additionally,
updateStatus("ready")fired immediately after launching auto-ingest, creating a race condition: TUI saw busy → ready → busy → success instead of a clean busy → success.Root cause
Brain status was session-scoped (
brain/{sessionId}/status) but brain state (ingest, memories, knowledge) is project-wide — one brain per directory, shared across all sessions.Fix
status.ts: Always publish tobrain/{projectId}/statusviaforProject(deriveProjectId(directory))— no ALS session routing, nowithSessionIdinwrite()tui.tsx: UseuseProjectBusonly — subscribes tobrain/{projectId}/statusfor both sidebar and home slots; reads directory fromapi.state.path.directoryfour-opencode-brain.ts: Fix startup race —updateStatus("ready")only fires when no ingest is running; auto-ingest transitions to ready itself. FixtimeoutMsscope,project?.id, implicit any hook params.Requires
four-opencode-plugin-lib v0.6.7 (adds
BusClient.forProject())