Skip to content

Expose explicit dynamic tool namespaces in thread start#27371

Merged
sayan-oai merged 6 commits into
mainfrom
codex/dynamic-tool-explicit-namespaces-api
Jun 15, 2026
Merged

Expose explicit dynamic tool namespaces in thread start#27371
sayan-oai merged 6 commits into
mainfrom
codex/dynamic-tool-explicit-namespaces-api

Conversation

@sayan-oai

@sayan-oai sayan-oai commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Stacked on #27365.

Stack note

#27365 kept thread/start unchanged and converted its input in thread_processor. This PR updates thread/start to accept explicit functions and namespaces directly.

Legacy per-tool arrays are still accepted and converted while reading the request. As a result, thread_processor can validate and pass the tools through directly, which is why some code added in #27365 is removed here.

Why

thread/start.dynamicTools still repeats namespace data on each function even though core now stores explicit namespace groups. The request API should use the same shape so each namespace has one description and one member list.

What changed

  • Accept top-level functions and explicit namespace objects in dynamicTools.
  • Continue accepting fully legacy flat arrays, including exposeToContext.
  • Reject arrays that mix legacy and canonical entries.
  • Reuse the protocol types directly and remove the temporary app-server adapter.
  • Update validation, docs, the test client, and generated schemas.

Test plan

  • just test -p codex-app-server-protocol
  • just test -p codex-app-server dynamic_tool_call_round_trip_sends_text_content_items_to_model
  • just test -p codex-app-server thread_start_normalizes_legacy_dynamic_tools_into_model_request
  • just test -p codex-app-server thread_start_rejects_mixed_dynamic_tool_formats
  • just test -p codex-app-server thread_start_rejects_hidden_dynamic_tools_without_namespace

@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-core branch from 1765bf7 to acca13f Compare June 11, 2026 04:16
@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-api branch 2 times, most recently from 0501a07 to e0bb3c7 Compare June 11, 2026 04:45
Comment on lines -41 to -43
#[derive(Serialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmk if this is an antipattern and we'd rather define the types in app-server and protocol, i know we duplicate other types.


/// Exercises the full dynamic tool call path (server request, client response, model output).
#[tokio::test]
async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Result<()> {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main happy path integration test; updated with new types

@sayan-oai
sayan-oai marked this pull request as ready for review June 11, 2026 05:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f2b5e0a6f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/app-server/src/request_processors/thread_processor.rs
Comment thread codex-rs/app-server-protocol/src/protocol/v2/thread.rs
Comment thread codex-rs/app-server/README.md
@sayan-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f2b5e0a6f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/app-server/src/request_processors/thread_processor.rs
Comment thread codex-rs/app-server-protocol/src/protocol/v2/thread.rs
@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-core branch from ab8c1e5 to c856ed2 Compare June 11, 2026 08:50
@sayan-oai
sayan-oai requested a review from a team as a code owner June 11, 2026 08:50
@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-api branch from 9f2b5e0 to 8ed9281 Compare June 11, 2026 08:51
Comment thread codex-rs/protocol/src/dynamic_tools.rs
Comment thread codex-rs/app-server/src/request_processors/thread_processor.rs
@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-api branch from 8ed9281 to b2bee78 Compare June 12, 2026 08:23

@jif-oai jif-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a thread/start integration test for duplicate namespace containers? Just to lock the behaviour explicitly

@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-api branch from b2bee78 to 1b4b9a6 Compare June 12, 2026 19:05
sayan-oai added a commit that referenced this pull request Jun 15, 2026
Follow-up to #27356.

## Stack note

This PR changes Codex's internal dynamic-tool shape while leaving
`thread/start` unchanged. App-server therefore converts the existing
per-tool input into explicit functions and namespaces before passing it
to core.

[#27371](#27371) updates
`thread/start` to use the same explicit shape and removes this temporary
conversion.

## Why

Dynamic tools repeat namespace metadata on every function. Core should
keep one explicit namespace with its member tools so descriptions and
membership stay consistent across sessions and runtime planning.

## What changed

- Represent dynamic tools as top-level functions or explicit namespaces
in protocol and session state.
- Read old flat rollout metadata and write the canonical hierarchy.
- Flatten namespace members only when registering callable tools.
- Keep `thread/start.dynamicTools` flat for now and normalize it at the
app-server boundary.

New builds can read old rollout metadata. Older builds cannot read newly
written hierarchical metadata.

## Test plan

- `just test -p codex-app-server
thread_start_normalizes_legacy_dynamic_tools_into_model_request`
- `just test -p codex-protocol
session_meta_normalizes_legacy_dynamic_tools`
- `just test -p codex-core
resume_restores_dynamic_tools_from_rollout_with_sqlite_enabled`
- `just test -p codex-core
tool_search_returns_deferred_dynamic_tool_and_routes_follow_up_call`
- `just test -p codex-core code_mode_can_call_hidden_dynamic_tools`
- `just test -p codex-tools`
Base automatically changed from codex/dynamic-tool-explicit-namespaces-core to main June 15, 2026 15:06
@sayan-oai
sayan-oai force-pushed the codex/dynamic-tool-explicit-namespaces-api branch from 1b4b9a6 to fe2b08e Compare June 15, 2026 15:20
@sayan-oai
sayan-oai enabled auto-merge (squash) June 15, 2026 15:21
@sayan-oai
sayan-oai merged commit 11faf9a into main Jun 15, 2026
31 checks passed
@sayan-oai
sayan-oai deleted the codex/dynamic-tool-explicit-namespaces-api branch June 15, 2026 15:35
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 15, 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