Skip to content

feat: make message_agent always steer - #31175

Merged
ethanndickson merged 6 commits into
ethanndickson/chat-steer-default-apifrom
ethanndickson/message-agent-steer
Nov 9, 2026
Merged

ethanndickson merged 6 commits into
ethanndickson/chat-steer-default-apifrom
ethanndickson/message-agent-steer

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

message_agent no longer takes an interrupt flag, and always steers. If the child is busy, it gets the message before its next model call and keeps working. To correct or redirect a busy child, the parent just calls message_agent, and interrupt_agent only stops it, which is the same split the API has after #31174. The tool result also drops interrupted, as it was just whether the child was running before the send.

That was the last caller of the interrupt busy behaviour, so chatd and chatstate drop it too. SendMessage never interrupts now. On a busy chat it only ever adds the message to a lane, so the sends that moved a running chat to interrupting, or a requires_action chat back to running, are gone, along with the send's inline interruption finish for chats with no worker. Most of the diff is deleted tests.

A steer send to a paused chat, or to an errored chat whose next message is being edited, no longer fails with a 429 at the queue limit when it's delivered straight away, which is whenever the message being edited is a queue message.

Part of CODAGT-1140

@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

CODAGT-1140

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-05T08:51:35.608373Z 3adf095 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76a2248583

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

Comment thread coderd/x/chatd/subagent.go Resolved
@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch from 76a2248 to b2e7e5a Compare October 26, 2026 04:19
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1510da582a

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

Comment thread coderd/x/chatd/subagent.go Resolved
@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch from 1510da5 to 5ca3da4 Compare October 26, 2026 05:38
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 071ee4fb1e

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

Comment thread coderd/x/chatd/chat_mutations.go Resolved
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

re: Avoid rejecting E1 recovery from a stale preflight status

The window is real, but I don't think it's worth closing. The rejection is transient and matches the snapshot: when the send read the chat, it was running with a full queue, so a 429 is the same answer it would have got a few milliseconds earlier. The next send reads E1, skips the cap, and resumes the chat, so the permanent lockout that 5ca3da4 fixed doesn't come back. The cap itself is still enforced under the lock. main has the same unlocked preflight with the same race for interrupt sends from R1 to E1. Closing it would need either a second locked transaction on the send path, or dropping the preflight and running user_prompt_submit hooks for prompts the transaction then rejects.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 071ee4fb1e

ℹ️ 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 26, 2026 07:09

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My agent found one inconsistency and two small nits. Otherwise, docs LGTM!

Comment thread docs/ai-coder/agents/index.md Outdated
| `list_subagent_models` | List the models available for `spawn_agent`'s `model_config_id` argument |
| `wait_agent` | Wait for a sub-agent to complete and collect its result |
| `message_agent` | Send a follow-up message to a running sub-agent |
| `message_agent` | Send a follow-up message to a sub-agent. A busy sub-agent receives it before its next model call |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: every other row in this table is a single phrase with no final period, so this row is the only one with two sentences. You could join them into one phrase to match:

Suggested change
| `message_agent` | Send a follow-up message to a sub-agent. A busy sub-agent receives it before its next model call |
| `message_agent` | Send a follow-up message to a sub-agent; a busy sub-agent receives it before its next model call |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, the message_agent row is still two sentences at the head.

🤖

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took Nick's wording in 6017808e8b. The row is now one phrase.

🤖

Comment thread docs/ai-coder/agents/architecture.md Outdated
| `wait_agent` | Waits for a sub-agent to finish and collects its result. |
| `message_agent` | Sends a follow-up message to a running sub-agent. |
| `message_agent` | Sends a follow-up message to a sub-agent. An idle sub-agent starts a new turn. A busy sub-agent receives the message before its next model call. |
| `interrupt_agent` | Halts a sub-agent's current turn; it transitions to waiting or running if there are queued messages. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: since message_agent no longer interrupts, this table no longer says how to stop a busy sub-agent before redirecting it. The chat API docs keep that pattern (docs/ai-coder/mcp-server.md:191, docs/ai-coder/agents/tasks-to-chats-migration.md:156). If you want the sub-agent docs to match, this row is a better home than the message_agent row you just cleaned up. Ignore this if leaving the pattern out was deliberate.

