Studio: don't drop parallel tool calls after an internal no-op#7157
Studio: don't drop parallel tool calls after an internal no-op#7157oobabooga wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request ensures that duplicate or no-op tool calls do not abort a batch of parallel tool calls or split the assistant's tool calls from their corresponding tool results. It introduces an append_deferred_nudges helper to collect, deduplicate, and append no-op nudges as a single user message after the batch's tool results have been recorded. Corresponding unit tests have been added to verify this behavior across both the Llama.cpp and Safetensors agentic inference paths. I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a466fe59d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
In the agentic tool loop, when the model emits several tool calls in one turn and one of them is an internal no-op (a duplicate, a disabled tool, or a repeated render_html), the loop stopped at that no-op and silently dropped every call after it. For a batch
[A, A (duplicate), B]:breaks, so B never runs.The
breakwas load-bearing: it kept the no-op'srole:usernudge from splitting an assistant'stool_callsfrom theirrole:toolresults.Fix
Defer the nudges instead. The loop
continues so the trailing calls still run, and a sharedappend_deferred_nudges()helper appends them as onerole:usermessage after all the tool results. Applied to both the GGUF (llama_cpp.py) and safetensors (safetensors_agentic.py) loops.One behavior change: a call that duplicates an already-satisfied one now counts toward the duplicate limit within a single turn, so the loop finalizes one turn sooner when the model parallel-duplicates.
Verification
Three regression tests (GGUF, safetensors, helper), each confirmed to fail on the old
break: the[A, A (duplicate), B]batch now runs both A and B. Tool-loop, controller, safetensors, and secure-tools suites pass (397).The no-op
breakwas one of the issues raised in #7119. This PR lands that single fix on its own, minimal and tested.