Skip to content

fix(agent): preserve cumulative stream history after tool calls#1214

Open
Alexxigang wants to merge 1 commit intoagentscope-ai:mainfrom
Alexxigang:fix/cumulative-stream-after-tools
Open

fix(agent): preserve cumulative stream history after tool calls#1214
Alexxigang wants to merge 1 commit intoagentscope-ai:mainfrom
Alexxigang:fix/cumulative-stream-after-tools

Conversation

@Alexxigang
Copy link
Copy Markdown
Contributor

Summary

  • preserve cumulative reasoning stream output across ReAct reasoning/acting boundaries
  • keep incremental streaming behavior unchanged
  • add regression coverage for thinking + text + tool-call + post-tool reasoning chunks

Why this fix

In cumulative streaming mode (StreamOptions.builder().incremental(false)), StreamingHook used the current ReasoningChunkEvent#getAccumulated() message directly. That message is scoped to a single reasoning round, so after a tool call starts the next reasoning round, previously streamed thinking/text/tool-call content is dropped from subsequent cumulative emissions.

This change keeps a stream-scoped cumulative reasoning view inside StreamingHook, replacing in-round accumulated blocks while preserving earlier reasoning-round blocks across tool execution boundaries.

Validation

  • mvn -pl agentscope-core '-Dtest=ReActAgentTest#testCumulativeReasoningStreamKeepsHistoryAfterToolCall+testIncrementalReasoningStreamStillEmitsDeltasAfterToolCall' test -q
  • mvn -pl agentscope-core '-Dtest=ReActAgentTest,AgentStreamingTest' test -q
  • mvn -pl agentscope-core spotless:check -q

Fixes #1211

@Alexxigang Alexxigang force-pushed the fix/cumulative-stream-after-tools branch from ce04b44 to e56218e Compare April 13, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: io.agentscope.core.agent.StreamOptions.Builder#incremental(累计模式)在 tool call 后无法正确累加内容

1 participant