Skip to content

Preserve advisor context across ToolCallingAdvisor iterations - #6905

Open
harrisleesh wants to merge 1 commit into
spring-projects:mainfrom
harrisleesh:gh-6903-stream-advisor-context
Open

Preserve advisor context across ToolCallingAdvisor iterations#6905
harrisleesh wants to merge 1 commit into
spring-projects:mainfrom
harrisleesh:gh-6903-stream-advisor-context

Conversation

@harrisleesh

@harrisleesh harrisleesh commented Sep 3, 2026

Copy link
Copy Markdown

Motivation

When ToolCallingAdvisor runs 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; on main the non-stream call path has the same problem (the regression tests in this PR fail on both paths without the fix).

Changes

Fixes #6903

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
harrisleesh force-pushed the gh-6903-stream-advisor-context branch from 8cd06ec to 319ef08 Compare September 3, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolCallingAdvisor (stream mode): advisorContext modifications inside recursive tool‑loop are lost, only last‑round context retained

2 participants