Repository navigation
chore: merge upstream queue stack (coder/coder#31156) - #23
Conversation
Add a chat_busy_behavior enum ('queue', 'steer') and a busy_behavior
column on chat_queued_messages. Every current insert stores 'queue', so
behavior does not change. A later change delivers 'steer' rows at the
next step boundary.
FinishTurn, FinishInterruption, SendMessage from E1, and PromoteQueuedMessage now share deliverQueuedRows, which moves a list of queued rows into history. The delivery still takes only the queue head, and a head under edit still pauses the chat. FinishTurnResult and FinishInterruptionResult return PromotedMessages as a slice.
chatstate now uses the busy_behavior of a queued message as its lane, steer or queue. The queue lists the steer lane first, then the queue lane. FinishTurn, FinishInterruption, and a send from E1, E1P, or P deliver the whole steer lane. If the steer lane is empty, they deliver the queue head. Delivery stops at the first row under edit, so rows ahead of an edited row still go out in order. chatstate accepts the steer busy behavior, but no caller sends it yet. Interrupt sends still go into the queue lane, and PromoteQueuedMessage reorders a message inside its own lane.
Before each assistant model call, the generation task applies DeliverSteerMessages. If steer messages are queued, it moves them into history and returns without the call. The history change starts a new generation task, which sends them to the model. Queue messages wait until the turn ends. Compaction calls do not deliver steer messages. chatd.SendMessage accepts the steer busy behavior.
…before a model call
An interrupt send now stores the message at the end of the steer lane. Before, it went to the head of the queue lane from R0, R1, or R1P, and to the tail of the queue lane from I1 or I1P. FinishInterruption delivers the whole steer lane, so the message goes into history after the steer messages that were queued before it. A steer message under edit still stops the delivery, so the message waits behind it.
Send now ends any edit on the queued message and moves it to the end of the steer lane. In the same transaction, it interrupts the chat if the chat is running or requires action, or is interrupting and no worker owns it. From E1, E1P, or P, it delivers the steer lane into history, up to the first message under edit. SteerQueuedMessage replaces PromoteQueuedMessage in chatstate, and the SteerChatQueuedMessage query replaces ReorderChatQueuedMessageToHead.
…ed queued messages
When chatstate refuses a delete, edit, or Send now on a queued message, it now looks up the message. A missing message returns ErrQueuedMessageNotFound (404). An existing message keeps ErrTransitionNotAllowed, which the handlers map to 409, as on main.
The test enables the chat worker. The worker can take over the unowned requires_action chat, and without requires_action_deadline_at it cancels the pending tool call at once, so SubmitToolResults got a 409.
…nd list it as taken early
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
UATThese rounds ran through Coder Agents on the local deployment. A dev server built from this branch ran inside the
Non-blocking findings, all in upstream behavior as written:
Nothing in any round shows that the merge broke something. The head moved from the tested SHA only through merges of
Neither merge changes
|
|
Part of #6.
Merges the upstream queue stack into fork
mainas upstream wrote it, so later workspaces can build on queued-message delivery modes, the steer lane and Send now. Merge with a merge commit (not squash), like sync PRs, so a later merge of the same upstream branch brings only new commits.Merged head:
ethanndickson/chat-send-now-steerat7b15d1581a14230efdff8805bad0f78d274bde27(fetched 2026-11-09 00:20 UTC). Not coder#31174, per the brief.ethanndickson/chat-queue-delivery-mode2c514df17eethanndickson/chat-queue-batch-delivery7a352a0ff5ethanndickson/chat-steer-lane464c55a501ethanndickson/chat-steer-next-stepbaf0487cc2ethanndickson/chat-interrupt-send-steerf5ab996dfdethanndickson/chat-send-now-steer7b15d1581aEach listed head is an ancestor of the merged head. The branch forked from upstream
mainatbf47fc68d9, which forkmainalready contains, so the merge brings only the stack's 14 commits. Upstreammain(80978fa5ef) still ends at000639.000640_chat_queued_message_busy_behavior.chatdmig routeclassifies itchatd(no override needed), andchatdmig checklists node1eb71c9c-eb92-5def-a839-5b0be647691c 000640_chat_queued_message_busy_behaviorafter the adopt node.early.txtgains000640 chat_queued_message_busy_behavior coder/coder#30073, soroutestops a later sync if upstream brings another migration at or below 000640 (feat(coderd/database/migrations/chatdmig): stop route on migrations below an early-taken version #16).site/changes. Thedump.sql,queries.sql.go,querier.goandmodels.gochanges are upstream's own, as in sync PRs.Rehearsal on a copy of the live database
This ran at 2026-11-09 03:18 UTC on head
3f29af10ae, which is this branch merged withmainat8c183ed4f8(#16, #25, #17 and #2). The run reads the livecoderdatabase only throughpg_dumpand restores the dump into a scratch database.schema_migrationsis at 639 and not dirty. The live database has 3 chatd nodes: adopt,chat_subagentsandplugins.publicandchatdtables. The only change ischatd.migration_nodes, which goes from 3 to 4. The new node000640_chat_queued_message_busy_behaviorapplies last.chatd.chat_busy_behaviortype and addschatd.chat_queued_messages.busy_behaviorasNOT NULL DEFAULT 'queue'. On8f577c996e, an earlier run filled the one existing queued row withqueue.\restricttokens differ.Validation
3f29af10ae:chatdmig routeis clean, andchatdmig checklists adopt,plugins,chat_subagents, then000640. Thechatdmigsuites,go build ./..., andgo test -count=1 ./coderd/x/chatd/... ./coderd/database/dbauthz/ ./coderd/database/ ./coderd/database/forkdb/...plusgo test -run Chat ./coderd/against Postgres 17 in Colima all pass. Earlier, on8f577c996e:chatdmigsuite against Postgres (CHATDMIG_TEST_DATABASE_URL) andcmd/chatdmigtests: pass.go build ./...: pass.go test -count=1 ./coderd/x/chatd/... ./coderd/database/dbauthz/ ./coderd/database/andgo test -run Chat ./coderd/against Postgres 17 in Colima: pass.