Description:
The sendMessage method in AgentRunner currently lacks a guard to prevent multiple simultaneous turns. Rapidly clicking the "Send" button (or pressing Enter) can initiate multiple runTurn calls with the same state. This leads to race conditions in the streaming logic and inconsistent UI state.
Suggested Fix:
Add a guard at the beginning of sendMessage to check if a turn is already active (e.g., by checking if traceId() is set).
// src/app/pages/agent-runner/agent-runner.component.ts
protected async sendMessage() {
+ if (this.traceId()) return;
+
const msgNode = this.multiModalInputComponent()?.getContent();
// ...
}
Description:
The
sendMessagemethod inAgentRunnercurrently lacks a guard to prevent multiple simultaneous turns. Rapidly clicking the "Send" button (or pressing Enter) can initiate multiplerunTurncalls with the same state. This leads to race conditions in the streaming logic and inconsistent UI state.Suggested Fix:
Add a guard at the beginning of
sendMessageto check if a turn is already active (e.g., by checking iftraceId()is set).