Repository navigation
Description
Context
Part of #4278.
Every latency figure in #4278 is a host clock. Nothing records what a person experienced:
- the time between pressing send and the host accepting the turn;
- when the first content of the answer was painted. The host knows when the first assistant block completed (10.2 s median after accept, 23.0 s p90); text deltas arrive earlier than the block record, by an amount only the client can see;
- when the composer accepted the next message. The host's
idlestatus follows its own end stamp by an unmeasured amount (see ui-server: the end of a turn is one unattributed bracket, and its end stamp precedes the idle status #4281).
The complaint that started the investigation was about how the chat feels. The only way to check that a change helped is a clock at the client.
Scope
- The client records, per turn, elapsed pairs on its own monotonic clock:
- send to the host's first frame for that turn;
- send to the first painted content of the answer (thinking or text);
- send to the first painted status that names a phase, once ui-react: one "thinking" status covers the ten seconds from accept to first content #4311 supplies that phase-specific status;
- last painted content to the
idlestatus.
- It reports them to the host once, after
idle, keyed by the turn id. Elapsed pairs only: no cross-process clock subtraction. - The host stores them beside the turn's lifecycle record.
- A lost report loses the measurement and nothing else.
Out of scope
- Showing these numbers in the product.
- Any change to what is painted when: ui-react: one "thinking" status covers the ten seconds from accept to first content #4311.
- General client diagnostics and connectivity evidence (Epic: client connectivity evidence and safe diagnostic reports #577).
Acceptance criteria
- After a completed turn in the browser test harness, the turn's stored record carries the client pairs, each a non-negative number.
- With a fixture backend that delays its first content by a known time, the delay appears in "send to first painted content" within one animation frame's tolerance.
- A turn started on one client and finished while that client is disconnected records no client pairs and is otherwise unaffected.
- The report cannot be used to write any other field of the turn's record, and a report for a turn the principal does not own is refused, by tests.
-
docs/integration-contract/wire.mddescribes the client-to-host message and the stored fields. - A test covering this fails on the tree before the change and passes after.
Verification
bun run test packages/ui-react packages/ui-server/tests
bun run typecheck
bun run lintPlus the real browser test for the turn path, run with command-scoped sandbox escalation where the sandbox blocks it.
Contract impact
- This touches the integration contract, so it needs the
contractlabel, aCONTRACT:commit prefix, and the doc updated in the same commit. Additive: one client-to-host message and optional stored fields. - This changes a published package's behaviour, so it needs a changeset.
Decisions needed
The existing host record is persisted by createTurnLifecycle (packages/ui-server/src/activity/turn-lifecycle.ts:14-27). Its turn milestones stop accepting updates at finish (finish, same file:59-62). Decide whether the after-idle browser report is a separate owner-bound receipt joined on read, or whether it extends the same lifecycle through a narrow write procedure. A separate receipt preserves the completed host clock and independent report lifetime at the cost of a join. Updating the lifecycle reuses its record but needs an explicit rule for post-finish replay, duplicates, retention and authorization. Prefer the separate receipt unless an existing append path can provide the same guarantees.
Decide whether the first-content metric means an observed presentation after content commits or client receipt of the content frame. The first follows the reported interaction but needs a browser-supported observation boundary and a defined background/unsupported outcome. The second is easier to validate but reports transport arrival. Prefer the presentation metric with absent values when evidence is unavailable. Browser animation-frame callbacks by themselves do not prove a displayed frame. If choosing arrival, rename the metric and update its acceptance criterion.
#4311 supplies the phase-status field later. The independent send, content and idle measurements can omit that value until the UI supplies it. Record the selected measurement, persistence and ownership semantics here before implementation. Then use the existing wire lifecycle section for the additive contract.
2026-11-20 triage — Updated source and the status reference on 63bb400b3. The remaining choices concern protocol and evidence semantics.
Activity
schlessera commentedon Nov 20, 2026
Decision (maintainer, 2026-11-20):
idlestatus received".Everything else in the scope stands.
needs: decisionis removed.schlessera commentedon Nov 20, 2026
Claimed for implementation. Claim token:
claim-01af4fcb. Branch:feat/4282-client-turn-receipt.Worked as part of the #4278 epic integration branch epic/4278-host-overhead (one main landing for the epic). Collisions: none recorded at claim.