Repository navigation
Description
Blocked by #4281
Context
Part of #4278.
When a turn's host applications queued an index update, the turn settles that update before it closes (await held.settleIndex?.(), packages/ui-server/src/ws/session-run/turn.ts:103 and :126; the settler, packages/ui-server/src/ws/bridge.ts:196). Only afterwards do egress settlement, the final journal observation and the idle status follow. Until idle the session is busy and the next message waits.
The answer is already complete at that point. Whether the wait matters is not known: the closing bracket on a hosted install is 1.30 s at the median and 2.71 s at p90, with a 4.6 s p90 on a wider cohort, and nothing separates the index part from the rest. On a local fixture, publishing a changed index database of about 100 MB takes about 0.6 s. The joined projection in #4278 therefore credits this change nothing.
#4281 adds the missing clock. This issue acts on what it shows.
Scope
- Read the index-settle step from hosted lifecycle records once ui-server: the end of a turn is one unattributed bracket, and its end stamp precedes the idle status #4281 has shipped: how often an update is pending at turn end, and how long it takes.
- If it is material: let the turn report idle once its receipts, egress records and final observation have settled, while the index update completes afterwards. Conditions:
- the pending update survives a restart, or is recoverable by a bounded reconcile;
- a later tool that reads the index still waits for the generation that contains its own session's writes, or fails with a scoped "index not current" result. It never silently reads a stale index (the tree and index batch barriers at
packages/ui-server/src/ws/bridge.ts:183-196); - a failed update is recorded and retried, and is visible to the owner.
- If it is not material: record the numbers here and close as a documented no.
Out of scope
- Index journal rows and scope charge: ui-server: the index family still adds journal rows and counts toward a turn's byte scope #4302.
- Making the index update itself faster: core: an index run globs the whole tree twice and filters afterwards, so excluded directories are still walked #4291.
Acceptance criteria
- The issue records the measured frequency and duration of a pending index update at turn end, from lifecycle records.
- If changed: with a fixture that delays the index update by a known time,
idleis emitted without waiting for it, and a search issued by the next turn waits for the update and returns the new content. - If changed: a server restart between
idleand the update's completion leaves the update pending and it completes after the restart, by a test. - If changed: a failed update produces a recorded, retried outcome and a scoped refusal for a read that depends on it.
- A test covering any change fails on the tree before the change and passes after.
Verification
bun run test packages/ui-server/tests
bun run typecheck
bun run lintContract impact
- This touches the integration contract, unless the application outcome's index field changes meaning (
docs/integration-contract.md, the application index outcome). Check before coding. - This changes a published package's behaviour, so it needs a changeset.
2026-11-20 triage at main 63bb400b3. The current end-of-turn wrapper catches the settler rejection (packages/ui-server/src/ws/session-run/backend-entry.ts:129), while the batch tracks outcomes and subsequent reads use a barrier. #4281 must supply the hosted closing-clock evidence. If the outcome or its documented timing changes, update the contract before shipping that branch.
Activity
schlessera commentedon Nov 23, 2026
2026-11-23 triage at main
a3395c4b2: removedagent-ready. It predates the laterneeds: release, and the two contradict each other. The first scope step reads the index-settle span from hosted lifecycle records, and those exist only once the #4281 closing-phase clock ships in a published release and runs on a hosted install. That clock reached main through #4444 (squasha3395c4b2, via #4322). #4281 itself stays open for a named remaining gap, soblockedstays too.What completes
needs: release: a published@schlessera/brain-ui-serverversion that containsa3395c4b2(check npmlatest), plus hosted lifecycle records produced by that version. When that holds and #4281 is closed, removeneeds: releaseandblockedand restoreagent-ready. The brief is otherwise complete.