Suggested change
| `interrupt_agent` | Halts a sub-agent's current turn; it transitions to waiting or running if there are queued messages. |
| `interrupt_agent` | Halts a sub-agent's current turn; it transitions to waiting or running if there are queued messages. To stop a busy sub-agent before you redirect it, call `interrupt_agent`, then `message_agent`. |

@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch from 071ee4f to 744125d Compare October 27, 2026 00:46
@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch from 9f190c2 to 6017808 Compare November 4, 2026 08:55
@ethanndickson

Copy link
Copy Markdown
Member Author

Replied to both blocking comments and the nit inline. Thanks for the proof branch, it made both fixes much easier to check.

🤖

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 6017808e8b

ℹ️ 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/message-agent-steer branch from 6017808 to cd4ddaf Compare November 4, 2026 10:56

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No major objections here, but tool descriptions could use a human touch.

Comment thread coderd/x/chatd/subagent.go Resolved
Comment thread coderd/x/chatd/subagent.go Resolved
Comment thread coderd/x/chatd/subagent.go Resolved
Comment thread coderd/x/chatd/subagent.go Resolved
@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch from cd4ddaf to df0f9c7 Compare November 5, 2026 04:02
@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch 2 times, most recently from 2ee818d to 3adf095 Compare November 5, 2026 08:38
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 3adf0951ba

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

message_agent no longer takes an interrupt flag. A busy child gets the
message before its next model call and keeps working. To stop the child
first, the parent calls interrupt_agent, then message_agent.

message_agent was the last caller of the interrupt busy behavior, so
chatd and chatstate drop it. SendMessage no longer interrupts from any
state.
… full queue

message_agent always steers now, and interrupt_agent does nothing for a
chat in the error state. So when a child chat stopped on an error with a
full queue, the queue cap rejected every message_agent send and the
parent could not resume the child.

A send from E1 queues the message and delivers at least one queued
message in the same transaction, so the queue never grows. Apply the
cap only to sends that can make the queue longer.
message_agent steers, so a correction, a changed scope or a handoff
reaches a busy child before its next model call. Remove the advice to
call interrupt_agent first from the message_agent description and the
agents architecture docs. interrupt_agent stays available to stop a
child.
message_agent no longer says "on the message" and no longer limits its use to correcting or redirecting a busy child. interrupt_agent no longer says that an interrupt "cancels the reply": it says to use it only to stop the child, and to call message_agent without an interrupt first.
The architecture page said an interrupted sub-agent goes to waiting or
running. It goes to paused when the next queued message is being edited,
as the index page already says.
@ethanndickson
ethanndickson force-pushed the ethanndickson/message-agent-steer branch from 3adf095 to 594f30e Compare November 6, 2026 06:03
"collect the child's response. A handoff is "+
"acknowledged only when wait_agent returns the child's "+
"response to your handoff message; a message_agent result is "+
"not an acknowledgment.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: in case models know the meaning of steering, we could call out the term here. Not a blocker though.

@ethanndickson
ethanndickson merged commit a0be9d0 into main Nov 9, 2026
38 of 60 checks passed
@ethanndickson
ethanndickson deleted the ethanndickson/message-agent-steer branch November 9, 2026 04:55
ethanndickson added a commit that referenced this pull request Nov 9, 2026
An interrupt send to a running or interrupting chat now goes to the end
of the steer lane, and the whole steer lane goes in once the
interruption finishes. Before, it went to the head of the queue lane if
it started the interruption, or the tail if the chat was already
interrupting, and only the head went in. So if you sent two messages
with interrupt whilst the agent was stopping, the second one went to the
back of the queue. Now both go in once it stops, in the order you sent
them.

