Skip to content

streaming: aborted cross-provider responses and ensemble streams report status 200 instead of 499 #1004

Closed

Description

@moonming

Two streaming paths report status_code: 200 on usage events for streams the client aborted mid-flight, where the equivalent single-model chat path correctly reports 499 (CLIENT_CLOSED_REQUEST). Both predate the trace-foundation work (verified present at 4a98a83); surfaced during an independent audit of the OTLP trace PR.

Path 1 — cross-provider /v1/responses streaming: the stream guard tracks reached_end, but the status choice only consults guardrail_blocked (422 vs 200), ignoring reached_end == false. An aborted stream therefore emits a terminal usage event with status_code: 200.

Path 2 — streaming ensemble: the judge-stream completion path hardcodes 200 regardless of whether the synthesized answer's stream reached EOF.

Impact: per-status telemetry (usage rows, http.response.status_code on exported spans, status-labelled Prometheus counters) counts aborted streams as successes on these two paths, inconsistent with the single-model chat path.

Expected precedence, matching the chat stream guard: !reached_end → 499; guardrail block → 422; otherwise 200. Worth a paced-stream abort e2e per path when fixing — the existing suites only drain streams to EOF.

Activity

  1. coderabbitai commented on Aug 20, 2026

    @coderabbitai
    🔗 Related PRs

    #794 - feat(usage): estimate tokens locally when the upstream reports no usage [merged]
    #807 - fix(routing): honour routing.retries on the streaming chat path [merged]
    #842 - feat(telemetry): split upstream and downstream latency on UsageEvent [merged]
    #882 - feat(routing): mid-stream fallback — resume a committed stream on fallback targets [merged]
    #893 - feat(proxy): mid-stream fallback for /v1/messages — both dispatch legs [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added a commit that references this issue on Sep 23, 2026
    e97c801
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

    P2Long-tail integrations — backlogbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions