Skip to content

feat: add turn_id and truncation_policy to extension tool calls#23666

Merged
jif-oai merged 2 commits into
mainfrom
jif/trunctaion
May 20, 2026
Merged

feat: add turn_id and truncation_policy to extension tool calls#23666
jif-oai merged 2 commits into
mainfrom
jif/trunctaion

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

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

Why

Extension-owned tools currently receive a stripped ToolCall with only call_id, tool_name, and payload.
That makes extension work that needs turn-local execution context awkward, especially web-search extension work that needs the active truncation_policy at tool invocation time.

Reconstructing that value from config or ExtensionData would be indirect and could drift from the actual turn context, so the cleaner fix is to pass the needed turn metadata directly on the extension-facing invocation type.

What changed

  • added turn_id and truncation_policy to codex_tools::ToolCall
  • populated those fields when core adapts ToolInvocation into an extension tool call
  • added a focused adapter test that verifies extension executors receive the forwarded turn metadata
  • updated the memories extension tests to construct the richer ToolCall
  • added the codex-utils-output-truncation dependency to codex-tools and refreshed lockfiles

Testing

  • cargo test -p codex-tools
  • cargo test -p codex-memories-extension
  • cargo test -p codex-core passes_turn_fields_to_extension_call
  • just bazel-lock-update
  • just bazel-lock-check

@jif-oai jif-oai requested a review from a team as a code owner May 20, 2026 09:54
@jif-oai jif-oai changed the title feat: add truncation_policy to tool call feat: add turn_id and truncation_policy to extension tool calls May 20, 2026
Copy link
Copy Markdown
Contributor

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

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: cba326a3d8

ℹ️ 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/tools/src/tool_call.rs
Comment thread codex-rs/tools/Cargo.toml
@jif-oai jif-oai merged commit c5bd131 into main May 20, 2026
43 of 47 checks passed
@jif-oai jif-oai deleted the jif/trunctaion branch May 20, 2026 18:14
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 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