Skip to content

Refactor extension tools onto shared ToolExecutor#22369

Merged
jif-oai merged 1 commit into
mainfrom
jif/tool-extension
May 13, 2026
Merged

Refactor extension tools onto shared ToolExecutor#22369
jif-oai merged 1 commit into
mainfrom
jif/tool-extension

Conversation

@jif-oai

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

Copy link
Copy Markdown
Collaborator

Why

Extension tools were split across two public runtime contracts: codex-tool-api exposed ToolBundle plus its own call/spec/error types, while core native tools used codex_tools::ToolExecutor. That made contributed tool specs and execution behavior easy to drift apart and added another crate boundary for what should be one executable-tool seam.

This PR makes ToolExecutor the single runtime contract and keeps extension-specific pinning in codex-extension-api.

Remaining todo

https://github.com/openai/codex/pull/22369/changes#diff-b935ea8245c3ce568a30cff660175fa6390b66b872ae409e1e2e965738250741R5
Either generic Invocation or sub-extract the ToolCall and clean ToolInvocation

What changed

  • Removed the codex-tool-api workspace crate and its dependencies from core and codex-extension-api.
  • Made codex_tools::ToolExecutor object-safe with async_trait so extension contributors can return a dyn executor.
  • Added the extension-facing aliases under ext/extension-api/src/contributors/tools.rs, including ExtensionToolExecutor = dyn ToolExecutor<ToolCall, Output = ExtensionToolOutput>.
  • Changed ToolContributor::tools to return extension executors directly instead of ToolBundles.
  • Updated core’s extension tool handler/registry/router path to adapt those extension executors into the existing native ToolInvocation runtime path.
  • Added focused coverage for extension tools being registered, model-visible, dispatchable, and not replacing built-in tools.

Verification

  • cargo test -p codex-tools
  • cargo test -p codex-extension-api

@jif-oai jif-oai requested a review from a team as a code owner May 12, 2026 19:24
@jif-oai jif-oai changed the title feat: extension tools Refactor extension tools onto shared ToolExecutor May 12, 2026
@jif-oai

jif-oai commented May 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99b484f64e

ℹ️ 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/core/src/tools/handlers/extension_tools.rs Outdated
Comment thread codex-rs/tools/src/tool_executor.rs Outdated
Base automatically changed from jif/tool-runtime-trait to main May 13, 2026 09:31
@jif-oai jif-oai force-pushed the jif/tool-extension branch from 99b484f to 6d933cc Compare May 13, 2026 09:50
@jif-oai

jif-oai commented May 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@jif-oai jif-oai force-pushed the jif/tool-extension branch from 6d933cc to 3b880a5 Compare May 13, 2026 09:53

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d933cc7b9

ℹ️ 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/core/src/tools/handlers/extension_tools.rs
@jif-oai jif-oai force-pushed the jif/tool-extension branch from 3b880a5 to 78786f2 Compare May 13, 2026 09:57
@jif-oai

jif-oai commented May 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78786f204b

ℹ️ 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/core/src/tools/registry.rs
@jif-oai jif-oai merged commit 9c5dfa7 into main May 13, 2026
29 of 30 checks passed
@jif-oai jif-oai deleted the jif/tool-extension branch May 13, 2026 10:12
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 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.

2 participants