Skip to content

Move tool search metadata onto ToolExecutor#25684

Merged
jif-oai merged 2 commits into
mainfrom
jif/search-info
Jun 1, 2026
Merged

Move tool search metadata onto ToolExecutor#25684
jif-oai merged 2 commits into
mainfrom
jif/search-info

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented Jun 1, 2026

Deferred tools need to be searchable even when they are not implemented inside codex-core. Extension-provided tools can be registered for later discovery, but the search metadata path was still owned by core-specific runtime hooks, which meant the shared ToolExecutor abstraction could not describe how a deferred extension tool should appear in tool_search.

Changes

  • Move ToolSearchEntry and ToolSearchInfo into codex-tools and re-export them from the shared tools crate.
  • Add a default ToolExecutor::search_info implementation that derives loadable tool-search metadata from function and namespace specs.
  • Forward search metadata through extension adapters and exposure overrides while keeping custom search text/source metadata for dynamic, MCP, and multi-agent tools.
  • Remove the old core-local tool_search_entry module now that search metadata lives with the shared executor APIs.

Testing

  • Added deferred_extension_tools_are_discoverable_with_tool_search coverage in core/src/tools/spec_plan_tests.rs.

@jif-oai jif-oai requested a review from a team as a code owner June 1, 2026 20:28
@jif-oai jif-oai changed the title feat: search info in ToolExecutor Move tool search metadata onto ToolExecutor Jun 1, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented Jun 1, 2026

@codex review

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

ℹ️ 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
Comment on lines +38 to +41
ToolSpec::Function(mut tool) => {
tool.defer_loading = Some(true);
tool.output_schema = None;
LoadableToolSpec::Function(tool)
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.

P2 Badge Preserve namespaces for default deferred function specs

For deferred extension executors whose tool_name() is namespaced but whose spec() is a single ToolSpec::Function, the default metadata path returns that function as a top-level loadable tool. After tool_search exposes it, the model will call the plain function name, but the registry registered the executor under the namespaced ToolName, so dispatch cannot find the tool. Either wrap function specs in the executor's namespace here or decline the default when tool_name.namespace and the spec shape do not match.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

those functions can't exist

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

TODO @jif ADD A TEST

Comment thread codex-rs/tools/src/tool_executor.rs Outdated
@jif-oai jif-oai merged commit 8d720fe into main Jun 1, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/search-info branch June 1, 2026 22:24
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 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