Remove ToolsConfig from tool planning#22835
Merged
Merged
Conversation
## Summary - add a generic `ToolSetBuilder` / `ToolSet` seam in `codex-tools` - refactor core tool planning into an explicit ordered pipeline over `CoreToolPlanContext` - keep `ToolContributor` at the extension API boundary and adapt already-materialized extension executors inside core planning ## Test plan - `cargo check -p codex-tools` - `cargo check -p codex-core --lib` - `cargo test -p codex-tools` - `cargo test -p codex-core spec_plan --lib` - `cargo test -p codex-core router --lib` - `just fix -p codex-tools` - `just fix -p codex-core` - `just fmt`
# Conflicts: # codex-rs/core/src/session/review.rs # codex-rs/core/src/session/turn_context.rs # 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_model_tests.rs # codex-rs/core/src/tools/spec_plan_tests.rs # codex-rs/tools/src/tool_config.rs
pakrym-oai
reviewed
May 18, 2026
pakrym-oai
reviewed
May 18, 2026
pakrym-oai
reviewed
May 18, 2026
pakrym-oai
reviewed
May 18, 2026
# Conflicts: # codex-rs/core/src/mcp_tool_exposure_test.rs # codex-rs/core/src/tools/spec_plan_model_tests.rs # codex-rs/core/src/tools/spec_plan_tests.rs # codex-rs/tools/src/tool_config.rs
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
codex-toolsis meant to hold reusable tool primitives, butToolsConfighad become a second copy of core runtime decisions instead of a small shared contract. It carried provider capabilities, auth/model gates, permission and environment state, web/search/image feature gates, multi-agent settings, and goal availability from core intocodex-tools(definition, stored on eachTurnContext). Every session/context variant then had to build and mutate that snapshot before assembling tools.This PR removes that master object instead of renaming it. Tool planning now reads the live
TurnContext, wherecodex-corealready owns those decisions, whilecodex-toolskeeps only reusable primitives and a genericToolSetBuilder/ToolSetaccumulator.What Changed
ToolsConfig/ToolsConfigParamsfromcodex-tools; the crate keeps the shared helpers that still belong there, including request-user-input mode selection, shell backend/type resolution,UnifiedExecShellMode, andToolEnvironmentMode.ToolRouter::from_turn_contextand aspec_planpipeline overCoreToolPlanContext, deriving provider capabilities, auth gates, model support, feature gates, environment count, goal support, multi-agent options, web search, and image generation from the authoritative turn state.codex_tools::ToolSetBuilder/ToolSet, plus the small core adapter needed to accumulateCoreToolRuntimevalues and hosted model specs.tool_family::shellregistration module and moved shell/unified-exec/memory accounting call sites to read the narrow per-turn fields directly.TurnContextto the remaining explicit per-turn fields needed by planning:available_models,unified_exec_shell_mode, andgoal_tools_supported.Verification
cargo check -p codex-toolscargo check -p codex-core --libcargo test -p codex-toolscargo test -p codex-core spec_plan --libcargo test -p codex-core router --lib