Skip to content

[Dev UI] Prevent concurrent turn execution in AgentRunner #5307

@MichaelDoyle

Description

@MichaelDoyle

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();
  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdevui

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions