Repository navigation
Description
Summary
The recorder treats a successful non-streamed OpenAI Responses API reply (POST /v1/responses, stream: false, HTTP 200) as an unknown format. In record mode it saves the reply as an error fixture. Replaying that fixture returns proxy_error for a request that succeeded upstream.
Where
src/recorder.ts, in buildFixtureResponse:
- The
Array.isArray(obj.output)branch only recognizes a Responses body when it carries native citation metadata. The comment says: "an uncited body … keeps the error fallback below, as before citations." - Every other Responses body falls through to the final fallback, which logs
Could not detect response format from upstream (status=200) — saving as error fixtureand returns{ error: { message: "Could not detect response format from upstream", type: "proxy_error" }, status }.
Observed
Seen on 2026-11-11 in the showcase prod aimock, which runs --proxy-only --fixtures /fixtures. The showcase openai-agents-python subagents demo calls Runner.run (non-streamed), and that produced three warnings like this one:
[aimock] Could not detect response format from upstream (status=200) — saving as error fixture; top-level keys: [id, object, created_at, status, access_programs, background, billing, completed_at, err…
The user-visible result was correct, because proxy-only mode passes the upstream body through and returns { kind: "skipped" } before persisting anything (around recorder.ts:358). So:
- proxy-only: no fixture is written. The warning is misleading noise and says "saving" when nothing is saved.
- record mode (
--record): a real error fixture is written for a successful turn. A later replay, such as a recorded D5/D6 suite, fails withproxy_errorinstead of replaying the model's reply.
Expected
- A non-streamed Responses body with
object: "response"and anoutputarray is collapsed into a normal fixture, with text, tool calls and reasoning where present, whether or not it has citations. The streamed recorder already handles the same turn. - An unknown 2xx body should not become an error fixture. Possible alternatives: skip it, or save it as raw
jsonwith a warning. - In proxy-only mode, the warning should not say "saving as error fixture".
Repro sketch
aimock --record --provider-openai https://api.openai.comPOST /v1/responseswith{"model": "<any>", "input": "Say hi", "stream": false}, which returns 200 upstream.- The recorded fixture contains
error.type = "proxy_error". Replaying the same request returns that error instead of the reply.
Context
Found during the showcase openai-agents-python live-provider check. Agents SDK sub-agent tools and other non-streamed Runner.run calls hit this path routinely.
🤖 Generated with Claude Code
Activity
docs(changelog): note CopilotKit#615 fix