Skip to content

ui-server: decide whether budget coverage names external compute #3349

Open

Description

@schlessera

Context

Found while delivering #3108 (epic #3103). Hosted compute reservations count in every turn, session and day budget scope (ComputeTotals and computeTotals, packages/ui-server/src/brain/turn-budgets.ts on the epic branch). The budget coverage text, however, is a closed enum on the wire: TURN_BUDGET_COVERAGE (packages/ui-server/src/brain/turn-budgets.ts:51) is validated by z.enum([...]) in packages/ui-sdk/src/schemas.ts:1034 and typed in packages/ui-sdk/src/turn-budgets.ts:23-25. It was left unchanged so older clients keep parsing it (docs/decisions/external-compute.md:665-666). As a result, users are told "other provider and tool spend is not metered" while compute spend is in fact counted.

Precedent: #1673 (0.44.0) changed this text by adding a second literal that new receipts carry, while stored receipts keep the old one and the schema accepts both (docs/integration-contract/wire.md:145-151). Hosted compute already gates its Activity runs behind a client capability (ACTIVITY_COMPUTE_CAPABILITY, packages/ui-sdk/src/protocol.ts:102).

Source pointers are on epic/3103-external-compute at 18d859421; the hosted compute code reaches main with #3404.

Decision (maintainer, 2026-11-03)

B. New literal behind a client capability. A new coverage literal names hosted compute. It is sent only to clients that declare a new capability in client_hello; every other client keeps receiving today's bytes unchanged.

Rejected: A (new literal for all clients) and C (keep the text).

Scope

  • Add the compute-naming coverage literal in turn-budgets.ts, the ui-sdk schema (accepting all literals) and type.
  • Add a client capability, declared in client_hello, and declare it from the first-party client.
  • Send the new literal only to sessions whose client declared the capability; others get today's literal.
  • Update the wire contract docs and the external compute ADR note on coverage text.

Out of scope

Acceptance criteria

  • A client that declares the capability receives the compute-naming coverage literal on new receipts when compute counts in the scope.
  • A client that does not declare the capability receives today's coverage text byte-identical, proven by a test.
  • Sessions that already received the earlier coverage text keep it byte-identical in provider history (docs/decisions/provider-history.md).
  • The ui-sdk schema accepts all coverage literals; schema tests and a contract test of the receipt's coverage updated.
  • docs/integration-contract/wire.md documents the capability and the new literal; the ADR's coverage note (docs/decisions/external-compute.md) is updated to match.

Verification

Keyless unit and contract tests through bun run test; a mutation that sends the new literal to a client without the capability fails a named test. Run the provider-history keyless guard if any turn-path code changes.

Contract impact

Additive wire change: a new capability and a new coverage literal visible only to clients that opt in. CONTRACT: commit, docs/integration-contract/wire.md, changeset.

Triage 2026-11-03: folded the maintainer ruling (B: compute coverage literal gated behind a client capability).

Activity

  1. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 2, 2026
  2. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03: set needs: decision. The acceptance criteria left a wire-contract choice to the implementer. The body now gives options A (new literal for all clients, as #1673 did), B (new literal behind a client capability, recommended) and C (keep the text and record why). Attached to #3103.

  3. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    and removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): B — a new coverage literal naming hosted compute, sent only to clients that declare a new capability; every other client keeps today's bytes. The body now specifies option B (capability in client_hello, first-party client declares it, schema accepts all literals, wire docs and ADR note updated); A and C are rejected. Removed needs: decision; agent-ready.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: featA new capability or a change in user-visible behaviour.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions