Bug Description
When using AguiRequestProcessor with server-side memory enabled, the extractLatestUserMessage method drops tool result messages from the request. This causes the PendingToolRecoveryHook to report "Pending tool calls exist without results" error when the Agent tries to process subsequent requests.
Steps to Reproduce
- Configure agentscope-agui with server-side memory enabled
- Send an initial request that triggers tool calls (e.g., "check document")
- Agent responds with tool calls, frontend executes them and returns tool results
- Send a follow-up user message (e.g., "execute the plan")
- Backend throws error:
Pending tool calls exist without results
Expected Behavior
The follow-up request should be processed correctly. Tool results from the previous turn should be preserved.
Actual Behavior
The backend throws an error because extractLatestUserMessage only keeps the last user message and discards all tool result messages.
Root Cause
In AguiRequestProcessor.process():
if (agentResolver.hasMemory(threadId)) {
input = extractLatestUserMessage(input); // This drops tool results!
}
Suggested Fix
Modify extractLatestUserMessage to preserve tool result messages by collecting them before the last user message.
Environment
- agentscope-java: 1.0.12
- Java: 17+
Bug Description
When using
AguiRequestProcessorwith server-side memory enabled, theextractLatestUserMessagemethod drops tool result messages from the request. This causes thePendingToolRecoveryHookto report "Pending tool calls exist without results" error when the Agent tries to process subsequent requests.Steps to Reproduce
Pending tool calls exist without resultsExpected Behavior
The follow-up request should be processed correctly. Tool results from the previous turn should be preserved.
Actual Behavior
The backend throws an error because
extractLatestUserMessageonly keeps the last user message and discards all tool result messages.Root Cause
In
AguiRequestProcessor.process():Suggested Fix
Modify
extractLatestUserMessageto preserve tool result messages by collecting them before the last user message.Environment