Skip to content

refactor(coderd): deliver queued chat messages through one helper - #31153

Merged
ethanndickson merged 1 commit into
ethanndickson/chat-queue-delivery-modefrom
ethanndickson/chat-queue-batch-delivery
Nov 9, 2026
Merged

ethanndickson merged 1 commit into
ethanndickson/chat-queue-delivery-modefrom
ethanndickson/chat-queue-batch-delivery

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

FinishTurn, FinishInterruption and a send to an errored chat with a queue each had their own code for moving a queued message into history. They now share deliverQueuedRows, which takes a list of queued rows, so the next PR can deliver the whole steer lane at once instead of just the queue head. Delivery still only takes the queue head here, so this doesn't change behaviour. PromotedMessages on the turn and interruption results is now a slice to match.

"Send now" on an errored chat, or one waiting on tool results, still has its own copy of that code in PromoteQueuedMessage for now. #31156 replaces it with a move into the steer lane, which then goes through deliverQueuedRows like everything else.

I've also deleted GetChatQueuedMessagesByPosition and GetChatQueuedMessageHead, as GetChatQueuedMessages already returns the queue in delivery order.

Part of CODAGT-1140

@linear-code

linear-code Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T10:35:22.686971Z 7f0c72b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 1ff5e09d45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@ethanndickson
ethanndickson marked this pull request as ready for review October 22, 2026 05:09
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 1ff5e09 to 34ac687 Compare October 22, 2026 08:49
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 34ac687 to 7a3d8f4 Compare October 22, 2026 09:11
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch 2 times, most recently from 0dc9f89 to 0e91d6c Compare October 23, 2026 01:47
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 0e91d6c to bd30e3e Compare October 26, 2026 04:19
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from bd30e3e to b283be6 Compare October 27, 2026 00:46
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from b283be6 to 28493ca Compare October 30, 2026 02:18
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 28493ca to 446d1c6 Compare November 2, 2026 06:50
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 446d1c6 to 7f0c72b Compare November 3, 2026 05:56
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 7f0c72b2b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 7f0c72b to 42a8be9 Compare November 5, 2026 06:41
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.
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-queue-batch-delivery branch from 42a8be9 to 7a352a0 Compare November 6, 2026 06:03
@ethanndickson
ethanndickson merged commit bfff9e6 into main Nov 9, 2026
56 of 80 checks passed
@ethanndickson
ethanndickson deleted the ethanndickson/chat-queue-batch-delivery branch November 9, 2026 04:55
ethanndickson added a commit that referenced this pull request Nov 9, 2026
…30074)

This is where the steer lane gets delivered mid-turn. Before each
assistant model call, the generation task now runs
`DeliverSteerMessages`. If there are steer messages queued, they go into
history and the task returns without calling the model, and the history
change starts a new generation task that sends them to the model. It
never cancels anything, it just waits for the in-flight call and that
step's tool calls to finish. Queue messages still wait for turn end, and
compaction calls don't deliver steer messages, as they don't answer the
user.

A delivered steer message is a new prompt, so tracing treats it like any
other newer prompt: a new `chat_turn` span starts at it, and the span
before it ends as `abandoned`.

`chatd.SendMessage` now accepts `steer`, but the HTTP handler and
`message_agent` still only pass `queue` or `interrupt`, so the API
doesn't change in this PR. #31174 makes `steer` the API default. Outside
of tests, nothing creates steer messages until #31155 stores interrupt
sends in the steer lane, so this PR doesn't change behaviour for users
on its own.

I've split the earlier version of this PR up, so some of the review
comments are now addressed elsewhere in the stack. #31153 moves queue
delivery into one helper, #31154 adds the two lanes, #31155 stores
interrupt sends in the steer lane, and #31156 makes "Send now" steer,
which also fixes two presses being delivered in reverse order.

This supersedes #29784.

Since the first review, a steer message delivered before a model call
also records `queue_wait`, like the other delivery points.

Part of CODAGT-1140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants