Skip to content

Add model request preflight and explicit tool execution policies - #6212

Open
markstuart-oai wants to merge 5 commits into
markstuart/sdk-controls-05-budgets-delegationfrom
markstuart/sdk-controls-06-preflight-tool-ownership
Open

markstuart-oai wants to merge 5 commits into
markstuart/sdk-controls-05-budgets-delegationfrom
markstuart/sdk-controls-06-preflight-tool-ownership

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Why

An app switching from Responses to CodexProvider cannot continue using previous_response_id. Learning this before starting the run lets it supply conversation history instead of attempting a request that will fail.

Summary

Model.preflight() checks known request incompatibilities offline. Given a model from CodexProvider, this reports failed validation.

from agents import ModelRequest

report = model.preflight(
    ModelRequest(input="Continue", previous_response_id="previous")
)
print(report.static_validation, report.errors)

ToolExecutionConfig lets the app choose who runs workspace commands. The preflight report identifies who runs each tool, as shown in the complete example. Runner checks filtered requests automatically when model selection or an explicit execution policy is active. Preflight cannot confirm remote access or host permissions. SDK workspace execution does not prevent native child agents from making model calls. Requiring native approval recovery needs a provider-owned Codex workspace, ResumableSession and unset or "auto" tool choice.

Parent #6211.

Test plan

The offline snippet reported the expected incompatibility. Python and simulated Codex tests passed, including rejection before hooks and native startup in both Runner modes.

Issue number

None.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 24, 2026 07:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T08:20:51.221496Z 983358b New commits
🔒 Security Review ✅ Completed 2026-11-24T08:23:30.344402Z 983358b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes: the new preflight can accept an explicit native approval recovery requirement even though dispatch disables recovery for that request. See inline finding. Reviewed adapter validation, automatic preflight ordering, ownership declarations, workspace policy, input conversion, and tests.

Hosted CI at review: all 19 reported checks passed. Static review only; no candidate code or tests executed.

Comment thread src/agents/models/codex.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb76af0301

ℹ️ 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".

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prior native approval recovery finding is fixed: incompatible required-tool requests now fail before native startup, with both Runner modes covered.

Request changes remains necessary for the existing strict Chat reasoning-settings preflight finding, independently confirmed during re-review. Preflight omits the validation that _fetch_response performs for reasoning.mode/context in strict mode, so a selector can admit LLM-start hooks and RunControl submission before a deterministic rejection. Include equivalent validation in preflight while preserving legacy behavior. Linking the existing finding rather than duplicating it inline.

Reviewed the fix, inherited tool-identity changes, adapter paths, tests and existing feedback. Hosted CI at review: 16 passed, 2 skipped, 3 running. Static only; no candidate code or local tests executed.

Hosted CI update (2026-11-24 07:57 UTC): 19 passed, 4 skipped; no checks remain pending in the current rollup. The strict Chat preflight finding still requires changes. No local tests were run.

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after static re-review and an independent review. Strict Chat reasoning settings now use the dispatch validators during preflight, before hooks or receipt submission, while legacy warnings remain at dispatch. Reviewed shared argument construction and collision checks, omitted-argument overrides, static input conversion, and computer/web-tool handling without invoking caller callbacks or serializers. Tests cover both Runner modes, retained receipts, and strict/legacy behavior. The prior findings are addressed.

Hosted CI at review: {"SUCCESS":17,"IN_PROGRESS":2}. Pending checks remain under follow-up. No candidate code or local tests executed.

Hosted CI follow-up (2026-11-24 08:32 UTC): all checks at this reviewed commit are complete: 19 passed and 2 skipped, with no failures. The pending CI follow-up is resolved. No candidate code or local tests executed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants