Repository navigation
fix: run chat interrupt messages before earlier queued messages - #30729
Conversation
A busy_behavior=interrupt send on a running chat appended the message to the queue tail, so finishing the interruption promoted an older queued message first. The send that starts the interruption now moves to the queue head. Sends during a pending interruption still go to the tail, so a burst keeps its order. On requires_action chats and errored chats with a queue, an interrupt send now inserts the message into history ahead of the queue.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97a2086d32
ℹ️ 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 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. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddbf01843a
ℹ️ 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".
…ends The hooks pre-check rejected interrupt sends to E1 and A* chats with a full queue, although those sends go straight into history. chatstate now owns one routing rule and one capacity check, CheckSendMessageQueueCapacity, which the hooks pre-check and Tx.SendMessage both call.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d643f3ed44
ℹ️ 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: Allow immediate unowned interrupts when the queue is full This was already the case before this PR, so I'm leaving it out of scope here. On main, sendMessageInterrupt called insertQueuedMessage, which ran requireQueueCapacity before finishUnownedInterruption could promote the row. The hooks pre-check rejected the send too. So main also returns 429 for an interrupt to an unowned R1 chat at a full queue. This PR only changes where an interrupt that succeeds goes in the queue. Unowned I1 interrupts and E1 queue sends have the same gap, because they also add one row and promote one row. If we change the capacity rule, it should cover all of them in a separate PR. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
If an agent is working with a message already queued, and you send another message with
busy_behavior=interrupt, the agent stops, but then answers the queued message first and yours second. The interrupt send appends to the end of the queue, and finishing the interruption promotes the head of the queue, which is the older message.To fix, we'll put the message that starts the interruption at the front of the queue, so it's the one promoted once the partial response is saved. Messages sent whilst an interruption is already in progress still go to the back, as they do today, so a burst of interrupts keeps the order it was sent in. On a chat waiting on dynamic tool results, or one that errored with messages still queued, an interrupt send now goes straight into history ahead of the queue (cancelling any pending tool calls), instead of waiting behind it.
This is just a narrow fix to the current queue behaviour, and it doesn't change the API shape. It's compatible with the queued message delivery rework I've got in progress, which replaces these code paths. The one case this doesn't fix is a second interrupt sent during the first, which still waits behind earlier queued messages; that rework handles it properly.