[codex] Split tool handlers by tool name#20687
Merged
pakrym-oai merged 6 commits intomainfrom May 5, 2026
Merged
Conversation
423e867 to
e422ce8
Compare
This was referenced May 2, 2026
jif-oai
reviewed
May 4, 2026
…dlers # Conflicts: # codex-rs/core/src/tools/handlers/list_dir.rs # codex-rs/core/src/tools/handlers/mcp_resource.rs # codex-rs/core/src/tools/handlers/mod.rs # codex-rs/core/src/tools/handlers/request_plugin_install.rs # codex-rs/core/src/tools/spec.rs # codex-rs/tools/src/tool_registry_plan_types.rs
…dlers # Conflicts: # codex-rs/core/src/tools/handlers/unified_exec.rs
jif-oai
approved these changes
May 5, 2026
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
Tool registration used to bind a tool name to a handler externally, which left ownership split between the registry plan and the handler implementation. Some built-in handlers also multiplexed multiple in-core tools by switching on the invoked tool name internally.
This moves the registry identity onto the handler itself and makes built-in multi-tool areas use separate concrete handlers, so each registered handler instance owns exactly one tool name and one dispatch path.
What Changed
ToolHandler::tool_name()and changedToolRegistryBuilder::register_handlerto derive the registry key from the handler.ToolHandlerKindand registry-plan construction so plan entries map directly to concrete handler registrations.Verification
cargo test -p codex-tools tool_registry_plancargo test -p codex-core --lib tools::registry_testsjust fix -p codex-toolsjust fix -p codex-core