Repository navigation
A message sent while the conversation is still busy waits and goes by itself - #3037
Merged
Merged
Conversation
… itself Send now, or any send, into a conversation whose last run still held it on the server showed "Thread <id> is locked" under the message, kept the message on screen as if sent, and put a second copy in the queue. Removing that copy left the first one looking sent, and nothing ran until the person typed it again. A refused run is now a message that waits: it comes off the screen, waits as queued with Remove, and goes once the conversation is free, asking the server first after a Stop and backing off between tries. Removed, it never goes. Words from upstream that name a thread or a run by its id are never shown; the person reads a plain sentence. A Stop through the backend's event store now also reaches the server's stop route, so the server does not carry the stopped turn on in a run of its own.
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
December 5, 2026 21:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A message sent into a conversation that is still busy now waits and goes by itself. It never shows an error, and it is never drawn as sent before it runs.
The report (OpenBot Cloud, 2026-12-05). A person queued a message while their Bot worked and pressed Send now. Under the message they read
Thread <the conversation's id> is locked, word for word. The message stayed on screen as if sent, and a second copy waited as queued ("Up next", Remove). They pressed Remove. The first copy still looked sent, nothing ran, and they had to type it again.What actually happened (from the server's logs and the stored run events).
@copilotkit/core1.88,AgentThreadLockedError) turned the 409 into "Thread is locked", andstoppedReasonpassed those words straight to the screen.restoreIfRunFails), still marked Up next, and held the drain until the person started a turn. That is why there were two copies, and why Remove left one looking sent.The fix.
AgentThreadLockedError, and the event-stream shape, RUN_ERRORTHREAD_ALREADY_RUNNING) shows nothing. Its message comes off the transcript and waits as queued, with Remove. It goes by itself once the conversation is free, with tries backing off from 0.5 s to 4 s. A live send the Bot was too busy for is parked too, not handed back to the box.stop_runon the socket only. The app now also calls the runtime's stop route, which takes the turn off the server's queue, so a stopped turn is not carried on. Over the plain event stream CopilotKit's Stop already is that route, so nothing is sent twice.It works the same for built-in Bots and for any Bot connected over AG-UI. It is all on the runtime's own run, stop and join paths, with no private channel.
How the other assistants do it (searched 2026-12-05). Most of them agree: a message sent while a turn is going is queued, drawn as not yet started, sent without another press once the turn ends, and can be taken back so it never sends. None surfaces a busy or locked error.
enqueue, the default) wait in FIFO order and run "when the current turn finishes and the session becomes idle". There is no error for sending while busy. https://docs.github.com/en/copilot/how-tos/copilot-sdk/features/steering-and-queueingWhere it runs
Boundary and audit
API and database
api/, no app's requests, no database change and norelease-policy.json. The Stop now also calls the runtime's existing stop route, which the app already called for a turn the server carries.Changelog
Conversations.
Proof
Red on
main, green here, in Chromium and WebKit (Safari's engine):app/tests/queued-send-locked-browser.test.tsx: the real conversation in Intelligence mode, against a server that answers/run409 "Thread lock denied" while the thread is held after a Stop sent asstop_runon the socket. Main: the Stop never reaches the stop route (0 calls), and the turn's words are lost. Here: the route is called once, the message waits with nothing said, it goes once, and it is drawn once.app/tests/queued-send-busy-browser.test.tsx: the same over the plain event stream (RUN_ERRORTHREAD_ALREADY_RUNNING), light and dark, 1280 px and 390 px. (1) Send now into a run still letting go waits, is refused at least once and never says so, then goes once. (2) Remove on a message waiting for the run to let go means it never runs and its words appear nowhere. Main fails both in both engines; here 16 of 16 pass.app/tests/stopped-turn.test.ts: both shapes of a busy refusal, built from CopilotKit's ownAgentThreadLockedError, are known and said in plain words with no id. A UUID in upstream words is never shown.Screens (fixed): the waiting message reads "Up next" with Remove under the stopped turn. The answer lands once, with nothing said about the refusal. Removed, the message is gone from the conversation.