Repository navigation
Description
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, maindccfec44) converts any parsed body into a chat completion:extractResponsesOutput(:1178) reads onlyoutput, andfinishReasonFromResponses(:1198-1206) checks only tool calls andincomplete+max_output_tokens.status: "failed"andrespBody.errorare 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), anderrorevents likewise (:1306-1308). The two doors disagree about the same upstream outcome. - An
incompletebody whose reason is notmax_output_tokens(e.g.content_filter) also falls through tofinish_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, contentHello 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, contenthalf 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, contentpartial,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 upstreamerror.message, with a non-200 status or the door's established error shape) instead of a 200 completion withfinish_reason: "stop"— whether or not partial output is present. - A body with
status: "incomplete"and a reason other thanmax_output_tokensdoes not reportfinish_reason: "stop"(mapped distinctly or surfaced as an error — triage pins which). -
status: "completed"andincomplete+max_output_tokens→lengthbehavior 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
- Searched open+closed for the direct translator /
responsesToChatCompletion/incomplete_details: no filing covers it. muse-proxy: direct mode — exchange the Muse CLI account token for the minted plan key and forward chat completions verbatim #2753 (CLOSED) is the direct-mode feature itself. - muse-proxy: a run that fails after producing partial output is reported as a successful 'stop' — failure is masked whenever any content exists #672/codex-proxy: a failed codex run is reported as a successful 'stop' — close handler ignores exit code and signal in both modes #676/agy-proxy: failed agy run reported as successful 'stop' — stream handler never checks the exit code, non-stream masks failure when partial output exists #678 (CLOSED) are the same masking pattern on the exec/other-proxy doors, not this translator. muse-proxy(direct): the shell/bash alias inverse is unconditional — a genuine run_command/terminal tool's calls are renamed to shell/bash on the way back, and declaring both names collapses them #2770 (OPEN) is the direct path's tool-name alias inverse — different mechanism, same file. muse-proxy: exec fallback path has no turn deadline — a hung muse exec child hangs the request forever #2159 (OPEN) is the exec door's missing turn deadline.
Activity
dezren39 commentedon Oct 30, 2026
🤖 Agent note · filed
failedbody (empty or partial output) is returned as HTTP 200 with finish_reason "stop", and a non-tokenincompletereason also reads as "stop".60 remaining items
dezren39 commentedon Nov 2, 2026
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.
dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up
Merge pull request #4470 from developing-today/queue/5434-2780-failed…
dezren39 commentedon Nov 2, 2026
🤖 Agent note · done
finish_reason: "stop"completion;incomplete+max_output_tokensstill returns 200 withfinish_reason: "length", and completed behavior is unchanged.node --test bin/muse-proxy.test.mjsrerun on the laptop at PR head b15c489 — 37/37 pass including the new 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 regression test; PR check (basic guard) pass; Codex review completed with no findings; PR MERGEABLE.