Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWalkthrough
Merge Risk:
|
|
✅ Deterministic PR hygiene checks passed. |
|
No description provided. |
…allback Integrate current dev, preserve MCP selector ownership, carry local refusal identity through lifetime wrappers, and add direct-route and policy fallback regressions. Prepared from the verified tree of local commit 886f63996dd96b1f90bcf77c0a246a2e17c300df; the tree is identical.
| assertPolicyNormalizedRoute(policyScope, admittedPolicyRoute, route); | ||
| if (route.provider.adapter === "openai-chat" | ||
| && !chatCanPreserveMandatoryToolChoice(parsed._rawBody, route.provider, route.modelId)) { | ||
| if (policyScope.eligibility) throw new PolicyCandidateUnavailableError(); |
There was a problem hiding this comment.
🟡 Single-candidate policy returns an internal 409 for an invalid tool choice
When a policy has only an incompatible Chat candidate, this branch returns a marked 409. With no fallback candidate, the client receives policy_candidate_unavailable instead of a tool-choice 400.
Learn more
A policy candidate refusal is an in-process marker used to authorize the next policy attempt. handleResponsesWithPolicyFallback returns the original response when no further eligible candidate exists. Thus a policy with one Chat candidate exposes the internal 409, while a direct route reports a client-facing 400 for the same mandatory choice.
Example: A profile containing only chat/model receives tool_choice: {"type":"computer_use"}. No request is sent, but the client receives 409 policy_candidate_unavailable rather than 400 invalid_request_error explaining the incompatible choice.
Recommended fix: Preserve a client-facing tool-choice refusal for exhaustion in handleResponsesWithPolicyFallback, while retaining the local marker to authorize hops. Distinguish this new refusal from other existing policy candidate failures so their behavior does not change.
Was this helpful? React with 👍 or 👎 to provide feedback.
Transferred upstream
The completed fix and regression coverage continue in lidge-jun/opencodex#8146, targeting
dev, from this same branch atfdda6036e62c7ef2508ffad3a713b02997374dea. The upstream PR is ready for review and contains the current validation results and resolved source-review findings. This fork-local PR is closed as transferred; the branch remains the upstream PR's source.Motivation
tool_choice:{"type":"computer_use"}accepted by validation could be translated toautoon a direct Responses→Chat route and thereby leak other declared client-executed tools.Description
src/server/responses/request-prepare.tsthat callschatCanPreserveMandatoryToolChoiceand returns a400error when a translated OpenAI Chat destination cannot preserve a mandatory hosted selector../combo-required-tool-contractand run the check afterapplyFinalRouteRequestNormalization.tests/responses/responses-direct-chat-tool-choice.test.tsthat exercises acomputer_useselector alongside a clientfunctiontool and asserts the request is rejected and no upstream send occurs.scripts/test-layout/layout.jsonandtests/fixtures/test-layout-expected.json).Testing
node_modules/.bin/bun test tests/responses/responses-direct-chat-tool-choice.test.ts tests/server/server-combo-required-tool-contract.test.tsand observed all tests passed (121 passed, 0 failed).node_modules/.bin/bun run typecheckwith no type errors.node_modules/.bin/bun test tests/test-layout.test.ts tests/test-layout-tooling.test.tsand observed those tooling tests passed.node_modules/.bin/bun run structure:checkandstructureSSOT checks passed.node_modules/.bin/bun run test:changedwas not runnable in this checkout because no upstreamdevcomparison ref was available.Codex Task
Summary by CodeRabbit