Repository navigation
Add per-turn model selection to Runner - #6207
markstuart-oai merged 3 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Request changes for the missing release-contract policy entry described inline. The hosted prospective-release-contract job confirms that the new ModelSelector export prevents contract promotion.
Reviewed model selection, provider-route identity, fixed-model bypass, implicit settings, retry stability, handoffs/approval recovery, sandbox restrictions and redaction, with an independent second review. No additional actionable functional findings.
Hosted CI: 7 passed, 3 skipped, 13 running and 1 failed. Pending checks remain tracked. Static review only; no candidate code or local tests executed.
Additional independently verified blocker: #6207 (comment). My initial functional review missed that output-guardrail/server-history validation resolves the configured adapter, while dispatch uses the selected adapter. A same-provider selector can change Chat Completions to Responses after the former receives an exemption, allowing rejected output to enter server-managed history. Validate the actual resolved adapter before dispatch in both streaming and buffered paths, without calling the selector twice. Referencing the existing finding rather than duplicating inline feedback. Static inspection only.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 797cc542af
ℹ️ 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".
There was a problem hiding this comment.
Re-reviewed all seven changed files at 4d93a4a with an independent second static review. Both prior blockers are addressed: actual resolved adapters now receive server-history/output-guardrail validation in streaming and buffered paths before dispatch, without re-invoking the selector; ModelSelector is registered in the release policy with narrowly supported Awaitable serialization and an exact contract-shape assertion. Nested MultiProvider routing now checks the leaf provider while preserving aliases to the same provider. No additional actionable findings.
Fresh hosted CI remains in progress (latest inspected snapshot: 1 passed, 16 running); this approval does not claim CI completion. Static review only; no local code or tests executed.
Hosted CI update (2026-11-24 07:42 UTC): 33 passed, 2 skipped; no checks remain pending in the current rollup. Approval is unchanged. No local tests were run.
There was a problem hiding this comment.
Approved after static re-review of the base merge and an independent review. All 14 feature patches preserve the prior approved additions/deletions. Checked integration with final-output feedback, tool-result transforms, native MCP exports and the updated RunConfig: model selection remains per request, retries reuse the selection, actual-adapter guardrail validation occurs before dispatch, and native approval recovery retains its selected model. Existing alias-contract and guardrail findings remain addressed; no actionable regression found.
Hosted CI at review: 9 passed and 15 running, with no reported failures. Pending checks remain tracked. No candidate code or local tests executed.
CI follow-up (2026-11-24 19:00 UTC): all hosted checks for the reviewed commit are terminal: 33 succeeded and 2 were skipped, with no failures. This includes the completed Codex preview-wheel verification. The PR merged at the reviewed commit. No local tests were run.
Why
When an agent starts running tests, the app doesn't know whether they'll fail. It should be able to use its usual model for routine work and switch after a failure without losing the test result.
Summary
RunConfig.model_selectorlets Runner choose a model for each new request, including after tools and handoffs. The test tool sets the run context'sfailedflag. The selector returnsreview_model.Pass
run_config={"model_selector": select_model}to Runner. ReturningNoneuses the agent's configured model. See the complete example.Awaited and streamed runs select within one provider. Retries reuse the choice. Fixed overrides bypass selection. Sandbox agents need a fixed model. The selector runs once per Runner request, never for internal Codex model calls. A native child may use its own model.
Parent branch
feat/simple-codex.Test plan
Tests passed for tools, handoffs, retries, provider restrictions, guardrails and Codex approval recovery in both Runner modes.
Issue number
None.
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR