Skip to content

[Bug]: A message to a running conversation waits for the current tool call to finish #6729

Open

Description

@enyst

Is there an existing issue for the same bug?

  • I have searched existing issues and this is not a duplicate.

Related: #6553 (the same lock, from the angle of executor saturation). That issue is about the server wedging. This one is about latency the person sees even when nothing wedges.

Bug Description

POST /api/conversations/{id}/events to a conversation whose agent is running a long tool call does not save the message until that tool call ends. LocalConversation.send_message() takes the conversation's state lock (with self._state:), and a live run holds that lock for the whole step, tool execution included. So the person's message, and anything the UI does after it, waits behind the command.

In an end-to-end Projects run (#6602 at 67c1038, Canvas #19495), "Wait, actually: …" was sent to a worker while its terminal ran a 7-minute pytest. Canvas showed "Sending…" for about 6.5 minutes. The message reached the agent only when the command ended. With the terminal tool's long timeouts (agents here run suites with timeout 3000), a correction can wait up to 50 minutes.

This is not specific to Projects. Projects just makes it common, because the person drops into a busy worker to redirect it.

Expected Behavior

The message is saved and acknowledged at once. The agent sees it at its next step, or the person can choose to interrupt the running tool.

Actual Behavior

The request does not return until the running tool call ends, and the message is not in the event log until then.

Steps to Reproduce

  1. Start a conversation whose agent runs a terminal command that takes a few minutes (for example sleep 300).
  2. While it runs, POST /api/conversations/{id}/events with run: true.
  3. The request returns only when the command ends.

Possible directions

  • Append user messages through a path that does not need the step's state lock, for example a queue that the run drains at the start of its next step.
  • Or accept the message at once and expose "message queued behind a running tool", so UIs can offer "interrupt and send".

OpenHands Version

main, plus #6602 at 67c1038

Activity

  1. all-hands-bot commented on Nov 10, 2026

    @all-hands-bot
    Collaborator

    The new issue reports message-intake latency: send_message() takes the conversation state lock, and a live run holds it for the whole step (tool execution included), so POST /events is not saved/acknowledged until the tool call ends. This is the same root cause and code path as open issue #6553, which enumerates send_message among the state-lock waiters and holds the lock across the step, but #6553's symptom is a permanent wedge via executor saturation and it explicitly keeps the lock hold as a non-goal, so its fix would not resolve this latency. The 'message while running' semantics the issue proposes (queue at next step / expose 'interrupt and send') are the subject of open design issue #4829 (interrupt/steer/queue control plane), which also cites the lock split as its prerequisite. Not an exact duplicate of either, but discussion and fix planning would benefit from being coordinated with #6553 (same lock) and #4829 (intake-while-running semantics); the newly closed #6708/PR #6709 already fixed the same lock-hold symptom for the session-socket transport, leaving the REST path open. Should not be auto-closed.

    Found 2 possible duplicate issues:

    1. #6553 — [Bug]: State-lock waiters fill the default executor and deadlock tool execution in agent-server
    2. #4829 — Introduce an explicit interrupt / steer / queue control plane for user messages (ACP parity)

    These may not be exact duplicates, but the scope appears to overlap enough that keeping discussion in one place may be more useful.

    This comment was created by an AI assistant (OpenHands) on behalf of the repository maintainer.

  2. enyst commented on Nov 10, 2026

    @enyst
    MemberAuthor

    My agents filed this issue, after a few hours of running live testing… I know it has come up occasionally in the past, but TBH personally I don’t think it matters a lot, nor is it clear to me how it would help my agents since the user didn’t interrupt. The user can interrupt with the Stop button. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions