Repository navigation
feat(site): show paused chats and queued edit markers - #29554
Conversation
This comment has been minimized.
This comment has been minimized.
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: c6589d35ea
ℹ️ 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".
| expect(screen.getByText("Editing")).toBeInTheDocument(); | ||
| expect(screen.getAllByText("Waiting")).toHaveLength(1); |
There was a problem hiding this comment.
Replace the DOM-only queued-state tests with visual coverage
These assertions only verify that the new labels render, and the neighboring test similarly checks whether the Enter hint is present. FE1 explicitly reserves rendered presence and visibility for Pixel-backed Storybook stories and requires Vitest assertions to target non-visual outcomes; the newly added RowUnderEditWithWaitingTail and PausedAtHead stories already cover these states, so remove these redundant tests or replace them with an observable interaction outcome.
AGENTS.md reference: site/AGENTS.md:L7-L7
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid per FE1. The PR adds no presence tests to QueuedMessagesList.test.tsx. The RowUnderEditWithWaitingTail and HeadUnderEdit stories cover the badges and the hidden Enter hint, and hover the Editing and Waiting badges so both tooltips are in the screenshots. The behavior, Enter on an empty composer not sending a head under edit, is tested in AgentChatInput.test.tsx.
🤖 Reply by Coder Agents on behalf of @mafredri.
| streamReportedTurnFinished = isTurnFinishedChatStatus(nextStatus); | ||
| wsStatusReceivedRef.current = true; | ||
| store.clearRetryState(); | ||
| const prevStatus = store.getSnapshot().chatStatus; | ||
| store.applyServerChatStatus(nextStatus); | ||
| if (nextStatus === "waiting") { | ||
| if (streamReportedTurnFinished) { | ||
| discardBufferedParts(); |
There was a problem hiding this comment.
Exercise paused stream termination through useChatStore
This changes stream buffering behavior for paused, but the useChatStore tests only exercise the equivalent waiting transition; the new chime test validates the helper but cannot catch regressions in buffered-part disposal or late-part gating here. Extend or parameterize the existing waiting stream tests with paused so this behavior change has the required Vitest coverage.
AGENTS.md reference: site/AGENTS.md:L7-L7
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid. Both stream tests in chatStore.test.tsx, drops message_part updates after the stream reports %s and discards buffered parts when status transitions to %s, run for waiting and paused.
🤖 Reply by Coder Agents on behalf of @mafredri.
| status === "requires_action" || | ||
| status === "interrupting"; | ||
|
|
||
| // Statuses a turn ends in. |
There was a problem hiding this comment.
Remove the misleading restatement above the helper
The comment merely paraphrases isTurnFinishedChatStatus, contrary to FE4, and is also broader than the implementation because error transitions end turns but are intentionally excluded from this normal-finish predicate. Delete it or document that narrower semantic distinction rather than restating the identifier.
AGENTS.md reference: site/AGENTS.md:L10-L10
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid. The JSDoc on isTurnCompletedChatStatus in chatStore.ts says a turn completes in waiting, or in paused when the queue head is under edit, and that a turn ending in error did not complete.
🤖 Reply by Coder Agents on behalf of @mafredri.
| {chat.status === "paused" | ||
| ? "Finish editing the queued message first." | ||
| : "Interrupt or wait for the agent to finish first."} |
There was a problem hiding this comment.
Use the live family status for the paused archive hint
When the per-chat stream reports paused before the global chat cache catches up, ChatTopBar correctly blocks archiving from liveChatStatus, but this branch still reads the stale chat.status and tells the user to interrupt or wait, neither of which unblocks a paused chat. The same incorrect hint appears when a paused child blocks archiving a waiting root. Pass the live or family blocking status into this component and derive the hint from that status.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid. getArchiveBlockedReason in ChatActionsMenuItems.tsx classifies every chat status in one table and returns "active" or "paused" for the chat and its children, so a waiting root with a paused child shows the paused hint. ChatTopBar passes the live stream status, because the stream handler does not update the chat record query, and ChatTreeNode passes the list status. ChatActionsMenuItems.test.ts covers the paused-child case.
🤖 Reply by Coder Agents on behalf of @mafredri.
|
|
||
| // Statuses a turn ends in. | ||
| export const isTurnFinishedChatStatus = ( | ||
| status: TypesGen.ChatStatus | null | undefined, |
There was a problem hiding this comment.
agents really love making functions take | null | undefined which can be a symptom they're not handling data very well further up in the stack
There was a problem hiding this comment.
Agreed. The helper, now isTurnCompletedChatStatus in chatStore.ts, takes TypesGen.ChatStatus, and both callers, the stream status handler in useChatStore.ts and maybePlayChime in chime.ts, pass one.
🤖 Reply by Coder Agents on behalf of @mafredri.
| const sendButtonLabel = isEditingMessage | ||
| ? "Save Edit" | ||
| : isChatPaused | ||
| ? "Queue" | ||
| : "Send"; |
There was a problem hiding this comment.
agents fucking love ternaries. not saying this should be fixed but it pains me every time. sometimes the ternary is fine but doesn't need to be put into a const, just be used inline
There was a problem hiding this comment.
sendButtonLabel in AgentChatInput.tsx is an if/else chain. It stays a variable because the button text and its tooltip both use it.
🤖 Reply by Coder Agents on behalf of @mafredri.
| it("marks the row under edit and the rows behind it", () => { | ||
| renderList([ | ||
| { ...MockChatQueuedMessage, id: 8 }, | ||
| { ...MockEditingChatQueuedMessage, id: 9 }, | ||
| { ...MockChatQueuedMessage, id: 10 }, | ||
| ]); | ||
| expect(screen.getByText("Editing")).toBeInTheDocument(); | ||
| expect(screen.getAllByText("Waiting")).toHaveLength(1); | ||
| }); | ||
|
|
||
| it("hides the Enter hint on a head under edit", () => { | ||
| renderList([{ ...MockChatQueuedMessage, id: 9 }]); | ||
| expect(screen.getByText("to send")).toBeInTheDocument(); | ||
| cleanup(); | ||
|
|
||
| renderList([{ ...MockEditingChatQueuedMessage, id: 9 }]); | ||
| expect(screen.queryByText("to send")).not.toBeInTheDocument(); | ||
| }); |
There was a problem hiding this comment.
violation of our frontend rules
There was a problem hiding this comment.
Agreed. The PR adds no presence tests to QueuedMessagesList.test.tsx; the stories cover these states. Details in the FE1 thread above.
🤖 Reply by Coder Agents on behalf of @mafredri.
| }) => { | ||
| const items = messages.map((message) => { | ||
| const editingIndex = messages.findIndex((message) => message.editing_since); | ||
| const items = messages.map((message, index) => { |
There was a problem hiding this comment.
not asking to fix here but this component has grown too complex. the mapping of items and making badge.label and badge.tooltip in the loop is indicative of the problem
There was a problem hiding this comment.
1b7e89e to
4f80901
Compare
4f80901 to
01baefb
Compare
01baefb to
ab87b95
Compare
ab87b95 to
82d977f
Compare
81774fe to
08d441e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
08d441e to
56a1322
Compare
This comment has been minimized.
This comment has been minimized.
|
Chat: Review in progress (24/24 reviewers complete) | View chat
|
96b96a8 to
a4332ce
Compare
a4332ce to
bc5e601
Compare
bc5e601 to
860a4f4
Compare
72ace77 to
9849f7f
Compare
The backend pauses a chat while its queue head is under edit and marks the row with editing_since. The frontend displays both: paused counts as a completed turn for the chime and for dropping late stream parts, blocks archiving with its own hint, and labels the send button Queue. Enter in an empty composer does not send a head under edit. Queued rows show an Editing badge on the marked row and a Waiting badge on the rows behind it. This PR only displays the marker; the row actions to begin or end an edit come in the next one. Queued rows are compared structurally because a marker or content change keeps the row's ID, which the ID-only comparison treated as unchanged.
The buffered-parts test sent only waiting, so a paused status that stopped setting the completed-turn flag went unnoticed. The test now runs for both completed statuses.
Queued rows are compared by content, so restoring a pre-request snapshot now overwrites a same-ID row whose editing_since changed while a delete, compact or history edit was in flight. These rollbacks restore the queue only when no queue update arrived during the request, using the queue convergence fence. The delete handler moves next to runPromoteQueuedMessage so it can be tested, and the hook's cache writer and REST re-hydration get tests for a change that keeps every row ID.
…edit The server queues every send while the queue head is under edit, not only while the chat is paused; a chat in error with an edited head queues too. The label now also reads the head's editing_since marker.
The backend allows archive only from waiting and error. A status table typed as Record<ChatStatus, ...> makes a new status fail the type check until it is classified, where the previous check let any unlisted status archive. Tests now cover error with a waiting child and a paused chat with no children.
The queued-list stories hovered row text, so neither badge tooltip was in a screenshot. One story now hovers the Editing badge and one the Waiting badge. The paused page story builds its row from the shared under-edit mock.
A paused chat has finished its turn, like a waiting one, but the sub-agent tool mapped paused to the fallback, so a completed spawn could render as running.
The completed-status JSDoc restated the helper's name; it now says when a turn completes in waiting or paused. The chime's inline comment repeated its doc comment and called one status "the active state".
Plain Enter sends only after the shortcut preference loads; until then the composer uses the modifier shortcut. Pressed earlier, Enter sent nothing whether or not the gate existed, so the test passed with the gate deleted when it ran alone. It now waits until the send button advertises plain Enter and includes a head that is not under edit.
A failed promote restored the pre-request queue, which overwrote a queue update received during the request, such as a new Editing marker. Restoring only when no update arrived is not enough: the promoted ID is suppressed during the request, so that update was stored and cached without the promoted row, which the server still holds after the failure. When the queue convergence fence moved during the request, the queue is now refetched and applied as an authoritative update once the ID is unsuppressed. If the refetch fails, the snapshot is restored. Either result is also written to the messages cache. The result is dropped when the active chat changed or another queue update arrived during the refetch. With no update, the snapshot is restored as before.
9849f7f to
dff1c88
Compare
The backend (#29215) pauses a chat when its queue head is under edit and marks that row with
editing_since. This PR displays both. The row actions that begin, save, or cancel an edit are in #29555.pausedcounts as a completed turn: the chime plays, late stream parts are dropped, and a paused sub-agent shows as completed in its parent's tool card. Archiving a chat whose family has a paused member is blocked, with a hint that names the queued edit. The send button reads "Queue" while a turn runs, while the chat is paused, and while the queue head is under edit, because the server queues the send in each case. Enter in an empty composer does not send a head under edit. Queued rows show an Editing badge on the row under edit and a Waiting badge on the rows behind it.For review: queued rows are compared structurally (
lodash/isEqual), because a marker or content change keeps the row's ID and an ID comparison would drop the update.chatStore.createStore.test.tsand the queue cache tests inchatStore.test.tsxcover this. A failed delete, promote,/compact, or history edit restores its pre-request queue only when no queue update arrived during the request; otherwise a failed promote refetches the queue (chatQueueReconciliation.ts).Part of the CODAGT-971 frontend stack: 2 of 3.