Repository navigation
Description
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
- Changing how compute reservations are counted in scopes.
- Rewriting coverage text in any receipt already stored or already sent.
- The Activity rollup grouping (ui-server: keep hosted compute runs out of scheduled-job Activity rollups #3350).
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
coverageupdated. -
docs/integration-contract/wire.mddocuments 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
schlessera commentedon Nov 3, 2026
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.schlessera commentedon Nov 3, 2026
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. Removedneeds: decision;agent-ready.