Every turn fails on a native Codex (ChatGPT OAuth) model when Langfuse tracing is on.
graph/middleware/trace_context.py TraceContextMiddleware._with_trace stamps Langfuse trace context into extra_body["metadata"] on any model client that has an extra_body attribute (since #1880, v0.96.0). That's right for the LiteLLM gateway, which reads metadata for trace correlation — but the native Codex client (CodexChatOpenAI) also has extra_body, and the OpenAI SDK merges it into the Responses request to https://chatgpt.com/backend-api/codex/responses, which rejects it:
Error code: 400 - {'detail': 'Unsupported parameter: metadata'}
Found by a live smoke of the dev instance (default model openai-codex:gpt-5.6-sol, LANGFUSE_* set): every A2A, /v1, /api/chat, subagent and aside turn on that model failed. Only affects clients that don't talk to the LiteLLM gateway.
Fix: stamp the metadata only when the client targets the gateway (or: never for native OAuth clients — Codex, and check the native Anthropic/Claude OAuth client too). Tests: native Codex client → request body has no metadata; gateway client → still stamped.
Every turn fails on a native Codex (ChatGPT OAuth) model when Langfuse tracing is on.
graph/middleware/trace_context.pyTraceContextMiddleware._with_tracestamps Langfuse trace context intoextra_body["metadata"]on any model client that has anextra_bodyattribute (since #1880, v0.96.0). That's right for the LiteLLM gateway, which readsmetadatafor trace correlation — but the native Codex client (CodexChatOpenAI) also hasextra_body, and the OpenAI SDK merges it into the Responses request tohttps://chatgpt.com/backend-api/codex/responses, which rejects it:Found by a live smoke of the dev instance (default model
openai-codex:gpt-5.6-sol,LANGFUSE_*set): every A2A,/v1,/api/chat, subagent and aside turn on that model failed. Only affects clients that don't talk to the LiteLLM gateway.Fix: stamp the metadata only when the client targets the gateway (or: never for native OAuth clients — Codex, and check the native Anthropic/Claude OAuth client too). Tests: native Codex client → request body has no
metadata; gateway client → still stamped.