Skip to content

muse-proxy(direct): a failed upstream Responses body is reported as a successful chat completion — non-streaming translator never checks status, partial output masks the failure #2780

Closed

Description

@dezren39

Problem

muse-proxy's direct (minted-key Responses) path reports a failed upstream generation as a successful chat completion on the non-streaming door. The Responses API signals generation failure in the response body (status: "failed" with an error object, HTTP 200) — the streaming translator handles the equivalent event, the non-streaming translator never looks at status at all.

  • responsesToChatCompletion (bin/muse-proxy.mjs:1225-1242, main dccfec44) converts any parsed body into a chat completion: extractResponsesOutput (:1178) reads only output, and finishReasonFromResponses (:1198-1206) checks only tool calls and incomplete + max_output_tokens. status: "failed" and respBody.error are never read.
  • The non-streaming branch of tryDirectChat (:1386-1391) writes the result as HTTP 200 unconditionally once the body parses.
  • The streaming translator in the same file does handle failure: response.failed → an SSE error frame (:1303-1305), and error events likewise (:1306-1308). The two doors disagree about the same upstream outcome.
  • An incomplete body whose reason is not max_output_tokens (e.g. content_filter) also falls through to finish_reason: "stop", presenting a truncated answer as complete.

Evidence (verified this run on main dccfec44)

Laptop probe at ~/git/fleet/probe-2026-10-30-laneB-directfailed/ running the real bin/muse-proxy.mjs (md5 86f6d34295ef7488760535e242f3f575, identical to main) against a stub Meta API (key exchange + /v1/responses) and stub auth, warm path off:

  • Control — upstream {status: "completed", output: [text "Hello direct"]} → HTTP 200, content Hello direct, finish_reason: "stop" ✓
  • Upstream {status: "failed", error: {code: "server_error", message: "upstream exploded"}, output: []} → HTTP 200, content "", finish_reason: "stop", no error anywhere — the upstream error message is dropped entirely.
  • Upstream {status: "failed", error: …, output: [text "half an answer"]} → HTTP 200, content half an answer, finish_reason: "stop" — the failure is masked whenever partial output exists.
  • Upstream {status: "incomplete", incomplete_details: {reason: "content_filter"}, output: [text "partial"]} → HTTP 200, content partial, finish_reason: "stop" — a filtered/truncated answer presented as complete.

Why it matters

Direct mode is the default door for the muse-direct provider seats (#2753, live since 2026-10-30). A client on the non-streaming door cannot distinguish "the model answered with empty text" from "the generation failed": it receives a well-formed successful completion, retries nothing, and logs nothing — the upstream error.message that would explain the failure is discarded. This is the same failure-masking shape the fleet already fixed on the exec door (#672) and the streaming door (#670), arriving with the new direct door's non-streaming half. Failure with partial output is the worst case: truncated text is consumed downstream as a complete answer.

Acceptance criteria

  • A non-streaming direct response whose body has status: "failed" surfaces an error to the chat client (an error body with the upstream error.message, with a non-200 status or the door's established error shape) instead of a 200 completion with finish_reason: "stop" — whether or not partial output is present.
  • A body with status: "incomplete" and a reason other than max_output_tokens does not report finish_reason: "stop" (mapped distinctly or surfaced as an error — triage pins which).
  • status: "completed" and incomplete + max_output_tokens → length behavior are unchanged.
  • Regression tests in bin/muse-proxy.test.mjs (stub Meta API pattern) pin the failed-empty, failed-partial, and incomplete-non-token cases, plus the completed control.

Dedup

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/muse-proxybin/muse-proxy.mjs OpenAI-compatible Muse bridge
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 30, 2026
  2. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane B, new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b · 2026-10-30 10:20 CDT run
    • Found via: filed this run
    • Task: Non-streaming direct translator never checks the Responses body's status — a failed body (empty or partial output) is returned as HTTP 200 with finish_reason "stop", and a non-token incomplete reason also reads as "stop".
    • Expectation: effort/xs — done when the acceptance criteria in the issue body are met (failed surfaces the upstream error; completed/length behavior unchanged; stub-Meta regression tests pin the cases).
    • Links: evidence in the issue body; probe on the laptop at ~/git/fleet/probe-2026-10-30-laneB-directfailed/ (real muse-proxy.mjs, md5-matched to main dccfec4)
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  4. 60 remaining items

  5. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 2, 2026
  6. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: parked
    task: 5434 (repo-health-code-pilot, repo-worker-code; openchamber-scheduled-lane 7b47536b)
    state: parked awaiting CI
    progress: Fix implemented on branch queue/5434-2780-failed-responses-status (worktree ~/git/fleet/5434): non-streaming direct path returns 500 for failed bodies (upstream message, partial output ignored) and for incomplete non-max_output_tokens (reason named); completed/max_output_tokens unchanged. Tests: stub-Meta failed-empty/failed-partial/incomplete-filter + incomplete-max control; full suite 37/37 pass locally.
    artifact: PR #4470
    resume: Check CI on #4470; merge under standing criteria (checks green, no held/Drew-owned restriction), then close #2780.

  7. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  8. added a commit that references this issue on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/muse-proxybin/muse-proxy.mjs OpenAI-compatible Muse bridgeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions