Skip to content

feat: make ToolExecutor an async trait#22560

Merged
jif-oai merged 2 commits into
mainfrom
jif/async-tr
May 14, 2026
Merged

feat: make ToolExecutor an async trait#22560
jif-oai merged 2 commits into
mainfrom
jif/async-tr

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 13, 2026

Why

codex_tools::ToolExecutor keeps a tool spec attached to its runtime handler, but extension tools still carried a parallel ExtensionToolFuture / ExtensionToolExecutor shape. That made extension-owned tools look different from host tools even though routing, registration, and execution need the same abstraction.

This PR makes the shared executor contract directly async and lets extension tools implement it too, so host tools and extension tools can move through the same registration path.

What changed

  • Changed ToolExecutor::handle to an async fn using async-trait, and updated built-in tool handlers to implement the async trait directly.
  • Replaced the bespoke ExtensionToolFuture contract with a marker ExtensionToolExecutor over ToolExecutor<ToolCall, Output = JsonToolOutput>, re-exporting ToolExecutor from codex-extension-api.
  • Updated the memories extension tools to implement the shared executor trait.
  • Split tool-router construction into collected executors plus hosted model specs, keeping hosted tools like web search and image generation separate from executable handlers.
  • Updated spec/router tests and extension-tool stubs for the new executor shape.

Verification

  • Not run locally.

@jif-oai jif-oai requested a review from a team as a code owner May 13, 2026 22:38
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 13, 2026

@codex review

@jif-oai jif-oai changed the title feat: make tool executor an async trait feat: make ToolExecutor an async trait May 13, 2026
Copy link
Copy Markdown
Contributor

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

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: a5c6c5b5b3

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

Comment thread codex-rs/ext/extension-api/src/contributors/tools.rs
@jif-oai jif-oai merged commit 6d65686 into main May 14, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/async-tr branch May 14, 2026 09:24
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant