Skip to content

code-mode: carry nested tool kind through runtime#22377

Merged
pakrym-oai merged 5 commits into
mainfrom
pakrym/code-mode-remove-find-spec
May 12, 2026
Merged

code-mode: carry nested tool kind through runtime#22377
pakrym-oai merged 5 commits into
mainfrom
pakrym/code-mode-remove-find-spec

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

Why

Code mode only used nested spec lookup at execution time to rediscover whether a nested tool should be invoked as a function tool or a freeform tool.

That information is already present in the enabled tool metadata that code mode builds to expose tools.* and ALL_TOOLS, so re-looking it up from the router was redundant and kept execution coupled to a separate spec lookup path.

What Changed

  • thread CodeModeToolKind through the code-mode runtime ToolCall event and CodeModeNestedToolCall
  • emit the nested tool kind directly from the V8 callback using the already-enabled tool metadata
  • build nested tool payloads from the propagated kind instead of calling find_spec
  • remove the now-unused find_spec plumbing from the router and parallel runtime helpers
  • add unit coverage for function vs freeform payload shaping and update affected router tests

Testing

  • cargo test -p codex-code-mode
  • cargo test -p codex-core code_mode::tests
  • cargo test -p codex-core extension_tool_bundles_are_model_visible_and_dispatchable
  • cargo test -p codex-core model_visible_specs_filter_deferred_dynamic_tools

@pakrym-oai pakrym-oai requested a review from a team as a code owner May 12, 2026 20:43
@pakrym-oai pakrym-oai enabled auto-merge (squash) May 12, 2026 22:25
@pakrym-oai pakrym-oai merged commit 960d42d into main May 12, 2026
27 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/code-mode-remove-find-spec branch May 12, 2026 23:34
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 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