Preserve advisor context across ToolCallingAdvisor iterations - #6905
Open
harrisleesh wants to merge 1 commit into
Open
Preserve advisor context across ToolCallingAdvisor iterations#6905harrisleesh wants to merge 1 commit into
ToolCallingAdvisor iterations#6905harrisleesh wants to merge 1 commit into
Conversation
The tool-calling loop rebuilt each iteration's request context from the original request, so context entries written by advisors nested inside the loop were dropped before the next iteration. Only the last iteration's writes survived. Both the call and the stream paths were affected. Carry the response context forward into the next iteration instead, applying the same approach used for `ToolCallAdvisor` in spring-projects#5747. Fixes spring-projects#6903 Signed-off-by: seonghun lee <harrisleesh@gmail.com>
harrisleesh
force-pushed
the
gh-6903-stream-advisor-context
branch
from
September 3, 2026 12:28
8cd06ec to
319ef08
Compare
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.
Motivation
When
ToolCallingAdvisorruns a multi-round tool-calling loop, advisors nested inside the loop can write state into the advisor context. Currently each iteration rebuilds its request context from the original request's context, so writes from earlier iterations are silently dropped and only the last iteration's writes survive. The reporter observed this in stream mode; onmainthe non-stream call path has the same problem (the regression tests in this PR fail on both paths without the fix).Changes
adviseCall: keep a runningcontextmap, seed each iteration's request from it, and refresh it from the response context after each tool-call iteration - the same approach applied to the deprecatedToolCallAdvisorin Avoid repeated context injection in RetrievalAugmentationAdvisor #5747.Fixes #6903