Repository navigation
Description
TL;DR
While the agent is working, a user can queue follow-up messages. When the run ends, Studio sends the next queued message automatically. Studio removes the message from the queue before the send is accepted. If the send then fails, the message is not put back in the queue or the composer. It stays visible in the transcript next to an error, but the user has to copy and re-send it by hand. The prototype behaves the same way, so this needs a small design decision.
Found by reading code; not reproduced in a running app.
When it happens
- A run is in progress and the user queues a message.
- The run ends. Studio takes the message out of the queue and sends it.
- The send fails: network blip, expired sign-in, or the session is busy.
- The queue strip no longer shows the message. The transcript shows it, plus "Could not confirm this run's outcome".
It needs the failure to land at the exact moment a run ends, so it should be rare. The text is not erased from the screen, so this is not a release blocker.
What's wrong
- The failed message has no recovery path: it is not restored to the queue and not put back in the composer.
- After a reload, a message the server never accepted probably does not reappear (not traced).
- The steer path already does this correctly: a message leaves the queue only once the steer is accepted.
Why it happens (structural)
- Take, then send.
takeNextQueuedMessagewrites the queue back without the message before returning it (chat-queue.ts#L95-L103). ThendrainNextQueuedMessagedoesvoid sendPrompt(next.text, ...)and nothing re-queues it (chat-workspace.tsx#L1613-L1618). - The failure handler only reports. The catch block in
sendPromptonly sets the error text (chat-workspace.tsx#L1486-L1490). A "not accepted" hook,onAccepted?.(false), already exists on that path. The drain doesn't use it. - The design has the same flaw. The prototype does the same take-then-send (
chat-workspace.tsx#L1233), and Studio's port kept it. Nothing specifies what should happen when the send fails.
Decision needed
What should happen to a queued message whose send is not accepted?
- A. Keep it in the queue until the send is accepted, and restore it on failure. Open question: where does it go if the user queued more meanwhile (front of the queue keeps the order)?
- B. Put it back in the composer as a draft. Open question: what if the composer already has text?
If A turns out to be straightforward, this can be done as a plain PR using the existing hook.
Done when
- A queued message whose send is not accepted is never lost: it is restored to a defined place.
- A test covers the failing send.
- The prototype and Studio agree on the behavior.
Part of #2302.
Fully or partially written by an AI agent.
Activity