Repository navigation
fix(agent): retain ReAct tool calls for output and memory - #21444
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Per-run tool-call collection internal/agent/component/agent.go |
Each run gets a separate tool-call collector. The stream scanner merges fragments at EOF and the runner attaches collected calls to the returned assistant message, including when no response chunks were produced. |
Component history validation internal/agent/component/agent_tool_history_test.go |
Tests cover call history across nested agents and concurrent roots, and reconstruction of streamed tool-call fragments by round. |
Service history integration internal/service/agent_tool_history_test.go |
An integration test covers streamed and deferred output, parallel calls, direct answers, empty streams, tool failures, cancellation, and persisted memory. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant runEinoReActAgent
participant scanAllStreamForToolCall
participant contextCollector
participant assistantMessage
runEinoReActAgent->>scanAllStreamForToolCall: pass run context and stream
scanAllStreamForToolCall->>contextCollector: append concatenated calls at EOF
runEinoReActAgent->>assistantMessage: attach collected calls
Suggested reviewers: wangq8
Merge Risk: 
Minimal · up to 77b9e
-
The tool-call history changes have no established merge-blocking risk.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the change: it fixes ReAct tool-call retention so Agent output and memory keep the tool calls. It follows the conventional-commit style and matches the summary, which collects complete tool calls per turn and attaches them to the final message for output and memory.
Full details: Description check
-
Explanation
The description follows the template's Summary section. It explains the problem (successful ReAct runs leave the final message's ToolCalls empty, so tool_calls output is empty and memory summarization is skipped), the fix (per-turn stream checker collects complete calls and attaches them to the final message), and scope (parent and child histories stay separate; message and artifact streaming are unchanged). It also adds a Validation section with test coverage, results, and the items not run. The template has only a Summary heading, so the extra section does not break the structure.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit watched the call-stream flow,
As fragments joined and IDs showed.
Each run kept its own history,
While nested roots stayed free,
And calls returned when streams were done.
Comment @coderabbitai help to get the list of available commands.
|
Thanks for the review, @6ba3i! The Infinity CI logs show the model provider returning HTTP 429 / code 1113 (insufficient balance or no available resource package). Could a maintainer check the CI model quota and rerun the failed and cancelled jobs once resolved? |
Summary
Successful Go ReAct runs execute tools and return an answer, but their final assistant message usually has no
ToolCalls. Reading only that message leaves the Agent'stool_callsoutput empty and skips tool-call memory summarization.Collect complete calls in the existing per-turn stream checker and attach this run's history to the final message, including an empty final stream. History collection stays within each Agent's own stream checker; parent and child histories remain separate, and message and artifact streaming are unchanged.
Validation
RunAgentcoverage through Canvas, AgentComponent, ReAct, the model HTTP adapter, MCP transport, and session persistence, using deterministic external HTTP fixtures.bash build.sh --test -p 4 -v -run ToolHistory ./internal/agent/component/ ./internal/service/passed with the repository's CGO/static native libraries.build.shalso passed.No browser E2E, race-detector run, or live-provider model calls were performed.