fix: preserve OpenAI parallel tool-result associations - #10174
Merged
tastelikefeet merged 1 commit intoSep 22, 2026
Merged
tastelikefeet merged 1 commit into
tastelikefeet merged 1 commit into
Conversation
Signed-off-by: taking-lying-flat <1615405@qq.com>
tastelikefeet
approved these changes
Sep 22, 2026
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.
PR type
PR information
OpenAI parallel tool results can arrive in a different order from the assistant's
tool_calls. The normalizer discards call IDs, and dataset message validation also removestool_call_id. Templates such as Hermes then render only the result contents in arrival order, losing which call produced each result.For calls
lookup_value(A)followed bylookup_value(B), these distinct records currently produce the same canonical context:Align each immediately following, complete tool-result group by call ID before converting the assistant calls. The shared normalizer covers both dataset preprocessing and direct
Template.encode()inputs. Copy the message list before reordering and move whole result messages to preserve their metadata.The change is confined to one production function (+14/-1). Reordering requires distinct non-null call IDs and exactly one matching result per call. Single-call, already ordered, and ID-less legacy inputs retain their behavior. Incomplete, ambiguous, or noncontiguous result groups retain their existing behavior and are outside this fix.
Experiment results
git diff --checkpassed. No full training or model-accuracy experiment was run.