Skip to content

Remove ToolsConfig from tool planning#22835

Merged
jif-oai merged 8 commits into
mainfrom
jif/nuke-clean
May 19, 2026
Merged

Remove ToolsConfig from tool planning#22835
jif-oai merged 8 commits into
mainfrom
jif/nuke-clean

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

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

Why

codex-tools is meant to hold reusable tool primitives, but ToolsConfig had 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 into codex-tools (definition, stored on each TurnContext). 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, where codex-core already owns those decisions, while codex-tools keeps only reusable primitives and a generic ToolSetBuilder/ToolSet accumulator.

What Changed

  • Removed ToolsConfig / ToolsConfigParams from codex-tools; the crate keeps the shared helpers that still belong there, including request-user-input mode selection, shell backend/type resolution, UnifiedExecShellMode, and ToolEnvironmentMode.
  • Replaced config-snapshot planning with ToolRouter::from_turn_context and a spec_plan pipeline over CoreToolPlanContext, 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.
  • Added generic codex_tools::ToolSetBuilder / ToolSet, plus the small core adapter needed to accumulate CoreToolRuntime values and hosted model specs.
  • Added the tool_family::shell registration module and moved shell/unified-exec/memory accounting call sites to read the narrow per-turn fields directly.
  • Narrowed TurnContext to the remaining explicit per-turn fields needed by planning: available_models, unified_exec_shell_mode, and goal_tools_supported.
  • Reworked MCP exposure and tool-search setup so deferred/direct MCP behavior is driven by the current turn rather than a precomputed config snapshot.
  • Replaced the large expected-spec fixture tests with focused behavior-level coverage for shell tools, environments, goal and agent-job gates, MCP direct/deferred exposure, tool search, request-plugin-install, code mode, multi-agent mode, hosted tools, and extension executor dispatch.

Verification

  • 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

@jif-oai jif-oai requested a review from a team as a code owner May 15, 2026 13:10
@jif-oai jif-oai changed the title Jif/nuke clean Remove ToolsConfig from tool planning May 15, 2026
jif-oai added 3 commits May 15, 2026 17:34
## 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
Comment thread codex-rs/core/src/session/review.rs
Comment thread codex-rs/core/src/tools/spec_plan.rs
Comment thread codex-rs/core/src/tools/tool_set.rs Outdated
Comment thread codex-rs/core/src/tools/tool_family/shell.rs Outdated
jif-oai added 3 commits May 19, 2026 10:35
# 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
@jif-oai jif-oai merged commit 05e1710 into main May 19, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/nuke-clean branch May 19, 2026 09:24
@github-actions github-actions Bot locked and limited conversation to collaborators May 19, 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