feat(agent): optionally preserve native parallel tool calls - #2283
Open
Zeng-Weijun wants to merge 1 commit into
Open
feat(agent): optionally preserve native parallel tool calls#2283Zeng-Weijun wants to merge 1 commit into
Zeng-Weijun wants to merge 1 commit into
Conversation
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
The OpenAI agent adapter currently truncates every parsed tool-call turn to the first call so clients that drop extra calls can replay history. That behavior prevents native clients which faithfully echo parallel calls from executing and training all model-selected actions.
This adds an opt-in
preserve_parallel_tool_calls=Trueconstructor flag. The default remains unchanged for existing Codex-style clients. In native mode, both the OpenAI wire reply and the trajectory-manager message retain the complete ordered call list.Why the opt-in is replay-safe
The native client echoes all
tool_callsin its next Chat Completions request._translate_messagesremoves only wire correlation IDs and JSON-decodes arguments, reproducing the exact manager message recorded for the preceding turn. The regression test checks this equality for two calls and also locks the legacy default at one call.Validation
ruff check slime/agent/adapters/openai.py tests/test_agent/test_adapters.pyCUDA_VISIBLE_DEVICES= USE_TORCH=0 python -m pytest -q tests/test_agent