Skip to content

Extract code-mode nested tool collection into codex-tools#16509

Merged
bolinfest merged 1 commit intomainfrom
pr16509
Apr 2, 2026
Merged

Extract code-mode nested tool collection into codex-tools#16509
bolinfest merged 1 commit intomainfrom
pr16509

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented Apr 2, 2026

Why

This is another small step in the codex-core -> codex-tools migration described in AGENTS.md.

core/src/tools/spec.rs and core/src/tools/code_mode/mod.rs were both hand-rolling the same pure transformation: convert visible ToolSpecs into code-mode nested tool definitions, then sort and deduplicate by tool name. That logic does not depend on core runtime state or handlers, so keeping it in codex-core makes spec.rs harder to peel out later than it needs to be.

What Changed

  • Add collect_code_mode_tool_definitions() to codex-rs/tools/src/code_mode.rs.
  • Reuse that helper from codex-rs/core/src/tools/spec.rs when assembling the exec tool description.
  • Reuse the same helper from codex-rs/core/src/tools/code_mode/mod.rs when exposing nested tool metadata to the code-mode runtime.

This is intended to be a straight refactor with no behavior change and no new test surface.

Verification

  • cargo test -p codex-tools
  • cargo test -p codex-core tools::spec::tests
  • cargo test -p codex-core code_mode_only_

@bolinfest bolinfest changed the title Extract code-mode nested tool shaping into codex-tools Extract code-mode nested tool collection into codex-tools Apr 2, 2026
@bolinfest bolinfest merged commit 9f71d57 into main Apr 2, 2026
48 of 52 checks passed
@bolinfest bolinfest deleted the pr16509 branch April 2, 2026 05:17
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 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