Skip to content

ui-sdk: the inference relay omits firstChunkMs on a first-chunk budget refusal and observes usage with no operation #4438

Open

Description

@schlessera

Part of #4426 (follow-ups from #4278). Found in the review of PR #4435, which merged main's metered relay reader into the epic's relay clocks.

Context

  • readRelayResponse.read() charges the chunk and throws on refusal (packages/ui-sdk/src/server/relay-response.ts:39-45). The mark at packages/ui-sdk/src/server/inference-relay.ts:256 therefore never runs for a first read that resolved but was refused. docs/integration-contract/http.md:635 defines firstChunkMs as "first upstream read resolved, including EOF".
  • The usage observer at inference-relay.ts:249 is created even when there is no egress operation, and its result is discarded.

Scope

The relay's first-read mark and the observer guard. No field or shape change.

Acceptance criteria

  • A first chunk that exceeds the remaining budget records the budget refusal and firstChunkMs.
  • An upstream read that rejects still leaves firstChunkMs absent, and the mark is attempted once.
  • A relay without an egress operation creates no usage observer and schedules no parsing.
  • Each test is shown failing with its guard removed.

Activity

  1. added
    type: fix
    area: ui-sdk
    priority: p3
    agent-ready
    on Nov 21, 2026
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-readyarea: ui-sdkpriority: p3type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions