[codex] Move tool specs onto handlers#21461
Merged
Merged
Conversation
…ndler-kind # Conflicts: # codex-rs/core/src/tools/spec.rs # codex-rs/core/src/tools/spec_plan.rs # codex-rs/core/src/tools/spec_plan_tests.rs # codex-rs/core/src/tools/spec_plan_types.rs
…specs # Conflicts: # codex-rs/core/src/tools/registry.rs # codex-rs/core/src/tools/spec.rs # codex-rs/core/src/tools/spec_plan.rs # codex-rs/core/src/tools/spec_plan_tests.rs
jif-oai
approved these changes
May 7, 2026
| /// The concrete tool name handled by this handler instance. | ||
| fn tool_name(&self) -> ToolName; | ||
|
|
||
| fn spec(&self) -> Option<ToolSpec> { |
Collaborator
There was a problem hiding this comment.
Ofc I guess there won't be a default anymore in your final version
Collaborator
|
I focus on the registry as the rest seems mechanical and Codex didn't find anything |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This is the next stacked step after deleting the tool-handler kind indirection. Specs should come from the registered handlers themselves so registry construction has a single source of truth for handler behavior and exposed tool definitions.
What changed
ToolHandler::spec()plus handler-provided parallel/code-mode metadata, and madeToolRegistryBuilder::register_handlerautomatically collect specs from registered handlers._specmodules, including shell, unified exec, apply patch, view image, request plugin install, tool search, MCP resource, goals, planning, permissions, agent jobs, and multi-agent tools.CodeModeExecuteHandleron the explicit configured wrapper so the code-mode exec spec can still be built from the nested registry.Verification
cargo check -p codex-corecargo test -p codex-core tools::spec_plan::testscargo test -p codex-core tools::spec::testscargo test -p codex-core tools::handlers::multi_agents_spec::testsRUST_MIN_STACK=16777216 cargo test -p codex-core tools::handlers::multi_agents::testscargo test -p codex-core tools::handlers::apply_patch::testscargo test -p codex-core tools::handlers::unified_exec::testsjust fix -p codex-coregit diff --check