fix(ai): recover Codex SSE tool-choice rejections - #3699
Conversation
8245006 to
1c81b55
Compare
|
Signed: Yeachan-Heo / gajae-code AI-provider red-team VERDICT: DEFERRED — exact-head review not admitted. The exact PR head is still current at Per batch policy, no hostile implementation review or approval is attached while the exact head is stale/incompatible with current dev. Rebase onto current dev, rerun exact-head CI, and resubmit for independent review. No merge performed. |
Yeachan-Heo
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES
Reviewed exact head 1c81b55f26f8ec2a99f5c4065f5d55e6a4334cbe against current origin/dev c1bf3be50e2cf0dfdf51b57eb43f7a99521c94b8.
This PR is stale and must be rebased onto current dev before it can be merge-ready. The PR base is b40bc271502a0802e212e5538c5d0e8436643029, not the requested current baseline. I inspected packages/ai/src/utils/tool-choice-capability.ts:23-31 and the Codex SSE error conversion. The new match is constrained to a forced tool choice plus invalid_request_error and the existing tool-choice message predicate, while nonmatching codes and HTTP 500 remain excluded; no additional credential, fallback-loop, or output-leak blocker was found in this exact diff.
Focused verification at the exact head passed: bun test packages/ai/test/openai-codex-responses-tool-choice.test.ts packages/ai/test/tool-choice-capability.test.ts (44 pass). Rebase onto c1bf3be50e2cf0dfdf51b57eb43f7a99521c94b8, rerun the clean one-shot fallback and cancellation coverage, and do not merge this stale head.
—
[repo owner's gaebal-gajae (clawdbot) 🦞]
|
Exact-head maintainer follow-up completed against current I rebased and corrected the statusless SSE fallback so it is Codex-only and accepts only an exact named-function rejection when the rejected name matches the forced name and that name exists in the final serialized tools list. The shared HTTP-400 classifier remains unchanged. Added negative coverage for managed mode, abort/output, required mode, mismatched/missing names, and second rejection/no third request. Evidence at reviewed commit
I cannot push to the contributor fork ( Please update this PR head from that commit/branch (or explicitly authorize maintainer takeover and disposition of this PR). No duplicate PR has been opened. |
|
Census reassignment receipt: Codex SSE tool-choice transport batch reviewed for routing-contract overlap. Exact head: The changed files do not overlap MiniMax policy files, but this PR is not merge-ready: review changes are requested by Yeachan-Heo and its recorded base is stale relative to current — |
|
Current-dev refresh of the previously reviewed corrected candidate (contributor ownership preserved; no duplicate PR opened):
The dev advance since the earlier review overlaps only |
d63f5e4 to
17cba5e
Compare
Codex can reject a named tool choice through a statusless SSE error even when the final request contained that tool. Keep the fallback Codex-specific and retry only the clean exact-name failure once. Lore-id: 3669-sse-tool-choice Constraint: forced tool name must exist in final serialized tools Constraint: retry only before output and outside managed fallback Rejected: shared statusless classifier | broadens behavior across providers Confidence: high Scope-risk: narrow Reversibility: easy Tested: 47 focused tests, 269 assertions; packages/ai check
17cba5e to
988fa04
Compare
|
Exact current-dev corrected candidate refresh (contributor ownership preserved; no duplicate PR opened):
This candidate fixes the remaining pre-runtime hole: an initial HTTP named-tool rejection now transfers explicit downgrade state into the SSE runtime, so later same-turn provider retries cannot reintroduce Adoption still requires the contributor to update this PR from the published candidate or an explicit maintainer takeover decision. |
|
Exact current-dev update after the contributor rebased PR #3699:
The contributor rebase incorporates the earlier narrow classifier work but still lacks the 110-line final delta that separates provider/tool retry budgets and keeps both initial-HTTP and SSE downgrades sticky across later same-turn reopens. The published candidate contains those repairs and their three-request regressions. No duplicate PR was opened and contributor ownership remains intact. Adoption requires updating this PR from the published candidate or an explicit maintainer takeover decision. |
What
invalid_request_errorwhen its message is the existing exact named-tool-not-in-tools rejection.tool_choicebefore any output is emitted.Why
Fixes #3669.
The HTTP 400 form already uses the forced-tool-choice capability fallback, but the equivalent HTTP 200 SSE error carries a semantic provider code and no HTTP status. This remains a single contributor-authored commit rebased onto current
dev.Testing
bun test packages/ai/test/openai-codex-responses-tool-choice.test.ts packages/ai/test/tool-choice-capability.test.ts— 47 passed, 269 assertionsbunx biome check packages/ai/src/providers/openai-codex-responses.ts packages/ai/src/utils/tool-choice-capability.ts packages/ai/test/openai-codex-responses-tool-choice.test.ts packages/ai/test/tool-choice-capability.test.ts packages/ai/CHANGELOG.md— passedbun --cwd=packages/ai run check:types— passedgit diff --check upstream/dev...HEAD— passedGJC verdict
dev## [Unreleased]