bug(send): `ao send` reports success immediately but delivery waits for the worker's next turn boundary — a busy worker misses a stop message for minutes
Summary
ao send returns success immediately, but the message is not delivered to the agent until its
next turn boundary. When a worker is occupied in a long blocking tool call, that can be many
minutes. The caller gets exit 0 / 200 OK with no indication that delivery is still pending, so
an orchestrator believes it has redirected a worker that has not yet seen the message.
For supervisory messages — "stop", "do not do X" — arriving after the turn completes is equivalent to not arriving at all.
Reproduction / observed timeline
A worker session (cursor harness, macOS) was cycling long blocking shell calls: repeated
npm run dev attempts under AwaitShell with block_until_ms=120000, one shell recorded at
running_for_ms: 115087.
Three ao send messages were issued from the orchestrator during that period:
| Sent | Result |
|---|---|
| ~03:21 | exit 0 |
| ~03:27 | exit 0 |
| ~03:31 | exit 0 |
All three appear in the worker's transcript at 03:35, at the first turn boundary after the blocking shell calls completed — a delay of roughly 14 minutes for the first.
The messages instructed the worker not to fork the repository to a different GitHub account. The
fork was created at 2026-08-05T22:05:10Z — 03:35 IST, the same minute the messages landed.
The instruction and the action it was meant to prevent arrived simultaneously.
For contrast, a later send to a different worker doing ordinary short tool calls (file reads and edits) was delivered promptly at the next boundary and acted on correctly. The variable is not the message, the harness, or the payload size — it is whether the agent is inside a long blocking call.
Impact
- An orchestrator cannot interrupt a worker that is busy, which is exactly when intervention is most often needed (a stuck loop, a runaway sequence, an action about to be taken).
exit 0actively misleads: the orchestrator reported to its human that guardrails had been issued, and continued on that assumption while the worker proceeded unaware.- The only reliable immediate lever is
ao session kill, which is all-or-nothing — there is no way to say "stop doing that one thing" to a busy worker.
Requests
- Distinguish accepted from delivered. Have the send endpoint and CLI report that a message is queued pending the worker's next turn, rather than reporting plain success. A caller that knows delivery is pending can wait, escalate, or kill; a caller told "200 OK" cannot.
- Provide a way to reach a busy worker, or document explicitly that none exists and that killing the session is the only immediate option.
- Optionally, expose delivery state (queued / delivered) so an orchestrator can poll for confirmation instead of inferring it.
Note for anyone investigating
Sent message content is not recorded in the transcript for multiline messages. Cursor writes a placeholder instead:
<user_query>
[Pasted text #1 +10 lines]
</user_query>
Short single-line messages are stored inline. Searching a transcript for the text of a sent message
will therefore return a false negative for every multiline send — match on new role: user rows
and their timestamps instead. Note also that AO injects its own follow-up prompts ("Briefly inform the user about the task result…") as user rows, which are not operator messages.
Environment
- macOS (darwin 23.6.0), cursor harness worker sessions
- Repo at
3934bc86a
Thanks for contributing to Agent Orchestrator.
This issue is being picked up by the current external contributor on-call pair:
- @illegalcall
- @somewherelostt
If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @somewherelostt here.
For faster context or live questions, you can also join the AO Discord.
Join the session here: https://discord.gg/H6ZDcUXmq
Come by if you want to see what is being built, ask questions, or just hang around with the community.
I'd like to work on this.
Some findings from tracing the current code, in case they help scope it — happy to be corrected.
Delivery state already exists for chat sessions; it is just discarded. Manager.send routes chat-mode sessions through sendChat (internal/session_manager/chat_spawn.go), which calls RelayChatTurn and drops the returned domain.ConversationTurn:
_, relayErr = m.chat.RelayChatTurn(ctx, id, message)
That turn already carries ID, State (queued / running) and RequestedAt — the accepted-vs-delivered distinction this issue asks for. SendSessionMessageResponse (internal/httpd/controllers/dto.go) then reports only {ok, sessionId, message}, and ao send passes nil as the decode target (internal/cli/send.go), so the CLI prints nothing at all.
So requests 1 and 3 look like plumbing an existing value through the response rather than new machinery — at least for chat sessions.
Request 2 already has an endpoint. #3838 landed POST /sessions/{id}/conversation/steer plus the queued-turn promote route. Neither has a CLI surface yet.
The gap is TUI sessions. This report is from a cursor (TUI) worker, and that path (messenger.DeliverWithPostWrite) writes keystrokes into the pane with no AO-side queue, so there is no turn whose state could be reported. The honest answer there may be to document that no delivery signal exists rather than invent one.
Proposed scope, if maintainers agree:
- Return the turn id and state from
POST /sessions/{id}/send, and print them fromao send(chat sessions; TUI keeps today's shape). - Add
ao send --mode steerover the existing steer route, and--waitto block until the turn leavesqueued. - Document the TUI limitation explicitly.
Happy to split that across separate PRs, or to take only part of it.
Correction to my previous comment — I described the return type wrongly, and the detail matters for where a fix would go.
RelayChatTurn returns the queued turn's id (string), not a domain.ConversationTurn. The full turn exists one layer deeper and is narrowed away there. Precisely:
-
chat.Service.RelayChatTurnWithID(internal/service/chat/service.go) callscontroller.Send(...), which returns a fulldomain.ConversationTurn, then returns onlyturn.ID— soStateis dropped here. -
Manager.sendChat(internal/session_manager/chat_spawn.go) then discards even the id:_, relayErr = m.chat.RelayChatTurn(ctx, id, message) -
SendSessionMessageResponsereports{ok, sessionId, message}, andao sendpassesnilas the decode target, so nothing reaches the CLI.
So the shape of the change is slightly larger than "stop discarding a value": surfacing state as well as id means widening what the chat service returns, or having the manager read the turn back. Still small, and the point stands — the durable fact this issue asks for already exists and is thrown away on the way out.
Apologies for the noise.
Sure @mahdiahmadi1991 Go ahead, i will review your PR
Assigned to @illegalcall