Skip to content

ui-server: a turn's lifecycle record does not say which build ran it #4283

Closed

Description

@schlessera

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-server package 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-template is 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 lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: 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

  1. added
    type: feat
    area: ui-server
    on Nov 20, 2026
  2. added
    priority: p2
    contract
    area: ui-sdk
    agent-ready
    on Nov 20, 2026
  3. self-assigned this
    on Nov 20, 2026
  4. schlessera commented on Nov 20, 2026

    @schlessera
    OwnerAuthor

    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.

  5. added this to the 0.45.0 milestone on Nov 21, 2026
  6. schlessera commented on Nov 23, 2026

    @schlessera
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-sdkarea: ui-servercontractpriority: p2type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions