Repository navigation
feat: make message_agent always steer - #31175
ethanndickson merged 6 commits into
Conversation
Docs previewCheck 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. |
2ccbfb8 to
ed1f346
Compare
ed1f346 to
76a2248
Compare
|
@codex review |
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 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".
76a2248 to
b2e7e5a
Compare
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 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".
1510da5 to
5ca3da4
Compare
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@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. |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
nickvigilante
left a comment
There was a problem hiding this comment.
My agent found one inconsistency and two small nits. Otherwise, docs LGTM!
| | `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 | |
There was a problem hiding this comment.
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:
| | `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 | |
There was a problem hiding this comment.
+1, the message_agent row is still two sentences at the head.
🤖
There was a problem hiding this comment.
Took Nick's wording in 6017808e8b. The row is now one phrase.
🤖
| | `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. | |
There was a problem hiding this comment.
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.
| | `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`. | |
071ee4f to
744125d
Compare
9f190c2 to
6017808
Compare
|
Replied to both blocking comments and the nit inline. Thanks for the proof branch, it made both fixes much easier to check. 🤖 |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
6017808 to
cd4ddaf
Compare
mafredri
left a comment
There was a problem hiding this comment.
No major objections here, but tool descriptions could use a human touch.
cd4ddaf to
df0f9c7
Compare
2ee818d to
3adf095
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, 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". |
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.
…how to redirect sub-agents
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.
3adf095 to
594f30e
Compare
| "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.", |
There was a problem hiding this comment.
Minor: in case models know the meaning of steering, we could call out the term here. Not a blocker though.
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
"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
…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
message_agentno longer takes aninterruptflag, 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 callsmessage_agent, andinterrupt_agentonly stops it, which is the same split the API has after #31174. The tool result also dropsinterrupted, 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.
SendMessagenever 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 arequires_actionchat 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