Skip to content

feat(coderd): add a steer lane to queued chat messages - #31154

Merged
ethanndickson merged 2 commits into
ethanndickson/chat-queue-batch-deliveryfrom
ethanndickson/chat-steer-lane
Nov 9, 2026
Merged

ethanndickson merged 2 commits into
ethanndickson/chat-queue-batch-deliveryfrom
ethanndickson/chat-steer-lane

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

As suggested on #30074, steer messages are now their own lane, rather than queue rows that jump ahead with a lower position. chatstate uses a queued message's busy_behavior as its lane, and the steer lane always goes first. GetChatQueuedMessages lists the steer lane first, so the queue is shown in the order it'll actually be delivered.

At turn end, when an interruption finishes, and on a send to an errored chat, the whole steer lane goes in. If there aren't any steer messages, the queue head goes in like it does today. So with a queue of Q1 S1 Q2 S2, turn end delivers S1 S2, and Q1 waits for the next turn end.

chatstate accepts steer here, but nothing sends it yet, so users won't see a change. Until later in the stack, a few things still ignore the steer lane:

  • An interrupt send goes to the head of the queue lane, so it waits behind any steer messages. feat: store interrupt sends in the steer lane #31155 moves it to the end of the steer lane.
  • "Send now" on a running or interrupting chat only moves the message to the head of its own lane, so when the interruption finishes, the steer lane goes in instead of it.
  • "Send now" on an errored chat, or one waiting on tool results, puts the message into history straight away, ahead of any queued steer messages.

#31156 fixes both "Send now" cases by making it steer. None of these can happen yet, as there are no steer messages to get in the way.

I've added a "Queued message lanes" section to the chatd architecture doc. Most of the diff is new cases in the transition matrix tests.

Since the first review, lane rule 3 in the architecture doc also says that delivery stops at a message under edit, and which model and reasoning effort a batch of delivered messages uses.

Part of CODAGT-1140

@linear-code

linear-code Bot commented Oct 22, 2026

Copy link
Copy Markdown

CODAGT-1140

@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:56.236223Z 2d0f136 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. Can't wait for the next one!

Reviewed commit: 2a87da4946

ℹ️ 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-steer-lane branch from 2a87da4 to 374867d Compare October 22, 2026 08:49
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-steer-lane branch from 374867d to 66164be Compare October 22, 2026 09:11
@ethanndickson
ethanndickson marked this pull request as ready for review October 22, 2026 10:36
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-steer-lane branch 2 times, most recently from 51639c7 to 7bbb242 Compare October 23, 2026 01:47
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-steer-lane branch from 7bbb242 to 5248dcd Compare October 26, 2026 04:19
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-steer-lane branch from 5248dcd to 21072a6 Compare October 27, 2026 00:46
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-steer-lane branch from 21072a6 to 2e0cd29 Compare October 30, 2026 02:18
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 2d0f1367f3

ℹ️ 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-steer-lane branch from 2d0f136 to 294b67b Compare November 5, 2026 06:41
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.
@ethanndickson
ethanndickson force-pushed the ethanndickson/chat-steer-lane branch from 294b67b to 464c55a Compare November 6, 2026 06:03
@ethanndickson
ethanndickson merged commit 0616658 into main Nov 9, 2026
84 of 104 checks passed
@ethanndickson
ethanndickson deleted the ethanndickson/chat-steer-lane 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