fix: scope gpt-5.4-mini chat reasoning_effort fallback#76727
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-level reproduction is high confidence: current main can build a gpt-5.4-mini Chat Completions payload with tools and reasoning_effort, matching the OpenAI 400 reported in #76176 and the PR's live matrix. Next step before merge Security Review detailsBest possible solution: Land the scoped transport-level omission after required CI and maintainer review, keeping reasoning metadata available for Responses and tool-free Chat Completions. Do we have a high-confidence way to reproduce the issue? Yes, source-level reproduction is high confidence: current main can build a gpt-5.4-mini Chat Completions payload with tools and reasoning_effort, matching the OpenAI 400 reported in #76176 and the PR's live matrix. Is this the best way to solve the issue? Yes, the latest diff is the narrow maintainable fix: suppress only the rejected Chat Completions + function-tools combination while preserving Responses and tool-free Chat reasoning behavior. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 935f078a89f0. |
2cd1c86 to
c1deafa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1deaface2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (api === "openai-responses" || api === "openai-codex-responses") { | ||
| if (/^gpt-5\.4-mini(?:-|$)/u.test(id)) { | ||
| return GPT_52_REASONING_EFFORTS; | ||
| } | ||
| } else if (/^gpt-5\.4-mini(?:-|$)/u.test(id)) { | ||
| return []; |
There was a problem hiding this comment.
Restrict gpt-5.4-mini suppression to chat completions
The new else if branch returns [] for gpt-5.4-mini on every API value except openai-responses/openai-codex-responses, which unintentionally disables reasoning for other Responses surfaces (notably azure-openai-responses used by the Responses transport path) that previously inherited GPT_52_REASONING_EFFORTS. This means Azure/OpenAI Responses requests can now silently lose reasoning effort after this commit; the suppression should be scoped to chat-completions APIs only (for example openai-completions) rather than all non-responses API strings.
Useful? React with 👍 / 👎.
|
Landed via squash merge onto main.
Thanks @ThisIsAdilah and @chinar-amrutkar. |
Fixes openclaw#76176. OpenAI live verification showed `gpt-5.4-mini` supports reasoning effort generally, but rejects `/v1/chat/completions` payloads that combine function tools with `reasoning_effort`. This keeps reasoning effort for tool-free Chat Completions and Responses, and omits it only for the rejected Chat Completions + function tools combination. Validation: - Live OpenAI API matrix on 2026-05-03 - pnpm test src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.test.ts -- --reporter=verbose - GitHub PR CI green on ea39153 Thanks @ThisIsAdilah and @chinar-amrutkar.
Fixes openclaw#76176. OpenAI live verification showed `gpt-5.4-mini` supports reasoning effort generally, but rejects `/v1/chat/completions` payloads that combine function tools with `reasoning_effort`. This keeps reasoning effort for tool-free Chat Completions and Responses, and omits it only for the rejected Chat Completions + function tools combination. Validation: - Live OpenAI API matrix on 2026-05-03 - pnpm test src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.test.ts -- --reporter=verbose - GitHub PR CI green on ea39153 Thanks @ThisIsAdilah and @chinar-amrutkar.
Fixes openclaw#76176. OpenAI live verification showed `gpt-5.4-mini` supports reasoning effort generally, but rejects `/v1/chat/completions` payloads that combine function tools with `reasoning_effort`. This keeps reasoning effort for tool-free Chat Completions and Responses, and omits it only for the rejected Chat Completions + function tools combination. Validation: - Live OpenAI API matrix on 2026-05-03 - pnpm test src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.test.ts -- --reporter=verbose - GitHub PR CI green on ea39153 Thanks @ThisIsAdilah and @chinar-amrutkar.
Fixes openclaw#76176. OpenAI live verification showed `gpt-5.4-mini` supports reasoning effort generally, but rejects `/v1/chat/completions` payloads that combine function tools with `reasoning_effort`. This keeps reasoning effort for tool-free Chat Completions and Responses, and omits it only for the rejected Chat Completions + function tools combination. Validation: - Live OpenAI API matrix on 2026-05-03 - pnpm test src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.test.ts -- --reporter=verbose - GitHub PR CI green on ea39153 Thanks @ThisIsAdilah and @chinar-amrutkar.
Fixes openclaw#76176. OpenAI live verification showed `gpt-5.4-mini` supports reasoning effort generally, but rejects `/v1/chat/completions` payloads that combine function tools with `reasoning_effort`. This keeps reasoning effort for tool-free Chat Completions and Responses, and omits it only for the rejected Chat Completions + function tools combination. Validation: - Live OpenAI API matrix on 2026-05-03 - pnpm test src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.test.ts -- --reporter=verbose - GitHub PR CI green on ea39153 Thanks @ThisIsAdilah and @chinar-amrutkar.
Summary
Fixes #76176 by handling a narrow OpenAI API incompatibility for
gpt-5.4-minion/v1/chat/completions.gpt-5.4-minidoes support reasoning effort. The failing case is specifically Chat Completions requests that include both function tools andreasoning_effort. OpenAI rejects that combination, which made Telegram-routed fallback runs fail before producing a reply.Live Verification
Verified against the OpenAI API on 2026-05-03:
reasoning_effortreasoning_effortparam=reasoning_effortreasoning_effort, no toolsreasoning.effortThe OpenAI error for the rejected case says function tools with
reasoning_effortare not supported forgpt-5.4-miniin/v1/chat/completionsand recommends using/v1/responses.Root Cause
OpenClaw treated model-level reasoning support as sufficient to always emit Chat Completions
reasoning_effort. That is correct for tool-freegpt-5.4-miniChat Completions and for Responses, but not for Chat Completions payloads with function tools.What Changed
gpt-5.4-minireasoning-effort support in the model metadata.reasoning_efforton tool-freegpt-5.4-miniChat Completions payloads.reasoning.effortongpt-5.4-miniResponses payloads.reasoning_effortonly when a native OpenAI Chat Completions payload forgpt-5.4-miniincludes function tools.Scope
OpenAI Chat Completions payload compatibility only. No Telegram transport behavior, model fallback policy, provider routing, auth, credentials, or Responses behavior changes.
Test Plan
pnpm exec oxfmt --write --threads=1 src/agents/openai-reasoning-effort.ts src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.ts src/agents/openai-transport-stream.test.ts CHANGELOG.mdpnpm test src/agents/openai-reasoning-effort.test.ts src/agents/openai-transport-stream.test.ts -- --reporter=verboseea3915308c3c12bb6e71cdb5f13471ec0eb5ba53Replacement
Replaces the OpenAI-only portion of closed bundled PR #76326.