Interrupt is still a send option here, it just means "interrupt, then
steer" now. #31174 removes it from the API and #31175 from
`message_agent`, so you call the interrupt endpoint first, then send.

There's one gap until #31156. "Send now" still only moves a message to
the head of its own lane, so if you send with interrupt and then press
"Send now" on a queued message before the agent stops, only the steer
lane goes in when it stops, and the "Send now" message waits for the
next turn end. #31156 makes "Send now" steer too, so both go in.

The `codersdk` change is just the doc comment on
`ChatBusyBehaviorInterrupt`.

Part of CODAGT-1140
ethanndickson added a commit that referenced this pull request Nov 9, 2026
"Send now" on a queued message (`POST
/api/v2/chats/{chat}/queue/{queuedMessage}/promote`) now just moves it
to the end of the steer lane. It never interrupts the chat, so it can't
cancel the step that would have answered it. The endpoint's request
doesn't change. Before, it moved the message to the head of the queue
with `MIN(position) - 1`, so if you pressed "Send now" on two messages,
the second one went first. With a queue of `Q1 Q2 Q3 S4`, "Send now" on
`Q1` then `Q3` now delivers `S4 Q1 Q3`, and `Q2` keeps waiting.

If the chat has errored or is paused, the steer lane goes in straight
away, like a send. Otherwise it goes in at the next delivery point:
before the next model call, when the turn ends, or when an interrupt
finishes. Stop is the only thing that interrupts.

"Send now" and "Remove" on a message that's already been delivered now
return a 404 instead of a 409, the same as editing one, and "Remove" on
an archived chat returns a 400.

In chatstate, `SteerQueuedMessage` replaces `PromoteQueuedMessage`. It
moves the message to the end of the steer lane, and on an errored or
paused chat it also delivers the steer lane and resumes the chat, like a
send does. The `SteerChatQueuedMessage` query sets `position =
nextval(...)` and replaces `ReorderChatQueuedMessageToHead`. Most of the
diff is tests.

#31174 then makes `steer` the API default and removes `interrupt` as a
busy behaviour, #31175 makes `message_agent` always steer, and #31173
updates the site.

Part of CODAGT-1140
ethanndickson added a commit that referenced this pull request Nov 9, 2026
…ehavior (#31174)

Breaking API Change for changelog:

> `POST /api/v2/chats/{chat}/messages` now steers by default. If the
chat is busy, the message is delivered before the agent's next model
call, instead of after the turn ends. `busy_behavior` accepts `steer` or
`queue`, and `interrupt` now returns a 400. To redirect the agent, just
send a message, and only call `POST /api/v2/chats/{chat}/interrupt` to
stop it. Queued messages now include their `busy_behavior`.

This is where steering becomes the default for API clients. A send
without a `busy_behavior` used to wait for the turn to end, and now it
goes in the steer lane, so the agent sees it before its next model call
and keeps going. `queue` still waits for the turn to end.

Interrupt isn't a busy behaviour any more. Since #31155 it just meant
"interrupt, then steer", so the API now returns a 400 for it, and
`codersdk.ChatBusyBehaviorInterrupt` is gone. `coder_send_chat_message`
in the MCP server gets the same default and enum. A steer message
already corrects a busy agent, and combining it with an interrupt goes
wrong in either order, so the docs and the MCP tool descriptions now say
to send a message to redirect the agent, and to interrupt only to stop
it.

Queued messages now report their `busy_behavior`, and the queue lists
the steer lane first, so clients can show which messages go in at the
next step and which wait for the turn to end. A message moved with Send
now reports `steer`.

The site doesn't send a `busy_behavior`, so its sends start steering
with this PR, but its queue UI doesn't know about the steer lane until
#31173. chatd still accepts `interrupt` internally, as `message_agent`
uses it, and #31175 removes both.

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.

3 participants