Repository navigation
Description
Context
Part of #4278.
A turn's lifecycle record (createTurnLifecycle, packages/ui-server/src/activity/turn-lifecycle.ts:14-22) carries milestones, durations and sub-phases. It does not say which build of the packages produced it, and neither does any other per-turn record under packages/ui-server/src/activity/.
The investigation behind #4278 needed to compare turns across releases to date two changes in behaviour: when the gap after a tool result appeared, and whether a release raised admission time. It could do so only for releases whose deploy time was known from outside the product, and for the earliest step it could name the commits on main but not the commit that ran. One apparent regression at a release turned out to be a change in the mix of turns, which a per-turn build identity would have shown at once.
Scope
Reuse the running package identity already read by packageInfo (packages/ui-server/src/routes/health.ts:1). Capture the validated optional revision with the record’s initial host metadata, and use version evidence from the backend selected for this turn when available. The additive public type lives in ActivityTurnLifecycle (packages/ui-sdk/src/protocol.ts:3899).
- Stamp each lifecycle record with the identity of the running build: the
@schlessera/brain-ui-serverpackage version and, when the host provides one, a build revision string. - The revision comes from one optional, documented environment variable that a hosting image sets at build time. Unset is recorded as absent, never guessed.
- Record the pinned agent runtime version the turn used where the backend reports it.
Out of scope
- Any deployment's way of setting the variable. A sentence in
brain-hosting-templateis enough and can follow. - Backfilling earlier records, changing the provider conversation, or putting deployment identifiers into public fixtures.
Acceptance criteria
- A lifecycle record written by a server whose revision variable is set carries the package version and that revision.
- With the variable unset the record carries the package version and no revision field.
- The value is validated as a short printable token (for example up to 64 characters of
[A-Za-z0-9._+-]); anything else is dropped and recorded as absent. - The environment variable is listed where the environment-documentation check expects it.
-
docs/integration-contract/wire.md("Host turn lifecycle", line 554) describes the new optional fields. - A test covering this 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, so it needs the
contractlabel, aCONTRACT:commit prefix, and the doc updated in the same commit. Additive: optional fields on the lifecycle record. - This changes a published package's behaviour, so it needs a changeset.
2026-11-20 triage — Verified the existing package version source and lifecycle envelope at main 63bb400b3. Keep the optional fields absent for historical records and unknown runtime identity.
Activity
schlessera commentedon Nov 20, 2026
Claimed for implementation. Claim token:
claim-f3d02747. Branch:feat/4279-turn-clocks.Worked as part of the #4278 epic integration branch epic/4278-host-overhead (one main landing for the epic). Collisions: none recorded at claim.
schlessera commentedon Nov 23, 2026
Closed by #4444, squash-merged to main as
a3395c4b2. The combined review found every non-native criterion met. Native-measurement criteria for this issue moved to #4420 by maintainer decision, because native proof cannot run on the integration host.