Repository navigation
fix(loop): finalize bounded native tool turns safely - #50
Merged
Brian Krabach (bkrabach) merged 1 commit intoSep 8, 2026
Merged
Conversation
Count actual provider calls, avoid duplicate natural completions, and close interrupted finalization turns with safe assistant state. Generated with Amplifier Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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.
What changed
Completes the loop-streaming downstream needed by the merged provider boundary fixes:
88b8c07a6940f74c0ef17d45258dd5ea35b1bd6b)4cf78c792dd214233d16b373e824135de5687957)The loop now distinguishes a natural completion at the iteration boundary from a forced finalization. Natural completion does not make a duplicate provider call. Forced finalization preserves the ordinary generic/native tool declarations while sending portable
tool_choice="none"; unexpected tool calls are not dispatched or structurally persisted. Cancellation and provider errors close an interrupted tool turn safely, while reasoning blocks, provider metadata, andllm_callsremain accurate.No provider model names are hardcoded here; provider dialect behavior remains at the provider boundary.
Type of change
Testing
tool_choice="none", non-dispatch of an unexpected response tool call, cancellation/error closure, native tool-spec retention, reasoning metadata, and accurate provider-call accounting.Review focus