Repository navigation
Reduce processing time for large function tool results - #6217
Merged
Merged
Conversation
markstuart-oai
requested review from
a team,
rm-openai and
seratch
as code owners
November 25, 2026 02:18
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
jbeckwith-oai
approved these changes
Nov 25, 2026
jbeckwith-oai
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the tool-output conversion and custom-data extraction changes, surrounding code, and regression coverage. The fast path retains validation for other inputs and returns detached output blocks; configured extractors retain deep-copy isolation. No actionable findings. Static review only; no local code or tests run. Hosted CI: 24 successful checks on this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In the offline HTTP replay, eight calls returning large lists have been dropping from 57 to 36 ms. In the scripted Runner, 16 calls returning text blocks have been dropping from 82 to 29 ms. Little change on a single small result.
Function tools have been spending time building a validation model for each text block and copying the entire result even without a custom data extractor.
With this change, the SDK has been building fresh output blocks directly for plain dictionaries with exactly two valid text fields. Other shapes have been going through the existing validator. On a non-structured item, the SDK has been falling back to the original list or tuple as a whole.
The SDK has been making a detached copy only for a configured extractor. Metadata from the tool context has been working with or without an extractor.
Related work in #6195 on plain lists. The text-block conversion and conditional extractor copy have also been helping with structured results.
Benchmarks
A separate 18-pair HTTP replay of the large integer lists with a mock transport has been reproducing the gain (57.0 to 36.3 ms, −37.3%). For typed text, the six timed runs at the end of the original test sequence have been dropping from 53.7 to 47.5 ms in total. All six have been improving, including the second ordinary run (6.63 to 5.47 ms) and the second streamed run (8.40 to 6.94 ms).
Still uncertain — the two SQLite writes. In the independent repeats, the large write has been measuring +2.63% [−2.43, +6.90] and the small one +1.33% [−3.33, +5.25]. Both intervals have been crossing zero and the +3% threshold. No SQLite changes.
Regression checks across all 83 comparisons with Codex off. Offline Python SDK workloads on one Linux host with CPython 3.12.16. This change alone against
mainat4e162c79, without network or model latency.Timings and 95% intervals for all 83 comparisons
Test plan and checks
.agents/skills/code-change-verification/scripts/run.sh) including formatting, lint, mypy, Pyright and both pytest phases. 12,867 passed, 30 skipped.