Skip to content

fix: take chat state from the stream only - #30478

Merged
mafredri merged 194 commits into
mainfrom
fix/chat-messages-refetch-overwrite
Nov 17, 2026
Merged

mafredri merged 194 commits into
mainfrom
fix/chat-messages-refetch-overwrite

Conversation

@mafredri

@mafredri mafredri commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

On main, the chat page keeps two copies of a chat's messages and queue: the messages query cache and the store. A refetch or an action response can replace state that a newer stream event already set.

This PR makes the store the only copy. It implements D1 and D2 of the RFC Chat stream contract: one copy of each chat in the web client, which describes the design and the alternatives. The diff under site/ removes about 2,600 lines net, about 900 of them source.

Stacked on #29662, which adds snapshot_version to the stream.

Changes

  • One store per chat (D1). The store loads the newest messages page once. After that, only stream events and older pages change it. The query cache holds the store and removes it 5 minutes after the chat's last use, so returning to a chat within that time requests no messages. The messages query cache, its writers and chatQueueReconciliation.ts are deleted. The client no longer sets a chat status itself, and it does not read messages or queue rows from action responses.
  • Sync by snapshot version (D1). The stream opens at the page's snapshot_version and reconnects at the highest version among the events that the client applied. A history_reset deletes the stored messages from its from_message_id on.
  • Pending actions (D2). A send, an edit, a promote, and a queued message's delete, edit begin, edit end and save show their direct effect at the click, on the message or row the user acted on. A send shows its new row where the server places it: in the transcript when the chat runs no turn and delivers it next, otherwise at the end of its lane (steer or queue). Changes to other rows show when the stream reports them. A pending action ends when the stored state holds its result, or when the request fails:
    • a delete, when the stored queue lacks the row;
    • a promote, when the stored row is in the steer lane or gone;
    • a queued edit, when the stored row's editing_since matches or the row is gone;
    • a message edit, when the edited message is gone and a later user message is stored;
    • a send, at the next new user message or queued row, oldest send first.
  • One request at a time. The five mutations behind pending actions share one TanStack Query scope per chat, so the server makes the changes in click order.
  • Delivered rows. The shown queue omits a row once a stored message names it in queued_message_id, so a delivered row never shows in the queue and the transcript at once.
  • Pending rows. A message or queued row that a pending action shows has an ID above every database ID, and its Edit, send-now and remove actions are unavailable until the stream reports the row.
  • Server tests. Two tests in coderd/exp_chats_test.go cover events that the client no longer backs up with a refetch: the ones after /clear and after a queued message is deleted.

Behavior that differs from main

  • A send shows at the click. On main, it showed from the POST response.
  • On the chat page, the composer clears at the click and stays editable during the request. Enter sends nothing, and the page offers no Edit, until the request completes. A failed send puts the sent text back, in front of anything typed since. A history edit or a queued save shows the compose draft during the request. The new-chat page still locks its composer during the create request. On main, the composer was disabled during a request, and a send kept its text there until it succeeded.
  • Queued rows have no spinner and no request lock of their own. The pending action changes the row at the click: a deleted row is gone, a promoted row moves to the steer lane, and a row under edit shows its badge. A refused request shows the row as before. On main, the list hid or disabled rows itself while a request ran.
  • A failed delete of a queued message shows a toast. On main, it showed nothing.
  • A queued edit refused with a 404 shows the row as before, and the row leaves at the queue_update of the change that removed it. On main, the client deleted the row from its own queue.
  • A failed send or edit scrolls the transcript to the end, and a successful edit no longer scrolls.
  • A WebSocket message that fails to parse closes the socket, and the reconnect resumes from the last applied version and clears the error. On main, the client skipped the message, lost its events, and kept the error.
  • Another change's event does not end a pending action. With the queue [A, B, C], deleting A and then B before the first result arrives keeps B hidden when the queue_update for A arrives.

Deviations from the RFC

The RFC is approved, and its page is not changed yet. D2 differs in three places:

RFC D2 This PR Why
Rule 2: the client shows each part until the next stream event of a listed type. A pending action ends when the stored state holds its result (see Changes). The next event of a type can report another change: the user's second action, or the server sending queued messages. The user's change then disappeared and came back.
Rule 1 and the table: the client shows the change where the server will put it, including the rows of the steer lane as sent messages after a promote, and an empty queue after an edit. The client shows the direct effect on the acted-on message or row. Other rows change when the stream reports it. Predicting the server's other changes needs the client to find the event that confirms each one.
Results table: "In a shared chat, another writer causes a stream event of the same type during the request." Not applicable. Only a chat's owner can write to it: sharing grants read only, and the site owner role has no chat permissions.

Known limits

The client assumes one user who acts in one client. In the cases below, the queue or the transcript is wrong until the next stream message corrects it.

  • A message that this client did not send arrives during a send. It can come from another client of the owner (a second tab or an API integration) or from a parent agent that writes to its subagent's chat. The send can end at that message, and the user's message is then missing until the stream sends it.
  • A send right after a promote or a save that restarts an errored or paused chat, before the stream reports the restart, shows as a message and then as a queued row.
  • A message edit fails after it replaced a pending send or edit. The replaced action's result shows when the stream reports it, not before.
  • A send after a message edit that the stream has not reported yet. Content from an action that the edit replaced can end the send, and the message is then missing until the stream sends it.
  • A steer send is delivered before an older queued send, and the read that reports both arrives in two WebSocket messages. Between the two, one send shows twice and the other is missing.
  • The user begins a queued message's edit, saves it and begins it again before the stream reports the first begin. The row switches between its old and new text until the stream reports the last begin.
  • The user begins the edit of a second queued message, and that request fails before the stream reports the edit of the first. The first message shows no edit mark until the stream reports it.
Decision log
  • A pending action is keyed by an ID the client holds at the click. A queued row's ID never returns, and busy_behavior only changes from queue to steer, so the delete and promote conditions only move one way.
  • A send has no ID until the server creates it, so sends end by counting. New user content is a queued row whose ID the store has not received, or a user message with an ID above the highest stored one. A delivered message counts by its queued_message_id, so a send counts once. Rows count by ID and not by a highest ID, because the server delivers a steer row before an older queue row. Rejected: reading the ID from the action's response (the client would depend on the response, and the stream can report the change first), and a client-chosen ID stored with the message (it needs a new stored field on the server).
  • A message edit ends by its message ID, not by counting. The edit's history_reset removes the edited message, and the next user message above it is the edit's. An edit also replaces earlier pending sends and message edits, because it deletes what they add.
  • One pending action per queued row, and one pending begin of an edit per chat. The server allows one row under edit, so an earlier begin on another row cannot show its result.
  • The mutation scope, not the store, orders the requests. A mutation that waits in its scope is pending, so the composer stays locked for it. A chain in the store started the mutation late and left isPending false.
  • No rule for reconnects. Rejected: ending, at a new connection's first read, the pending actions whose requests had resolved. No sequence of one client's actions needs it, and it adds a store method and a hook into the stream handler.
  • The store did not get smaller. chatStore.ts has 74 more lines than with the RFC's next-event rule: the server-placement prediction is gone, and the end conditions and the counting replace it.
  • No per-row lock or spinner. The pending action changes the row at the click, so the UI does not offer a second request of the same kind on it.
  • The timeline and the composer use the chat record's status until the stream reports one. The store has no status between a chat's open, or reopen, and the stream's first status event, and the timeline renders a chat without a status as an ended turn. main copied the record's status into the store; here the components fall back to it, so the store's status still comes only from the stream.
  • A pending action sets no status. The store's status changes only at status and error events, so "Thinking" shows when the stream reports the turn.
  • An action carries content, not a message. The store builds the pending row and takes the other fields from the message it holds.
  • The marked row comes from the store. useQueuedMessageEdit no longer reads the marker request's state, because a pending begin or end marks the row in the shown queue.
  • No Edit while a request is pending. A failed request's rollback replaces the composer's content, so it would overwrite an edit opened during the request.
  • frontend-deep-review, not fixed. One should-fix: the editable composer (RFC D2 rule 4) could be its own PR. It is not split, because the composer must clear at the click here (the transcript shows the sent message at the click), so a split would ship an interim composer that clears and locks. Nits: WithMessageHistory and SendingFromHistoryDoesNotSnapToBottom keep assertions in their play functions; both stories are excluded from Pixel on main, and the second holds the only check that a pending user row anchors the scroller. Two naming nits are unchanged, both names that main has: streamError in liveStatusModel.ts and hasFileReferences. One nit from the latest round is unchanged: the truncation of the transcript from an ID is written twice, in buildView and in resetHistoryFrom.
Deleted tests

The branch deletes 112 it blocks, 18 describe blocks, 11 stories, and one test file. A test that kept its assertions under a new name or a renamed describe counts as renamed, not deleted. File names are shortened: createStore is chatStore.createStore.test.ts, and chatStore.test is chatStore.test.tsx.

Deleted Why Covered by
chatQueueReconciliation.test.ts, runEditQueuedMessage (3 tests) The module is deleted. Begin, end and save are pending actions. A 404 does not drop the row; the row leaves at the server's queue_update. createStore: the pending actions show the server's change cases "begin a queued edit while another row is under edit" and "save a queued edit", and "a failed queued edit shows the queue as before and drops no row". AgentChatPage.test: "an Edit refused with %i reports it and can be retried". submitChatTurn: "saves a queued row with its chips and the marker cleared and makes no chat send".
chatQueueReconciliation.test.ts, the rest of the file (26 tests): restoreOptimisticRequestSnapshot, runPromoteQueuedMessage, runDeleteQueuedMessage, reconcilePromotedQueuedMessages, buildInactiveChatQueueReconciliation, settlePromotedQueuedMessages, submitEdit The module is deleted. A failed request removes its pending action, and the queue changes only at queue_update. createStore: "stops showing a failed action", and the pending actions show the server's change cases "promote in an errored chat", "promote in a paused chat", "send to an errored chat with a queue", "send after turn to an errored chat with a queue" and "delete the row that holds a paused chat". submitChatTurn: "reports send failures and invalidates the chat", "restores the transcript when an edit fails", "$name when a history edit fails". AgentChatPage.test: "reports a failed promote and keeps the row queued", "reports a failed Remove from queue". chatStore.test: "shows a chat's pending send in no other chat".
createStore, applyAuthoritativeQueuedMessages (13 tests) The promote bookkeeping is deleted: promoted IDs, fences and the refetch after a promote. createStore: the pending actions show the server's change cases for promote, the pending action ends case "a promote at the queue update that moves the row to steer", "keeps a pending $kind through a queue update from before it", "shows nothing for a promoted row the queue no longer holds", "applies a queue update that only changes editing_since, content or lane".
createStore, setChatStatus (2 tests), and "returns true after optimistic send: clearStreamState + setChatStatus('running') + upsertDurableMessage" setChatStatus is deleted. The status comes only from stream events. createStore: the applyServerChatStatus tests, "returns true when WS delivers user message + status:running (fresh send)". chatStore.test: "drops message_part updates after the stream reports %s".
createStore: upsertDurableMessage (3 tests), setStreamState (1 test), duplicate message deduplication (1 test) These writers had no production caller. createStore: the upsertDurableMessages tests, including "keeps one ID for a message that appears twice".
chats.test, message upsert fan-out and history replacement (13 tests), and the patchChatMessages, invalidateChatMessages and cancelChatMessages tests The messages query cache and its helpers are deleted. createStore: the upsertDurableMessages tests. chatStore.test: "replaces messages after history_reset".
chats.test, 10 editChatMessage cache tests; chatMessageEdits.test, reconcileEditedMessageInCache (1 test) The cache projection, rollback and response reconciliation are deleted. An edit shows a pending action until its new message is stored. submitChatTurn: "shows an edit from submit until the stream reaches it", "restores the transcript when an edit fails". createStore: the pending action ends case "an edit at its new message". chatStore.test: "keeps the messages below a history_reset's from_message_id".
chats.test: "aborts the page and fill requests when the query is cancelled" The infinite query is deleted. chats.test: "passes the abort signal to the page and fill requests".
chatStore.test, 6 tests of stream writes to the query cache The stream no longer writes the query cache. chatStore.test: "reopens a remounted chat at its last snapshot version without fetching its page again", "applies each event when it arrives", "replaces messages after history_reset". createStore: "applies a queue update that only changes editing_since, content or lane".
chatStore.test, 8 REST hydration tests, including store/cache desync protection (3 tests) The store loads the newest page once, not at each refetch. chatStore.test: "opens the stream only after the newest page has loaded", "reopens a remounted chat at its last snapshot version without fetching its page again".
chatStore.test, 6 tests of the status from REST, including "applies a refetched status after acceptServerChatStatus" The status comes only from the stream. chatStore.test: "drops message_part updates after the stream reports %s", "clears a request failure when an errored chat starts a new turn".
chatStore.test: "messages are cleared immediately on chat switch before new query resolves", "startTransition deferred parts are discarded after chat switch" Each chat has its own store. chatStore.test: "shows only the new chat's state after a chat switch", "does not use one chat's snapshot version for another chat".
chatStore.test: "passes latest message ID on reconnect for catch-up" The client sends snapshot_version, not after_id. chatStore.test: "opens the stream at the page's snapshot version and reconnects at the highest event version". api.test: "opens the stream at the given snapshot version".
chatStore.test: "continues processing after parse error" A WebSocket message that fails to parse closes the socket. chatStore.test: "resyncs from the last applied version when a frame fails to parse".
chatStore.test: "buffers a history_reset replacement split across WS frames" A reset applies on arrival from from_message_id. chatStore.test: "keeps the messages below a history_reset's from_message_id".
ChatSummaryPanel.test: the "skips the request during hydration" case The state cannot occur: the view mounts after the newest page loads, and one synchronous call sets an older page and hasMoreMessages. None needed: the case "skips the request when all are loaded" asserts the same empty call list.
QueuedMessagesList.test: "keeps the row and disables every action while onPromote is pending, and re-enables them after it fails"; QueuedMessagesList.stories: SendNowPending, DeleteRejectionRestoresRow The list no longer tracks requests or hides rows. A pending action changes the row at the click, and a failed request removes the change. ChatPageContent.test: "offers no queue actions on a row a pending send shows". AgentChatPage.test: "reports a failed promote and keeps the row queued", "reports a failed Remove from queue". createStore: "stops showing a failed action". QueuedMessagesList.stories: PendingRowDisablesActions.
QueuedMessagesList.stories: BeginRequestPending, EndRequestPending The state cannot occur: the page passes the row that the shown queue marks as the row under edit, so the marker and the under-edit ID always agree. QueuedMessagesList.stories: WaitingBehindHeadUnderEdit shows a pending begin, and SeveralMessages shows a pending end.
useQueuedMessageEdit.test, the row shown as under edit (1 table test), and the pending-begin case of "the row the composer edits" The hook no longer reads the marker request. The store marks the row at the click. useQueuedMessageEdit.test: "Edit opens the composer and shows the row as under edit before the begin request settles", "the failure of a begin that a later begin superseded does not affect the composer".
useConversationEditingState.test: "calls focus on the input ref after a successful send", "does not force focus when replacing input values on mobile" The hook no longer focuses the composer. AgentChatInput.test: "focuses $focused when a send completes with lockWhileLoading $lockWhileLoading".
useConversationEditingState.test: "an edit opened while a save is in flight keeps its row and typed text after the save, and Cancel gives the draft back" The page offers no Edit while a request is pending, so no edit opens during a save. useConversationEditingState.test: "does not load a row marked during a send".
submitChatTurn: "upserts a non-queued send and sets running", "reconciles a queued send that promotes the queue head", "removes only the promoted steer rows after a steer send to an errored chat", "leaves a steer send to a busy chat for the queue_update stream" Response bodies, the status the client set at a send, and queue reconciliation are deleted. submitChatTurn: "shows a sent message from submit until the stream reports it", "shows a send once when the stream reports it before the response", "shows a send to a running chat in the $lane lane until the stream reports it". createStore: the pending actions show the server's change case "send to an errored chat with a queue".
AgentChatPage.stories: SendResponseAfterChatSwitch, SendRendersDurableUserRowBeforeAssistantOutput The client does not read action responses, and a send shows at the click. chatStore.test: "shows a chat's pending send in no other chat". AgentChatPage.stories: SendShowsPromptAtSubmit.
AgentChatPage.stories: QueuedSendPromotesPreviousHead A send to an errored chat goes to the steer lane, which the server delivers at once, so the queue head stays queued. AgentChatPage.stories: SendToErroredChatWithQueue. createStore: the pending actions show the server's change case "send to an errored chat with a queue".
ChatAttachments.stories: LoadingAttachments; ChatSummaryPanel.stories: LoadingMessages, LiveMessageArriving, EarlierAttachmentsWhileFinalPageHydrates ChatAttachments no longer takes an undefined attachments, and the isHydratingMessages prop is deleted. These loading states cannot occur: the view mounts after the newest page loads, and one synchronous call sets an older page and hasMoreMessages. None needed.

No test covers these cases:

  • One upsert batch that contains two revisions of the same message ID.
  • An edit's response that resolves after newer stream messages. The client ignores the response.
  • The chat status after a failed request. The status comes only from stream events.
  • The Edit buttons that the page does not show while a request is pending.

Kept tests whose assertions changed:

  • useConversationEditingState.test: "preserves the composer and draft when send fails" expects the composer cleared at submit, where main expected it untouched, because a send clears the composer and a failure puts the text back. It no longer checks focus.
  • useConversationEditingState.test: "restores the edit draft and file-block seed when an edit submission fails" no longer expects the composer cleared, because an edit shows the compose draft.
  • useConversationEditingState.test: "saving a queued row passes the queued target and restores the draft from before the edit" no longer expects the composer cleared or focused, because a save shows the compose draft.
  • useConversationEditingState.test: "clears the composer and persisted draft after a successful send" no longer expects focus, because the hook no longer focuses the composer.
  • useQueuedMessageEdit.test: "Edit opens the composer and shows the row as under edit before the begin request settles" and "the failure of a begin that a later begin superseded does not affect the composer" run each begin through the store and check the row the store marks.
  • submitChatTurn: "edits with a recovered model and scrolls to the end" became "edits with a recovered model without scrolling". It expects no scroll, because a successful edit no longer scrolls.
  • submitChatTurn: "reports send failures and invalidates the chat" no longer expects a status read from the server. It expects the transcript as before and a scroll to the end.
  • chatStore.test: the tests that open the stream expect watchChat with the page's snapshot version. "closes old WebSocket and resets state when chatID changes" expects the second chat to open at its own page's snapshot version.

Renamed tests that assert the same thing: chatMessageEdits.test.ts moved to pendingContent.test.ts in ChatConversation, and its buildOptimisticEditedMessage became buildPendingContent. In chats.test, chatMessagesForInfiniteScroll became chat message pages, and four invalidation tests lost "messages" from their names. In createStore, setStreamError / clearStreamError became setClientError / clearClientError, "clearStreamError is a no-op when already null" became "clearClientError is a no-op when already null", the replaceMessages and upsertDurableMessage tests that kept their names moved to upsertDurableMessages, and "does not notify when setting the same status" moved from setChatStatus to applyServerChatStatus. Two createStore tests also check more: "applies a snapshot that only changes editing_since or content" became "applies a queue update that only changes editing_since, content or lane", and the resetTransientState test now also checks the status and the turn error. In chatStore.test, "cancels scheduled stream reset when message_part arrives after message" became "keeps a message_part that follows an assistant message in the same frame". In submitChatTurn, "compacts instead of sending and restores state if compact fails" became "reports a failed compaction without sending". In useConversationEditingState.test, "loads edit text into the composer and restores the prior draft on cancel without refocusing" lost "without refocusing".

🤖 This PR was created with the help of Coder Agents, and will be reviewed by a human. 🏂🏻

@mafredri

This comment has been minimized.

@coder-agents-review

coder-agents-review Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-10-30 20:19 UTC by @mafredri

Review history
  • R1 (2026-10-08): 11 reviewers, 2 Nit, 2 P2, 3 P3, 1 P4, COMMENT. Review
  • R2 (2026-10-08): 10 reviewers, 8 Nit, 3 P2, 7 P3, 5 P4, COMMENT. Review
  • R3 (2026-10-09): 13 reviewers, 16 Nit, 3 P2, 20 P3, 14 P4, COMMENT. Review
  • R4 (2026-10-09): 14 reviewers, 16 Nit, 3 P2, 22 P3, 19 P4, COMMENT. Review
  • R5 (2026-10-09): 7 reviewers, 16 Nit, 3 P2, 22 P3, 21 P4, COMMENT. Review
  • R7 (2026-10-27): 15 reviewers, 38 Nit, 3 P2, 41 P3, 52 P4, REQUEST_CHANGES. Review
  • R8 (2026-10-27), 38 Nit, 3 P2, 41 P3, 52 P4, COMMENT. Review
  • R9 (2026-10-27): 12 reviewers, 41 Nit, 1 Note, 3 P2, 41 P3, 58 P4, REQUEST_CHANGES. Review
  • R10 (2026-10-27): 6 reviewers, 45 Nit, 1 Note, 3 P2, 41 P3, 63 P4, APPROVE. Review
  • R11 (2026-10-27): 8 reviewers, 54 Nit, 1 Note, 3 P2, 41 P3, 65 P4, APPROVE. Review
  • R12 (2026-10-27): 5 reviewers, 59 Nit, 1 Note, 3 P2, 41 P3, 65 P4, APPROVE. Review
  • R13 (2026-10-27): 4 reviewers, 60 Nit, 1 Note, 3 P2, 41 P3, 65 P4, APPROVE. Review
  • R14 (2026-10-30): 9 reviewers, 65 Nit, 1 Note, 3 P2, 41 P3, 67 P4, APPROVE. Review
  • R15 (2026-10-30): 12 reviewers, 66 Nit, 1 Note, 3 P2, 41 P3, 68 P4, APPROVE. Review

deep-review v0.13.0 | Round 15 | 36d77b8..5063feb

Last posted: Round 15, 179 findings (3 P2, 41 P3, 68 P4, 66 Nit, 1 Note), APPROVE. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P2 Author fixed (025b7f0, 8f0173e) chats.ts:1180 Stream writes cancel invalidation and mount refetches that load state the stream never sends R1 Netero, Takumi Note Yes
CRF-2 P3 Author fixed (025b7f0) chats.ts:1180 No-op cache writes also cancel refetches R1 Netero Yes
CRF-3 Nit Author fixed (025b7f0) chats.test.ts:5040 Test uses real setTimeout instead of createDeferred R1 Netero Yes
CRF-4 P2 Author fixed (025b7f0) chats.ts:1183 fetchNextPage in flight during a stream write still drops the streamed message R1 Meruem P2, Nami P3, Pariston P3, Mafuuu P3, Komugi P3, Melody OOS Yes
CRF-5 P3 Author fixed (025b7f0) chats.ts:1183 No test pins isBackgroundRefetch at the new patchChatMessages call site R1 Bisky Yes
CRF-6 P3 Author fixed (025b7f0) chats.ts:941 isBackgroundRefetch JSDoc says "infinite queries" (not checked) and "forever until" R1 Gon P2, Leorio Nit Yes
CRF-7 Nit Author fixed (025b7f0) chats.test.ts:5022 Test name says the function is overwritten, not the written message R1 Gon, Leorio Yes
CRF-8 P4 Author fixed (025b7f0) chats.ts:1170 Comment does not state the cancel must revert synchronously before setQueryData R1 Leorio P4, Meruem Note Yes
CRF-9 Note Dropped by orchestrator (premise gone: refetch result now kept) chats.ts:2392 deleteChatQueuedMessage invalidation duplicates queue_update; refetch now mostly discarded R1 Pariston No
CRF-10 OOS Out of scope (body) codersdk/chats.go:962 ChatMessagesResponse has no history version to order REST reads against stream R1 Pariston, Meruem No
CRF-11 OOS Out of scope (body) chats.ts:955 isBackgroundRefetch param type requires unused queryKey R1 Gon No
CRF-12 OOS Out of scope (body) chats.ts:958 Inline comment repeats JSDoc first-fetch rationale R1 Gon No
CRF-13 OOS Out of scope (body) ProjectChatsList.test.tsx Pagination test timed out at 5000 ms on a loaded runner R1 Bisky No
CRF-14 P3 Author fixed (code removed in redesign, head 61d7798) chats.ts:1190 No test covers more than one write during a single fetch R2 Netero Yes
CRF-15 P4 Author fixed (code removed in redesign, head 61d7798) chats.ts:1203 The removed exit of the cache listener has no test R2 Netero Yes
CRF-16 P3 Author fixed (code removed in redesign, head 61d7798) chats.ts:1202 Writes queued for a silently cancelled fetch are replayed onto the replacing fetch, which was sent after them R2 Chopper P3, Mafuuu Note, Takumi Note Yes
CRF-17 P2 Author fixed (code removed in redesign, head 61d7798) chats.ts:1224 patchChatMessages JSDoc states "applying twice is safe" as fact; the edit projection violates it R2 Gon P2, Takumi P4, Melody Note Yes
CRF-18 P3 Author fixed (code removed in redesign, head 61d7798) chats.ts:1178 reapplyAfterFetch comment restates the name and calls the older page "the new page" R2 Gon Yes
CRF-19 P3 Author fixed (code removed in redesign, head 61d7798) chats.ts:2342 Rollback comment says what, not why it must bypass patchChatMessages R2 Gon Yes
CRF-20 P4 Author fixed (code removed in redesign, head 61d7798) chats.ts:1209 Dropping writes on failure/removal is uncommented and relies on setQueryData clearing #revertState R2 Leorio P4, Netero Note Yes
CRF-21 P4 Author fixed (code removed in redesign, head 61d7798) chats.ts:1212 No test pins that the replay runs before React renders the fetch result R2 Nami P4, Bisky Note Yes
CRF-22 P4 Author fixed (code removed in redesign, head 61d7798) App.tsx:20 PR description lists window-focus refetches, but refetchOnWindowFocus is false R2 Pariston Yes
CRF-23 Nit Author fixed (code removed in redesign, head 61d7798) chats.test.ts:5082 Test comments narrate the following lines (5082, 5149) R2 Gon Yes
CRF-24 Nit Author fixed (code removed in redesign, head 61d7798) chats.ts:1186 One updater has three names: updater, write, pendingWrite R2 Gon Yes
CRF-25 Nit Author fixed (code removed in redesign, head 61d7798) chats.ts:1185 reapplyAfterFetch takes queryKey, which is always query.queryKey R2 Gon Yes
CRF-26 Nit Author fixed (code removed in redesign, head 61d7798) chats.test.ts:1755 Helper page returns InfMessages, not a page R2 Gon Yes
CRF-27 Nit Author fixed (code removed in redesign, head 61d7798) chats.test.ts:1752 Test name names the refetch, not the result it protects R2 Gon Yes
CRF-28 Nit Author fixed (code removed in redesign, head 61d7798) chats.test.ts:5133 Test name "after the fetch it was made during fails" is hard to parse R2 Leorio Yes
CRF-29 Note Note (body) chats.ts:1226 Some queue writes come from REST, so "follows on the stream" does not hold for them R2 Melody No
CRF-30 Note Note (body) commit 77df61e Commit body describes the superseded cancel design R2 Leorio No
CRF-31 P3 Author fixed (d6c3d40) submitChatTurn.test.ts:296 File is not biome-formatted; CI fmt check fails R3 Netero Yes
CRF-32 P3 Author fixed (fc327a1) chats.ts:1647 No test covers dropping an older page when the cache no longer ends at beforeID R3 Netero Yes
CRF-33 P3 Author fixed (908ab17) chatStore.ts:834 No test covers the placeholder branch of selectLatestVisibleMessage R3 Netero Yes
CRF-34 P3 Author fixed (ea4d368) useChatStore.ts:199 wsQueueUpdateReceivedRef comment still describes the removed REST refetch R3 Netero Yes
CRF-35 P4 Author fixed (b37ae3f) useChatStore.ts:893 No test covers applyEditResponse after the user left the chat R3 Netero Yes
CRF-36 P3 Author fixed (e8375ce); test request contested, panel closed R4 (2/2 accept) submitChatTurn.ts:419 isAheadOfCachedMessages comment and the full-batch comment contradict; a late lower-ID send batch is dropped R3 Gon P2, Leorio P4 Yes
CRF-37 P4 Author fixed (b3c2ae3) chats.ts:1607 staleTime Infinity still allows invalidations; "static" would enforce the invariant R3 Ging-ts Yes
CRF-38 P4 Author fixed (c64caac) AgentChatPage.tsx:842 onFetchMoreMessages async wrapper is recreated per render and resolves before the load R3 Ging-react P4, Melody Note, Netero Note Yes
CRF-39 Nit Author fixed (2469488) useChatStore.ts:282 New useCallback in a React Compiler path (site/AGENTS.md:82) R3 Ging-react Yes
CRF-40 P4 Author fixed (908ab17) chatStore.ts:787 Reconnect during a pending edit of a failed turn shows the old persistedError R3 Nami Yes
CRF-41 P4 Author contested; panel closed R4 (1/1 accept) AgentChatPage.tsx:839 No test for the load-older mutation wiring (spinner, retry, error) R3 Nami Yes
CRF-42 P3 Author fixed (908ab17) submitChatTurn.ts:365 No test checks a failed edit restores the previous chat status R3 Bisky Yes
CRF-43 P4 Author fixed (908ab17) submitChatTurn.ts:365 Failed edit restores the pre-edit status over a status the stream delivered meanwhile R3 Hisoka Yes
CRF-44 P3 Author fixed (9cf58f0) chats.ts:2510 Server stream behavior that replaces the clear/delete refetch has no committed test R3 Bisky Yes
CRF-45 P3 Author fixed (908ab17) chatStore.ts:851 Thinking-indicator comment says no stream data, but the condition reads hidden stream state R3 Gon Yes
CRF-46 P3 Author fixed (ea4d368) useChatStore.ts:883 applyEditResponse comment omits that the store queue is cleared only via pendingEdit R3 Gon Yes
CRF-47 P3 Author fixed (fc327a1) chats.ts:1645 Drop comment cites the removed-cache case and omits the cases the beforeID check is for R3 Gon Yes
CRF-48 P4 Author fixed (908ab17) chatStore.ts:113 PendingEdit doc duplicates selector docs and describes replaceMessages away from it R3 Gon Yes
CRF-49 Nit Author fixed (ea4d368) useChatStore.ts:871 Second sentence restates the active-chat checks R3 Gon Yes
CRF-50 Nit Author fixed (ea4d368) useChatStore.ts:246 Comment restates upsertCacheMessages R3 Gon Yes
CRF-51 P3 Author fixed (2469488) useChatStore.ts:282 replaceHistory name does not say it writes store and cache R3 Gon Yes
CRF-52 P3 Author fixed (908ab17) chatStore.ts:117 Pending-edit outcomes have five names; "dropped" names the failure that keeps the turn R3 Gon Yes
CRF-53 P3 Author fixed (908ab17) chatStore.ts:789 noQueuedMessages lacks a comment that it must be a shared constant R3 Gon Yes
CRF-54 Nit Author fixed (908ab17) chatStore.ts:122 PendingEdit.placeholder vs optimisticMessage naming R3 Gon Yes
CRF-55 Nit Author fixed (e8375ce) chats.ts:2477 Comment does not name the code that applies edit messages R3 Gon Yes
CRF-56 Nit Author fixed (09b0d38) chats.test.ts:1904 Test name does not say what it asserts R3 Gon Yes
CRF-57 Nit Author fixed (09b0d38) submitChatTurn.test.ts:317 Test name repeats "the stream" in two senses R3 Gon Yes
CRF-58 Nit Author fixed (26fd057) chats.ts:1154 ChatMessagesData alias unexported; new code spells out the type R3 Gon Yes
CRF-59 P4 Author fixed (e3c305b) useChatStore.ts:884 Successful edit ends pendingEdit only as a side effect of replaceMessages R3 Meruem Yes
CRF-60 P4 Author fixed (908ab17) chatStore.ts:307 Fields of the replaced turn are listed in selectors and in replaceMessages separately R3 Meruem Yes
CRF-61 Note Note (body) useChatStore.ts:317 "never removes" comment relies on stream reset after a cache-only edit response R3 Takumi No
CRF-62 Note Note (body) chatStore.ts:309 Old-turn message_parts can show briefly after the edit response clears pendingEdit R3 Takumi No
CRF-63 Note Note (body) PR description "turn fill requests" is undefined R3 Leorio No
CRF-64 OOS Out of scope (body) chats.sql:2643 Server invariants isAheadOfCachedMessages relies on are stated only in the client R3 Pariston, Meruem, Komugi, Leorio No
CRF-65 OOS Out of scope (body) chatQueueReconciliation.ts:81 Promote and /compact failure paths still restore pre-request snapshots R3 Pariston No
CRF-66 OOS Out of scope (body) useChatStore.ts:221 "last REST-fetched message ID" comment is wrong R3 Gon No
CRF-67 OOS Out of scope (body) useChatStore.ts:206 wsStatusReceivedRef comment cites window-focus refetch R3 Gon No
CRF-68 OOS Out of scope (body) useChatStore.ts:248 Existing useCallbacks in compiled path; name hides invalidations R3 Ging-react, Gon No
CRF-69 OOS Out of scope (body) useChatStore.ts:311 prevChatIDRef branch never runs in production R3 Meruem No
CRF-70 P3 Dropped by orchestrator (disproved: KeyedAgentChatPage remounts per agentId) AgentChatPage.tsx:316 Load-older mutation state carries across chats R3 Mafuuu No
CRF-71 P3 Dropped by orchestrator (disproved: store is per mount, page remounts per agentId) submitChatTurn.ts:365 Failed edit writes status into another chat's store R3 Mafuuu, Bisky No
CRF-72 P3 Author fixed (04ec244) chatStore.test.tsx:4438 CRF-40 regression test sets status "running", so it does not cover the selectChatStatus fix R4 Netero Yes
CRF-73 P4 Author fixed (64227af) ChatPageContent.test.tsx:247 Deleted the only test that the old persisted error is hidden during a pending edit R4 Netero Yes
CRF-74 Note Note (body) PR title CI title job failed on the earlier fix(site) title; current title passes the check, job needs a re-run R4 Netero No
CRF-75 P3 Author fixed (e874a14) submitChatTurn.ts:365 Comment on setPendingEdit(null) says both paths already end the edit, so the line looks dead R4 Gon P3, Leorio P4 Yes
CRF-76 P4 Author fixed (e874a14) useChatStore.ts:114 isAheadOfCachedMessages comment omits the one-submission-in-flight precondition R4 Gon Yes
CRF-77 P4 Author fixed (e874a14) chatStore.ts:118 editTurnStart comment omits that replaceMessages writes it into stored state on commit R4 Gon Yes
CRF-78 P4 Author fixed (e874a14) useChatStore.ts:192 wsQueueUpdateReceivedRef comment repeats the hydration comment at line 389 R4 Gon Yes
CRF-79 P4 Author contested; panel closed R5 (1/1 accept) chatStore.ts:133 Stored fields and shown-turn selectors share names; direct reads silently bypass the pending edit R4 Knov Yes
CRF-80 Note Note (body) useChatStore.ts:57 patchNewestPage unchanged-page check has no test R4 Bisky No
CRF-81 Note Note (body) AgentChatPage.tsx:160 fetchNextPage and refetch remain callable on the loaded query; the invariant is convention only R4 Knov No
CRF-82 OOS Dropped by orchestrator (premise gone: client no longer sets running) stream_loop.go:287 Stream sends status only on change; a coalesced sync after a fast turn leaves the client "running" R4 Melody, Komugi No
CRF-83 Note Note (body) useChatStore.ts:309 ba9a198 fixes a chat-change branch production never runs; commit body describes it as user-facing R5 Netero No
CRF-84 P4 Author fixed (code removed in redesign, head ba7ddb7) useChatStore.ts:113 Rewritten isAheadOfCachedMessages comment drops what a false result means and the deleted-by-later-edit case R5 Gon, Leorio Yes
CRF-85 P4 Author fixed (code removed in redesign, head ba7ddb7) chatStore.ts:315 replaceMessages treats any history without the edited message as a commit; the caller rule lives only at one caller R5 Leorio Yes
CRF-86 P3 Author fixed (3a44374 (check removed)) chatStore.ts:492 Unversioned-page load failure is tested (4901, 2837); only its error text is not R6 Netero, Bisky Note Yes
CRF-87 P4 Author fixed (72bb2da) chatStore.ts:178 replaceMessages has no production caller and bypasses historyResets and endPending R6 Netero Yes
CRF-88 P4 Author fixed (f60ecb1) AgentChatInput.tsx:1114 Deleted refocus effect leaves the new-chat composer unfocused after a failed create R6 Netero Yes
CRF-89 Nit Author fixed (736edb4) useChatStore.ts:102 Rewritten onDurableMessages keeps useCallback in a React Compiler path R6 Netero Yes
CRF-90 Nit Author fixed (0f45d85, 569ae6c) ConversationTimeline.test.tsx:480 New tests and stories assert toBeInTheDocument/toBeVisible against FE1 R6 Netero Yes
CRF-91 Nit Author fixed (f60ecb1) AgentChatInput.test.tsx:409 Focus test waits on a real 50 ms setTimeout R6 Netero Yes
CRF-92 Note Resolved (seed has a production caller, useChatStore.ts:86) chatStore.ts:174 ChatStore.seed is public; a direct caller skips the snapshot_version check R6 Netero No
CRF-93 P1 Author contested; panel closed R10 (Law accepts the human override; verdict Split, Advisory) PR Mandatory split: stream contract, pending actions, editable composer R6 Law No
CRF-94 P3 Author fixed (7c95687, 06b51dd) chatStore.ts:292 Replayed commit on reconnect or first open ends pending actions made after it R6 Pariston P3, Melody P3, Takumi P4, Nami P4, Komugi P4, Mafuuu P4 Yes
CRF-95 P3 Author fixed for delete (2fd72eb); promote contested R7 chatStore.ts:474 Two queue actions in one tab: the first queue_update ends the second's overlay R6 Takumi P3, Komugi P3, Mafuuu P4 Yes
CRF-96 P3 Author fixed for older replica (3a44374); parse-error loop contested R7 useChatStore.ts:247 Older replica or parse error: client-initiated close reconnects every ~1 s, each downloading full history R6 Hisoka P3, Takumi P3, Komugi P4, Razor P4 Yes
CRF-97 P4 Author fixed (7c95687) chatStore.ts:561 pendingEntry places sends and promotes from a null or stale stored chatStatus R6 Komugi, Razor Yes
CRF-98 P4 Author fixed (f41917d, 998e61a, c4e1ee1) useChatStore.ts:157 Cached store reopens with the old chatStatus and turnError until the first status event R6 Nami Yes
CRF-99 P3 Author fixed (91e97f6) useConversationEditingState.ts:161 Editing a history message while a send is pending corrupts the draft or turns the edit into a send R6 Hisoka P3, Razor P4 Yes
CRF-100 P3 Author fixed (13de4ba) chatStore.ts:478 ChatStore.load reimplements a React Query fetch in an effect and drops request cancellation (FE7, FE8) R6 Ging-react Yes
CRF-101 P3 Author fixed (7c95687) AgentChatPage.tsx:536 Pending-action lifecycle written four times; delete and promote copies untested R6 Bisky Yes
CRF-102 P3 Author fixed (7c95687) ChatPageContent.test.tsx:296 localStorage leak makes the pending-row Enter test pass without the guard R6 Bisky Yes
CRF-103 P3 Author fixed (91e97f6) useConversationEditingState.test.ts:434 Mid-send reload test exercises the plain-text fallback, not the Lexical JSON path R6 Bisky Yes
CRF-104 P3 Author fixed (7c95687) chatStore.ts:879 No test that a pending edit hides the replaced turn's stream output R6 Bisky Yes
CRF-105 P4 Author fixed (7c95687) chatStore.ts:780 No test of a send to a requires_action or interrupting chat R6 Bisky Yes
CRF-106 P4 Author fixed (91e97f6) useConversationEditingState.ts:259 No test that a pending history edit keeps the pre-edit draft R6 Bisky Yes
CRF-107 P4 Author fixed (3a44374 (removed)) useChatStore.ts:43 isUnversionedEvent: only the message type is tested R6 Bisky Yes
CRF-108 P4 Author fixed (72bb2da); setStreamState half re-raised R7 as CRF-145 chatStore.ts:453 upsertDurableMessage and setStreamState have no production caller and skip endPending R6 Melody, Mafuuu Yes
CRF-109 P4 Author fixed (3a44374 (removed)) chatStore.ts:494 Older-server error text tells the user nothing actionable R6 Leorio, Luffy Yes
CRF-110 P4 Author fixed (ebc00e3) useChatStore.ts:241 Parse-error text does not say the client reconnects R6 Leorio Yes
CRF-111 P4 Author fixed (05eb795, 5ba74fb) chatStore.ts:955 useChatMessages doc says durable messages, returns pending rows; warning names a deleted cache R6 Razor Yes
CRF-112 P3 Author fixed (05eb795) chatStore.ts:110 PendingAction doc says shown until its result; it ends at any event of the kind R6 Gon Yes
CRF-113 P3 Author fixed (13de4ba (removed)) chatStore.ts:175 load comment says it skips when loading; a new store is loading and still fetches R6 Gon P2, Leorio P4 Yes
CRF-114 P3 Author fixed (dac8ebc) chatStore.ts:151 streamError now holds client failures while turnError holds the stream's R6 Gon Yes
CRF-115 P3 Author fixed (05eb795) chatStore.ts:773 Five names for a pending row; buildOptimisticEditedMessage with id 0 builds a send R6 Gon P3, Leorio Nit Yes
CRF-116 P3 Author fixed (05eb795) chatStore.ts:937 Thinking-indicator comment false again: condition reads the view's stream state R6 Gon Yes
CRF-117 P4 Author fixed (chatStore.ts:712-714) chatStore.ts:756 2 ** 32 reservation unnamed; floor and assignment derived separately R6 Gon P4, Leorio Nit Yes
CRF-118 P4 Author fixed (chatStore.ts:253) chatStore.ts:244 Bookkeeping comment cites server events for variables unrelated to them R6 Gon Yes
CRF-119 P4 Author fixed (91e97f6) useConversationEditingState.ts:17 joinEditorStates doc omits the missing or empty case R6 Gon Yes
CRF-120 P4 Author fixed (renamed editedMessageId) useConversationEditingState.ts:46 PendingSend.messageId holds the edited message ID R6 Gon Yes
CRF-121 P4 Author fixed (13de4ba) chatStore.ts:161 load is both a state field and a method R6 Gon Yes
CRF-122 Nit Author fixed (5ba74fb, 05eb795) chatStore.ts:837 Comments restate code (837, 859, 753, chats.ts:1431, AgentChatInput.tsx:1490, useConversationEditingState.ts:192) R6 Gon Yes
CRF-123 Nit Author fixed (isPendingRow) QueuedMessagesList.tsx:177 isPending means pending row, next to busyAction R6 Gon Yes
CRF-124 Nit Author fixed (05eb795) chatStore.ts:770 shown names both the view parameter and message.shown R6 Gon Yes
CRF-125 Nit Author fixed (pendingEntries) chatStore.ts:163 pendingActions holds PendingEntry values R6 Gon Yes
CRF-126 Nit Author fixed (latestMessage) chatStore.ts:921 selectLatestMessage takes a ChatView, unlike other select* functions R6 Gon Yes
CRF-127 Nit Author fixed (778b650) AgentChatPage.tsx:784 load older vs fetch more naming for one operation R6 Gon Yes
CRF-128 Nit Author fixed (778b650, 7c95687) useConversationEditingState.test.ts:368 Ten hand-rolled deferreds instead of createDeferred or Promise.withResolvers R6 Ging-ts P4 Yes
CRF-129 P3 Dropped by orchestrator (disproved: AgentChatInput.tsx:978 blocks workspace attach while isLoading) ChatPageContent.tsx:774 Workspace file attached during a send is hidden and then deleted R6 Mafuuu No
CRF-130 Note Note (body) useChatStore.ts:309 history_reset without from_message_id clears the whole transcript R6 Mafuuu No
CRF-131 OOS Out of scope (body) reconnectingWebSocket.ts:252 Backoff resets on open rather than after a stable connection R6 Takumi No
CRF-132 OOS Out of scope (body) AgentChatInput.tsx:1167 Keyboard promote failure is an unhandled rejection R6 Nami No
CRF-133 OOS Out of scope (body) useConversationEditingState.ts:257 Leaving and returning mid-send restores the sent text; same as main R6 Takumi No
CRF-134 OOS Out of scope (body) useConversationEditingState.ts:204 Successful edit removes the pre-edit draft; same as main R6 Mafuuu No
CRF-135 OOS Out of scope (body) chatStore.ts:668 resetTransportReplayState clears request errors on every open R6 Mafuuu No
CRF-136 OOS Out of scope (body) useChatStore.ts:259 pendingMessages uses pending for stream buffering R6 Gon No
CRF-137 OOS Out of scope (body) AgentChatPage.stories.tsx:3223 Existing hand-rolled deferreds in stories R6 Ging-ts No
CRF-138 P4 Author fixed (cc05bf8) chatStore.ts:207 addPendingAction has no production caller and no public remove R7 Netero Yes
CRF-139 P4 Author fixed (0b86d22) useChatStore.ts:505 retryLoad refetches a loaded store query and replaces the store R7 Netero Yes
CRF-140 P3 Author fixed (40d2884, a3f3097) chatStore.ts:481 A commit split across frames (history_reset before its replacement message; promote message before its queue_update) shows a wrong transcript until the next frame R7 Nami P3, Melody P4 Yes
CRF-141 P4 Author contested; panel closed R9 (2/2 accept) useConversationEditingState.ts:135 Edit buttons stay enabled during a send but do nothing R7 Mafuuu, Nami Yes
CRF-142 P4 Author fixed (5a7f502) chatStore.ts:482 Replayed history_reset still increments historyResets, so an older page in flight is dropped (CRF-94 incomplete) R7 Komugi Yes
CRF-143 P4 Author fixed (36c1304) chatStore.test.tsx:5004 Reconnect tests (5004, 5065) wait the real 1000 ms reconnect timer (also reported R6 at 4801, omitted from inventory) R7 Komugi Yes
CRF-144 P4 Author fixed (c99aa01, comment) chatStore.ts:131 First open: stream replays commits the newest page holds above snapshot_version, ending a pending part made before the first frame R7 Pariston, Melody Yes
CRF-145 P4 Author fixed (de882bf) chatStore.ts:537 setStreamState has no production caller after chatQueueReconciliation.ts removal (CRF-108 half fixed) R7 Melody Yes
CRF-146 P3 Author fixed (bb61b56, f4ee1ef) AgentChatPage.tsx:556 No test checks a failed promote reports its error; main's test deleted; mutation leaves suites green R7 Bisky Yes
CRF-147 P4 Author fixed (24caf14) useChatStore.ts:164 No test covers resetTransientState at effect start (or cleanup at 167); mutation leaves suite green R7 Bisky Yes
CRF-148 P3 Author fixed (cc05bf8) chatStore.ts:211 runPendingAction comment says it shows the action while request runs; entry stays after resolve until a stream update R7 Gon P2, Leorio P4 Yes
CRF-149 Nit Author fixed (736edb4) chatStore.ts:900 Thinking comment first sentence restates the condition R7 Gon Yes
CRF-150 Nit Author fixed (736edb4) chatStore.ts:178 Stream-writer version sentence sits on resetHistoryFrom R7 Gon, Leorio Yes
CRF-151 P4 Author fixed (736edb4) useChatStore.ts:79 Duplicates seed comment; seed's "change the stored state" is false (pending actions, errors change it) R7 Gon Yes
CRF-152 Nit Author fixed (5a7f502) chatStore.ts:358 "one Map copy and one sort" repeats call-site comment R7 Gon Yes
CRF-153 Nit Author fixed (eb0843d) AgentChatInput.tsx:1160 busyRows first sentence repeats the prop doc R7 Gon Yes
CRF-154 P4 Author contested; panel closed R9 (1/1 accept) AgentChatInput.tsx:1177 "a failed delete shows the row again" describes AgentChatPage/store, not this component R7 Gon Yes
CRF-155 Nit Author fixed (eb0843d) AgentChatInput.tsx:1121 Parenthetical restates wasLoading && !isLoading R7 Gon Yes
CRF-156 P4 Author fixed (eb0843d) useConversationEditingState.ts:42 "pending" names three different lifetimes (pending action, request in flight, batched stream messages) R7 Gon P3 Yes
CRF-157 P4 Author contested; panel closed R9 (1/1 accept) submitChatTurn.ts:290 New sends built by buildOptimisticEditedMessage from a fake originalMessage id 0 (CRF-115 incomplete) R7 Gon Yes
CRF-158 Nit Author contested; panel closed R9 (1/1 accept) ChatPageContent.tsx:175 streamError: shownError keeps the name CRF-114 removed; test hooks too R7 Gon Yes
CRF-159 Nit Author fixed (5a7f502) chatStore.ts:359 Internal and returned upsertDurableMessages share a name but differ in ending pending parts R7 Gon Yes
CRF-160 Nit Author fixed (736edb4) chatStore.ts:732 running local includes interrupting; running or requires_action is isActiveChatStatus R7 Gon Yes
CRF-161 P4 Author fixed (736edb4, a3f3097) chatStore.ts:135 isRowDone comment says the first update without the row is the delete's own; other commits also remove it; name unclear R7 Leorio P4, Gon Nit Yes
CRF-162 Nit Author fixed (40d2884, a3f3097) chatStore.ts:141 PendingEntry.queue has no comment R7 Gon Yes
CRF-163 Nit Author fixed (736edb4) chatStore.ts:887 latestMessage names its ChatView parameter state R7 Gon Yes
CRF-164 Nit Author fixed (736edb4) useChatStore.ts:97 initialDataLoaded duplicates loadState.status === "loaded" R7 Gon Yes
CRF-165 P4 Author fixed (description edited) PR description "Behavior that differs" bullet says a delete ends early; false since 2fd72eb R7 Leorio Yes
CRF-166 P3 Author contested; panel closed R9 (1/1 accept) useChatStore.ts:455 Cursor rejected with 400 (after DB restore) retries forever with the same snapshot_version; idle chat shows nothing R7 Chopper Yes
CRF-167 P4 Author contested; panel closed R9 (1/1 accept) AgentChatPage.tsx:494 Non-API failure removes the row shown at the click with no error R7 Chopper P3 Yes
CRF-168 Nit Author fixed (61f3a5f) submitChatTurn.test.ts:267 Test name says scrolls, assertion says it does not R7 Chopper Yes
CRF-169 OOS Out of scope (body) AgentChatPage.tsx:543 Failed queued-row delete shows the row again with no error; same as main R7 Nami, Leorio, Chopper P4 No
CRF-170 OOS Out of scope (body) reconnectingWebSocket.ts:249 403/404 handshake retries every 10 s forever; same as main R7 Chopper No
CRF-171 OOS Out of scope (body) useChatStore.ts:242 Parse error itself not logged; same as main R7 Chopper No
CRF-172 OOS Out of scope (body) liveStatusModel.ts:59 streamError input now receives client errors R7 Gon No
CRF-173 OOS Out of scope (body) useChatStore.ts:429, chatStore.test.tsx:4611 Comments describe removed code history R7 Gon No
CRF-174 P4 Author contested; panel closed R10 (1/1 accept) chatStore.ts:469 def84c9 dropped the changes-nothing check for user messages too; only the queue half had a reason; restoring it for messages keeps a send clicked before first sync (CRF-144 case) R9 Bisky Yes
CRF-175 P4 Author fixed (c5ef2ad) chatStore.ts:743 No test checks the errored-chat send's queue part between the head's message and the queue update; regression leaves 2261 tests green R9 Bisky Yes
CRF-176 P4 Author contested; panel closed R10 (1/1 accept) AgentChatPage.test.tsx:119 Failed-promote test times out (5000 ms) when it runs first on one core; passes only because the line-80 test pays the cold render R9 Komugi Yes
CRF-177 P4 Author fixed (c5ef2ad) chatStore.ts:128 message bullet's reason (server queues a send or promote when busy) is false for promote: a busy-chat promote gets no message part R9 Gon P2 Yes
CRF-178 Nit Author contested; panel closed R10 (1/1 accept) chatStore.ts:135 "An edit has editedMessage, history and..." restates pendingEntry's edit case R9 Gon P2 Yes
CRF-179 Nit Author fixed (7318494) storyFixtures.ts:25 buildLoadedChatStore also records the store in loadedStores; name does not say so R9 Gon Yes
CRF-180 P4 Author fixed (c5ef2ad) chatStore.ts:137 Resend sentence stops before the consequence ("never arrived"); does not show why the version check suffices R9 Leorio Yes
CRF-181 P4 Author fixed (fcffa17) useChatStore.ts:299 resetHistoryFrom's skip depends on the hook calling advanceSnapshotVersion after a reset and before other events; let each writer advance the version R9 Meruem Yes
CRF-182 Nit Author contested; panel closed R10 (1/1 accept) chatStore.ts:802 isRowGone is checked for the whole entry but belongs to the queue part R9 Meruem P4 Yes
CRF-183 Note Author fixed (418d431, comment) chatStore.ts:488 First open: a history_reset above the page's snapshot_version that the page holds still increments historyResets and drops an older page in flight R9 Pariston Yes
CRF-184 Note Note (body) chatStore.ts:716 Pending rows share server row types; every ID-sending action must call isPendingRowID R9 Meruem No
CRF-185 Nit Dropped by orchestrator (re-raise of CRF-156/CRF-136 without new evidence; author kept main's name) useChatStore.ts:257 pendingMessages still uses "pending" R9 Gon No
CRF-186 Nit Dropped by orchestrator (re-raise of CRF-160 without new evidence; author gave the interrupting reason) chatStore.ts:728 running still true for interrupting R9 Gon No
CRF-187 OOS Out of scope (body) AgentChatPage.test.tsx:80 First test to render AgentChatPage times out on one core, at base too R9 Komugi No
CRF-188 OOS Out of scope (body) coderd/exp_chats.go:3701 Action endpoints return no commit version, so a same-kind commit ends a shown action early R9 Pariston No
CRF-189 OOS Out of scope (body) chatStore.ts:205 applyMessagePart and clearReconnectState are test-only on main and here R9 Meruem No
CRF-190 OOS Out of scope (body) chatStore.ts:338 replaceMessages comment claims a concurrent-change guard that never changes the result R9 Meruem No
CRF-191 OOS Out of scope (body) useConversationEditingState.ts:114 MutableRefObject cast, deprecated in React 19 R9 Ging-react No
CRF-192 OOS Out of scope (body) AgentChatPage.tsx:494 handleRequestError drops non-API errors; same as main (root of CRF-167) R9 Chopper No
CRF-193 P4 Author fixed (7ea70b1) chatStore.ts:502 No test covers resetVersion = snapshotVersion after a stream-applied reset; deleting it leaves all tests green (CRF-142 reconnect case) R10 Bisky, Komugi Yes
CRF-194 P4 Author fixed (45fa202) AgentChatPageView.stories.tsx:870 replaceStoreMessages' resetHistoryFrom(0, 1) applies only on a play function's first run since fcffa17; its comment is now false R10 Netero Yes
CRF-195 P4 Author fixed (7ea70b1) chatStore.ts:497 "which the next scroll loads again": ChatMessageScroller re-requests the page on its own, with no scroll R10 Leorio Yes
CRF-196 Nit Author fixed (7ea70b1) chatStore.ts:266 resetVersion doc ("newest reset the store holds") false after seed; name differs from historyResets R10 Leorio, Gon Yes
CRF-197 Nit Author fixed (ea20d4c) chatStore.test.tsx:5027 Comment says the head shows as a message; assertions check only the queue R10 Leorio Yes
CRF-198 Nit Dropped by orchestrator (text is the panel's own CRF-180 suggestion adopted verbatim last round; shortening it again is reviewer ping-pong) chatStore.ts:136 Resend paragraph repeats the syncedVersion field comment R10 Gon P2 No
CRF-199 P4 Author fixed (e9ff2b6) useChatStore.ts:501 Hook returns clearClientError and no caller reads it R10 Zoro Yes
CRF-200 P4 Author fixed (da29938) useConversationEditingState.ts:282 PR adds two more copies of the write-or-remove draft block (three total) R10 Zoro Yes
CRF-201 Nit Author fixed (cd9a17b) submitChatTurn.ts:306 Edit and send branches repeat the same request wrapper and catch R10 Zoro P4 Yes
CRF-202 Nit Author fixed (388e259) useChatStore.ts:44 ChatLoadState re-encodes the query's status and error; page unpacks it again R10 Zoro P4 Yes
CRF-203 OOS Out of scope (body) AgentCreateForm.tsx:160 New-chat draft has its own copy of the localStorage try/catch R10 Zoro No
CRF-204 P4 Author contested; panel closed R12 (1/1 accept) useConversationEditingState.ts:256 Successful edit with nothing typed removes a plain-text compose draft from storage while the composer shows it R11 Bisky Yes
CRF-205 P4 Author fixed (2daa283) useConversationEditingState.ts:193 clearInputForSend no longer clears the input for an edit; "send" means send-or-edit in the ref and send-only in the comment R11 Gon P4, Zoro P4, Mafuuu Nit, Leorio Nit Yes
CRF-206 Nit Author fixed (2daa283) useConversationEditingState.ts:190 Send sentence repeats restoredDraft's doc R11 Gon P2 Yes
CRF-207 Nit Author fixed (2daa283) useConversationEditingState.ts:206 Comment restates the else branch R11 Gon P2 Yes
CRF-208 Nit Author fixed (2daa283) useConversationEditingState.ts:236 saveDraft comment restates the body and omits that it sets storedDraftRef R11 Gon P2 Yes
CRF-209 Nit Author fixed (2daa283) useConversationEditingState.ts:103 storedDraftRef null also means "stored nothing this visit", not only "removed" R11 Leorio Nit, Gon Note Yes
CRF-210 Nit Author fixed (2daa283) useConversationEditingState.test.ts:508 "types typed during the send" reads as a typo R11 Gon, Leorio Yes
CRF-211 Nit Author fixed (a83cde5) submitChatTurn.ts:196 "prompt" is a new name for the pending action's message R11 Leorio Yes
CRF-212 Nit Author fixed (2daa283) useConversationEditingState.ts:171 showComposeDraft hard-codes its input; rollback and handleEditUserMessage repeat the same four statements R11 Zoro P4 Yes
CRF-213 Nit Author fixed (2daa283) useConversationEditingState.ts:105 Unmount-effect comment describes the storage check; visitEnded at :292 has no comment R11 Zoro Yes
CRF-214 Nit Author fixed (e941530) ChatPageContent.test.tsx:287 EditingChatPageInput keeps isSendPending false during the edit, unlike the page R11 Bisky Note Yes
CRF-215 Note Note (body) useConversationEditingState.ts:296 Later-visit check compares serialized strings; outcome for B's draft depends on byte-equal serializations; same as main R11 Mafuuu No
CRF-216 Note Note (body) useConversationEditingState.ts:107 Unmount cleanup is safe under StrictMode; an Activity boundary would treat hidden as left R11 Ging-react No
CRF-217 Nit Author fixed (fb334ab) useConversationEditingState.ts:188 "An edit comes back alone" dangles after the send sentence was deleted; comment omits that the function sets requestInFlightRef R12 Gon P2, Leorio Nit Yes
CRF-218 P4 Dropped by orchestrator (rename re-raise of CRF-205 after the author's rename, which Mafuuu verified holds for both branches; the requestInFlightRef fact goes into CRF-217's comment) useConversationEditingState.ts:191 removeSubmittedContent does not say it marks the request in flight R12 Gon No
CRF-219 Nit Author fixed (fb334ab) useConversationEditingState.ts:136 "Seeds a remounted composer" reads as a precondition; showInComposer remounts itself R12 Gon Yes
CRF-220 Nit Author fixed (5e507a9) ChatPageContent.test.tsx:278 Wrapper comment credits only the hook; it also sets isSendPending as AgentChatPage does R12 Gon Yes
CRF-221 Nit Author fixed (fb334ab) useConversationEditingState.ts:245 finalizeSuccessfulSend also finalizes an edit; CRF-205 rename stops one function short R12 Leorio Yes
CRF-222 Nit Author fixed (fb334ab) useConversationEditingState.ts:227 saveDraft comment starts with "Also" and no longer says what it does R12 Leorio Yes
CRF-223 OOS Out of scope (body) ChatPageContent.tsx:633 No test checks a failed edit keeps its attachments for retry; guard predates the PR R12 Bisky No
CRF-224 Nit Author fixed (83683d5) useConversationEditingState.ts:258 "Wraps the parent onSend to clear local input/editing state" no longer describes handleSendFromInput (rolls back every failure, skips draft write after a later visit) R13 Gon P2 Yes
CRF-225 Nit Dropped by orchestrator (reviewer ping-pong: CRF-208 asked to drop the restatement, CRF-222 asked to restore what the function does; the author satisfied the later finding) useConversationEditingState.ts:228 saveDraft comment restates the body R13 Gon P2 No
CRF-226 Nit Dropped by orchestrator (the clause Gon objects to is the text CRF-220 asked for; the comment is true per Leorio and Razor) ChatPageContent.test.tsx:278 Wrapper comment's colon clause restates the JSX R13 Gon P2 No
CRF-227 Note Note (body) chatStore.ts:728 pendingEntry placement matches chatstate at this base; a chatstate change would show wrong placement with no client test catching it R13 Razor No
CRF-228 P4 Author contested; panel re-raised R15 (Pariston holds at P4; Knov accepts) chatStore.ts:932 Shown and server message IDs share one type; the rebase joined main's attachments panel with pending rows and sent a pending ID as before_id (CRF-184 re-raised with new evidence); guard at the query factories R14 Pariston P3, Knov P3 Yes
CRF-229 Nit Author fixed (9a487f3) chatStore.ts:898 selectOldestStoredMessageID doc restates the name and omits that the shown IDs can be pending R14 Gon P2, Leorio Nit Yes
CRF-230 Nit Author contested; panel closed R15 (2/2 accept) ChatSummaryPanel.tsx:48 oldestLoadedMessageId holds the oldest stored ID; rename oldestStoredMessageID R14 Gon, Leorio Yes
CRF-231 Nit Author fixed (9a487f3) ConversationTimeline.tsx:533 "or the row is pending" gives no reason a pending row anchors the scroller R14 Gon P2 Yes
CRF-232 Nit Author fixed (9a487f3) ChatSummaryPanel.test.tsx:137 Test comment's first clause restates the assertion R14 Gon P2 Yes
CRF-233 P4 Author fixed (description edited) PR description Deleted tests section omits seven deleted stories, four from main's 3f055e7 deleted by the rebase resolution R14 Leorio Yes
CRF-234 Nit Author contested; panel closed R15 (1/1 accept) PR description Pending-row ID bullet omits the Summary panel's earlier-attachments request R14 Leorio P4 Yes
CRF-235 OOS Out of scope (body) ChatSummaryPanel.tsx:48 After an edit of the oldest loaded prompt commits, the panel reloads earlier attachments with a spinner; same path on main R14 Nami No
CRF-236 P4 Open QueuedMessagesList.tsx:275 A queue head that a pending send shows displays the Enter-to-send hint, but Enter skips a pending head R15 Nami Yes
CRF-237 Nit Open AgentChatInput.tsx:1219 Comment lists one exception (head under edit); the condition also skips a pending head R15 Leorio Yes
CRF-238 Note Note (body) chatStore.ts:750 head?.editing_since copies chatstate's queuePaused, which the server expects to gain conditions; CRF-227 realized in this rebase (749f465 placement went stale until 7496838) R15 Meruem, Pariston No
CRF-239 Note Note (body) chatStore.ts:749 Paused chat: a pending delete of the head does not change where a send shows, and does not show the promoted row or status change until the stream reports them R15 Mafuuu, Melody No
CRF-240 OOS Out of scope (body) transitions.go:526 pendingEntry restates send and promote placement with no shared fixture binding it to chatstate R15 Pariston No
CRF-241 OOS Out of scope (body) chatStore.test.tsx:2525 Main's test comments narrate the next emitData; show as added only because blocks moved R15 Gon No

Law analysis

R3: effective +1002 -1257 (14 files), head 61d7798. Verdict: Don't split. Enforcement: Advisory.

R7: effective +4280 -6692 (47 files), head 0e8cd3a. Verdict: Split, Mandatory (re-raised against the revert defense).

R6: effective +3518 -6292 (46 files), head ba7ddb7. Verdict: Split (three vertical slices). Enforcement: Mandatory.

Contested and acknowledged

CRF-41 (P4, AgentChatPage.tsx:839) - No test for the load-older mutation wiring

  • Finding: Nami asked for a test (proposed an AgentChatPage story with has_more: true and a failing before_id request) covering the spinner, retry button, and error state that now come from a useMutation instead of useInfiniteQuery.
  • Author defense: FE1 keeps assertions out of stories; no Vitest test renders AgentChatPage; loadOlderChatMessages, which holds the logic, is tested in chats.test.ts; the remaining wiring passes isPending, isError and mutate through unchanged.

CRF-41 panel closure (R4, 1/1)

  • Panel closure (R4, 1/1): Nami, the agent that raised it (round-3 agent resumed), accepted: AgentChatPageView.stories.tsx:1292-1410 render the loading spinner and retry button from the same props and click retry; chats.test.ts covers loadOlderChatMessages; the untested remainder is three direct prop assignments; an asserting story conflicts with FE1 (.claude/docs/FRONTEND_PATTERNS.md:38-42).

CRF-36 (P3, submitChatTurn.ts:419) - reverse-order send test

  • Finding: Gon and Leorio flagged contradictory comments on the full-batch send and asked for a test that resolves two sends in reverse order.
  • Author defense: comment rewritten (e8375ce); test declined because submitChatTurn returns early while isSubmissionPending, so one tab never has two sends in flight, and another tab's messages arrive only through the stream in commit order.
  • Panel closure (R4, 2/2): Gon (round-3 agent resumed) verified the early return at submitChatTurn.ts:292 and AgentChatPage.tsx:510 and accepted, raising the missing precondition comment as CRF-76. Leorio (round-3 agent resumed) verified the rewritten comment against transitions.go:604,641,736 and accepted.

CRF-79 (P4, chatStore.ts:133) - stored fields and shown-turn selectors share names

  • Finding: Knov proposed renaming the stored turn fields (for example storedChatStatus) so a direct read says it bypasses the pending edit, since state.chatStatus and selectChatStatus(state) differ while pendingEdit is set.

  • Author defense: added a comment on ChatStoreState.pendingEdit (e874a14) saying the selectors show editTurnStart while it is set and that reads of what the transcript shows go through them; the six direct reads reconcile against the stored turn on purpose (queue diffs, status transitions, tool-result invalidation), so renaming five fields would change none of them.

  • Panel closure (CRF-79, R5, 1/1): Knov, the agent that raised it (round-4 agent resumed), re-read the six direct reads at head: queue diffs (useChatStore.ts:650,668) and the status transition (681) need the stored turn, useChatToolInvalidations.ts:31 acts on real tool results, and AgentChatPage.tsx:575 and submitChatTurn.ts:385 cannot run during a pending edit. The rename would change none of them; the rule is now on the pendingEdit field (chatStore.ts:134-135).

CRF-89 (Nit, useChatStore.ts:102) - useCallback in a React Compiler path

  • Finding: Netero: onDurableMessages keeps useCallback under src/pages/AgentsPage/, against site/AGENTS.md:82; make it a plain function.
  • Author defense: it is in the WebSocket effect's dependency list, so its identity decides when the stream reopens; useCallback states that dependency in code instead of leaving it to the compiler.

CRF-93 (P1, PR) - mandatory split

  • Finding: Law: split into stream-only store, pending actions at the click, editable composer.
  • Author defense: "I am keeping this as one PR, because one PR is easier to revert if needed."

CRF-95 (P3, chatStore.ts:474) - concurrent queue actions end each other's parts

  • Finding: Takumi, Komugi, Mafuuu: the first queue_update ends the second action's part.
  • Author defense: fixed for delete (2fd72eb: ends at the update without its row). For promote, the row-based rule kept a part through an update that reported two coalesced promotes, so promote ends at the next queue update (42ef536).

CRF-96 (P3, useChatStore.ts:247) - one-second reconnect loop

  • Finding: Hisoka, Takumi, Komugi, Razor: client-initiated closes after open never grow the backoff (older replica and parse error).
  • Author defense: older replicas are not supported, so 3a44374 removes the check that closed the socket. A parse-error loop needs a server that sends the same malformed frame again, and each retry resumes after the last applied version.

CRF-95 promote panel closure (R7, 3/3)

  • Panel closure (R7, 3/3): Takumi, Komugi and Mafuuu (round-6 agents resumed) accepted the next-update rule for promote: the row-based rule failed on an update that reports two coalesced promotes, and the early end is stated in the PR description.

CRF-96 parse-error panel closure (R7, 4/4)

  • Panel closure (R7, 4/4): Hisoka, Takumi, Komugi and Razor (round-6 agents resumed) accepted: the loop needs a server that resends the same malformed frame, and the older-replica path is removed (3a44374).

CRF-89 re-raise (R7)

  • Panel: Netero (resumed) re-raised at Nit: onDurableMessages captures only chatID and queryClient, which are already in the effect's dependencies, so useCallback adds nothing the dependency list does not state; useEffectEvent or a plain function. Gon adds the name reads as an event callback (invalidateMessageQueries).

CRF-93 re-raise (R7)

  • Panel: Law (resumed) re-raised Mandatory: the end rule changed three more times (7c95687, 42ef536, 2fd72eb); the composer produced two more fixes (91e97f6, 36cd217); main squash-merges, so three PRs allow a partial revert and a full revert is three commits.

CRF-93 R9 author reply

  • Author defense (R9): the parts form a chain (the editable composer relies on sends showing at the click; pending actions rely on the store's snapshot versions), so a split adds only the option to revert the later parts; the end-rule changes touch only chatStore.ts, useChatStore.ts and their tests, so that part can be reviewed by those files.

CRF-141 (P4, useConversationEditingState.ts:135) - Edit enabled but no-op during send

  • Finding: Mafuuu, Nami.
  • Author defense: chosen behavior, stated in the comment; gating on !canSubmitChatTurn would also hide Edit while a chat setting saves, which main does not do.

CRF-154 (P4, AgentChatInput.tsx:1177) - catch comment describes the store

  • Finding: Gon.
  • Author defense: the second clause says why the empty catch loses nothing for a delete; a failed promote reports through handleRequestError in the caller.

CRF-157 (P4, submitChatTurn.ts:290) - buildOptimisticEditedMessage builds sends

  • Finding: Gon.
  • Author defense: it is main's helper; renaming and changing its parameters changes main's edit path, which this PR does not need.

CRF-158 (Nit, ChatPageContent.tsx:175) - streamError key

  • Finding: Gon.
  • Author defense: streamError is deriveLiveStatus's input name on main; renaming that input was listed out of scope (CRF-172).

CRF-166 (P3, useChatStore.ts:455) - 400 cursor retried forever

  • Finding: Chopper.
  • Author defense: a failed handshake retries forever on main too (CRF-170); a reload fetches the newest page; recovery after failed handshakes is new reconnect behavior, out of this PR.

CRF-167 (P4, AgentChatPage.tsx:494) - non-API failure silent

  • Finding: Chopper.
  • Author defense: handleRequestError ignores non-API errors on main too; main showed edit and promote at the click and rolled back silently the same way; the composer restores a failed send's draft.

R9 panel closures

  • CRF-141 (2/2): Mafuuu and Nami accept: one ignored click, no lost draft; the early return prevents CRF-99; the comment and description state it.
  • CRF-154, CRF-157, CRF-158 (1/1): Gon accepts: the clause is true for the one caller; renaming main's helper changes main's edit path for readability only; the key is deriveLiveStatus's unchanged parameter name.
  • CRF-166, CRF-167 (1/1): Chopper accepts: main's after_id also goes wrong after a restore (restored ID sequence skips messages), so both need a reload, and recovery belongs with CRF-170; non-API failures roll back silently on main too and the draft returns.
  • CRF-93: Law re-raised Mandatory: the chain is the stacking order, not an argument against stacking; a split also lets slice 1 merge while slice 2 changes; end rule changed three more times (40d2884, def84c9, a3f3097); 5a7f502 and its reversal def84c9 decide slice-1 and slice-2 rules in one function; slice 3 was stable this round.

R10 author replies

  • CRF-93: "Keeping this as one PR: as the author I decided one PR is easier to revert if needed." Answers the round-9 line "A human can override this call."
  • CRF-174 (Bisky): an ID check would be a second end rule and removes the first-open early end only for sends and promotes; version-only rule stays.
  • CRF-176 (Komugi): the same taskset command passed in 1386 ms and 1240 ms on the author's workspace; cost depends on the machine; the :80 test's cost is listed out of scope.
  • CRF-178 (Gon): the doc lists which parts an action has next to the rule that ends each part, so a reader of the end rules need not read pendingEntry.
  • CRF-182 (Meruem): only deleteQueued sets isRowGone and it builds only a queue part; moving it changes every action's part type without changing behavior.

R10 panel closures

  • CRF-93: Law accepts the author's override (the round-9 review said a human can override); no new evidence this round; verdict Split, Advisory, on record for human reviewers.
  • CRF-174 (1/1): Bisky accepts: the case needs another writer's commit in the version/page read gap plus a click before the first frame; the ID check would not cover a resent queue_update.
  • CRF-176 (1/1): Komugi accepts: reruns ran on a host with load 38 to 82; the author's 1386 ms on a dedicated core is the better measure.
  • CRF-178 (1/1): Gon accepts: one sentence tells a reader of the end rules that an edit ends at three events.
  • CRF-182 (1/1): Meruem accepts: no runtime change; pendingEntry is the only constructor, 80 lines below.

CRF-204 (P4, useConversationEditingState.ts:256) - plain-text compose draft removed after a successful edit

  • Finding: Bisky (scratch hook test).
  • Author defense: on the page, the editor stores a plain-text draft as Lexical JSON as soon as it seeds it, so the compose draft has an editor state whenever it has content; a browser run from a plain-text draft kept the draft in the composer and in storage after a successful edit with nothing typed; the hook test has no editor to make that write.

R12 panel closures

  • CRF-204 (1/1): Bisky accepts: ContentChangePlugin mounts before ValueSyncPlugin (ChatMessageInput.tsx:1235), so the seed stores Lexical JSON and showComposeDraft never seeds undefined for a draft with content; the round-11 reproduction had no editor.

R15 author replies

  • CRF-228 (Pariston, Knov): each request that takes a message ID now gets a server ID (Edit withheld on pending rows; fetchMoreMessages and the Summary panel read selectOldestStoredMessageID); a guard in the query functions would protect only code that does not exist yet.
  • CRF-230 (Gon, Leorio): the store holds the messages loaded from the server; pending rows were never loaded, so oldestLoadedMessageId is accurate; keeping main's name keeps the lines out of the diff.
  • CRF-234 (Leorio): the panel's before_id comes from stored messages, which never hold pending rows, so its request has nothing to skip and the bullet's list is complete.

R15 panel outcomes

  • CRF-228: Knov accepts (both before_id reads go through one named selector; the guard would not cover the class). Pariston holds at P4: the defense is right about current code, but the next shown-ID consumer fails silently, as in R14, and the guard is two lines; leaves the call to a human. Stays open at P4, non-blocking.
  • CRF-230 (2/2): Gon and Leorio accept: pending rows were never loaded, so "loaded" excludes them; the selector doc carries the distinction.
  • CRF-234 (1/1): Leorio accepts: the panel no longer reads shown rows, so it has nothing to skip.

Round log

Round 1

Netero first pass (1 P2, 1 P3, 1 Nit), then full panel (round 1): ging-ts, nami, takumi, melody, pariston, mafuuu, bisky, gon, leorio, komugi, meruem (wildcard). 10 panel + wildcard exceeds the focused target of 8 because Gon and Leorio are the round-1 floor and ging-ts, nami, takumi, melody were triggered. Pagination overwrite (CRF-4) classified in scope: fix changes patchChatMessages to meet the PR's goal; severity P2 by disagreement tiebreak. CRF-6 downgraded P2 to P3: keep-argument "the PR rewrote the doc into a false statement about a shared predicate"; downgrade reason: the false claim narrows the stated match set, so no caller gets wrong behavior from it. Takumi's remount-refetch note folded into CRF-1. Reviewed against 5ca77e2..5ec0d69.

Round 2

Churn guard PROCEED: CRF-1 to CRF-8 author fixed (025b7f0, 8f0173e); panel confirmed CRF-4 fixed (Nami, Pariston, Mafuuu, Melody). Restructure round (patchChatMessages rewritten, reapplyAfterFetch added, PR description goal changed): full panel ging-ts, nami, takumi, melody, pariston, mafuuu, bisky, gon, leorio, chopper (wildcard). Workspace outage interrupted after Netero; resumed with same round state. CRF-16: Chopper P3 vs Mafuuu/Takumi Note; Chopper's scenario (fetch B sent after the write, returns without it) contradicts the PR's own failed-fetch rule, higher wins. CRF-17: Gon P2 vs Takumi P4; keep-argument: exported function documents a false safety guarantee and an in-tree updater (edit projection) violates it, guarded only by the await cancel; kept P2. Gon's other comment P2s downgraded: 1178 and 2342 to P3 (keep-argument: misleading "new page" and the only in-code guard for the bypass; downgrade: no behavior effect), test comments 5082/5149 to Nit (narration only). CRF-9 dropped: keep-argument "the queue_update still makes the refetch redundant"; drop reason: the refetch is no longer discarded, so the cost described no longer exists. Reviewed against a4b68ac..2037768.

Round 3

Churn guard PROCEED: CRF-14 to CRF-28 addressed by removal of the replay in the redesign. Restructure round (base moved to #29662 head, 14 files, new exports, goal rewritten). Law ran (+1002 effective): Don't split, advisory. Netero: 4 P3, 1 P4. Full panel: ging-ts, ging-react, nami, takumi, melody, komugi (specialists), pariston, mafuuu (core), bisky, gon, leorio (floor/restructure), hisoka (pool), meruem (wildcard); 13 exceeds focused target because six specialists triggered. Dropped CRF-70/71: keep-argument "useChatStore.ts:856 says the store is shared, so an unkeyed route would expose it"; drop reason: router.tsx lazy-imports the default export KeyedAgentChatPage, keyed by agentId on both routes, and useChatStore creates its store with useState per mount. CRF-36: Gon P2 vs Leorio P4; keep-argument: contradictory comments on the core ordering guard; downgraded to P3 because send responses do not advance the cached history_version, so the history_version reconnect resends the dropped batch; loss is limited to the after_id path and unverified. Gon comment P2s downgraded to P3/P4/Nit (no behavior effect); CRF-45 kept at P3 because the comment is false. Reviewed against e2f393f..61d7798.

Round 4

Churn guard PROCEED: 29 addressed, CRF-41 contested, CRF-36 test request contested. Branch rebased onto a73dc4e. Restructure round (files added to the PR: coderd/exp_chats_test.go, AgentChatPageView.tsx, ChatMessageScroller.tsx; onFetchMoreMessages prop type changed). Law skipped (+206 since R3 analysis). Netero: 1 P3, 1 P4, 1 Note. Full panel: ging-ts, ging-react, ging-go, takumi, melody, komugi, pariston, mafuuu, bisky, hisoka (new agents), nami, gon, leorio (round-3 agents resumed for dispute check-in), knov (wildcard). Ryosuke not selected: the only Go change is a test file with no package-boundary or API surface. CRF-41 closed 1/1, CRF-36 test request closed 2/2. CI title failure: job log shows the earlier fix(site) title failed the scope check on coderd/exp_chats_test.go; current title fix: ... has no scope (CRF-74). CRF-70/71 re-checked: page still keyed by agentId (AgentChatPage.tsx:864), so the Codex thread at AgentChatPage.tsx:320 repeats a disproved claim. Reviewed against a73dc4e..4e5f251.

Round 5

Churn guard PROCEED: CRF-72 to CRF-78 author fixed (04ec244, 64227af, e874a14); CRF-79 rename declined, treated as contested. Branch rebased onto 698f065; round-5 delta is four commits (+103 -11). Fix round (no files added, no signature change, small delta). Netero: 1 Note (CRF-83). Panel: knov (round-4 agent resumed, dispute), gon, leorio (comments touched), ging-ts, ging-react, nami (changed-file specialists), razor (wildcard). CRF-79 closed 1/1. Gon P4 and Leorio P4 on useChatStore.ts:113 merged as CRF-84. Reviewed against 698f065..ba9a198.

Round 6

Churn guard PROCEED: CRF-84, CRF-85 addressed by removal in the second redesign (stream-only store, pending actions, editable composer). Rebased onto e2bae13. Law ran (+3518 effective, grew +2516 since R3): Split, Mandatory. Netero: 1 P3, 2 P4, 3 Nit, 1 Note. Law decision gate: mandatory split, panel skipped, REQUEST_CHANGES with Netero findings and split proposal. This round counts as a Netero-only round for the consecutive cap. Human threads from DanielleMaywood answered by author (f929878). Reviewed against e2bae13..ba7ddb7.

Round 6 (continued)

The CLI rejected the Law-only post twice: REQUEST_CHANGES needs panel reviewers, and any post after a prior panel round needs panel reviewers. The skill's mandatory-split gate (skip panel) conflicts with the CLI; ran a full panel. Restructure round. Panel: ging-ts, ging-react, nami, takumi, melody, komugi (specialists), pariston, mafuuu (core), bisky, gon, leorio (floor/restructure), hisoka, luffy (pool), razor (wildcard). CRF-86 dropped: Bisky showed chatStore.test.tsx:4901 and :2837. CRF-129 dropped: keep-argument "the comment at ChatPageContent.tsx:669 promises attachments added during the request stay"; drop reason: AgentChatInput.tsx:978 sets onWorkspaceAttach undefined while isLoading, so no workspace upload can start during a send (Hisoka checked the same path). CRF-44 reopened: Pariston found 9361614's tests absent; grep confirms 0 matches. CRF-82 dropped: Melody showed the client no longer writes running. Gon comment P2s downgraded to P3 (false or misleading statements) or Nit (restatement). Event REQUEST_CHANGES for the mandatory split.

CRF-86 restored after the CLI rejected a drop made after the first post attempt; posted with Bisky's correction that the load-failure path is covered.

Round 7

Churn guard PROCEED: 41 addressed; CRF-89 and CRF-93 contested; CRF-95 promote and CRF-96 parse-error partially contested. Rebased onto 1e7c5fd; +4280 -6692, 47 files. Law (resumed): Split, Mandatory, re-raised. Netero (resumed): CRF-89 re-raised, CRF-138, CRF-139. Panel: takumi, komugi, mafuuu, hisoka, razor (resumed for disputes); ging-ts, ging-react, ging-go, nami, melody, pariston, bisky, gon, leorio, chopper (wildcard). CRF-95 promote closed 3/3, CRF-96 parse-error closed 4/4. Calibration: Gon comment P2s downgraded as in R6 (false statements P3 or P4, restatements Nit); Chopper's non-API error P3 to P4 because the composer restores the draft on failure; Chopper's delete catch P4 merged into the same-as-main OOS item with Nami and Leorio. CRF-166 verified: main used after_id, so the 400 on a cursor above the chat's version is new client behavior. Event REQUEST_CHANGES for the mandatory split. Reviewed against 1e7c5fd..0e8cd3a.

Round 8 update

BLOCKED. CRF-93 (mandatory split) silent: the author's reply to the R7 re-raise repeats the R6 sentence the re-raise rebutted. Churn guard: 26 addressed, 6 contested (CRF-141, CRF-154, CRF-157, CRF-158, CRF-166, CRF-167), 1 silent. No review panel. Head c99aa01.

Round 9

Round 8 blocked on CRF-93; the author then replied with a new argument (chain; review by file). Head unchanged (c99aa01). Churn guard PROCEED: 26 addressed, 7 contested. Law (resumed): Split, Mandatory, re-raised. Netero (resumed): no findings; CRF-89, CRF-138, CRF-139 verified. Fix round (delta 0e8cd3a..c99aa01). Panel: mafuuu, nami, gon, chopper (resumed for disputes); ging-ts, ging-react, komugi, bisky, melody, leorio, pariston (new); meruem (wildcard, random from distilled set). All six non-Law disputes closed. Gon P2s downgraded (false reason P4, restatement Nit); two Gon Nits dropped as re-raises without new evidence (CRF-185, CRF-186); Meruem isRowGone P4 to Nit (no current bug). Event REQUEST_CHANGES for the mandatory split. Reviewed against 0e8cd3a..c99aa01.

Round 10

Churn guard PROCEED: 6 addressed (CRF-175, 177, 179, 180, 181, 183), 5 contested. Author stated the split override as a human decision. Law (resumed): Split, Advisory; not re-raised. Netero (resumed): 1 P4 (CRF-194). Fix round (delta c99aa01..418d431, +29 -17, 4 files). Panel: bisky, komugi, gon, meruem (resumed for disputes); leorio (doc comments changed); zoro (wildcard, random). All disputes closed, CRF-93 included. Gon's P2 on the resend paragraph dropped (CRF-198, ping-pong with the adopted CRF-180 text); Zoro's wrapper and load-state P4s to Nit (style). Event APPROVE: no open finding above P4 and no mandatory split. Reviewed against c99aa01..418d431.

Round 11

Churn guard PROCEED: 9 of 9 addressed. Law skipped (effective additions grew 233 since R10, under 500). Netero (resumed): no findings; CRF-194 verified. Fix round (delta 418d431..1215742, 14 commits, 11 files; includes new composer behavior for edits and unmount). Panel: nami, mafuuu, bisky, gon, leorio, hisoka, ging-react; zoro (wildcard, random). Gon comment P2s to Nit (restatements); Zoro showComposeDraft duplication P4 to Nit; Bisky's test-wrapper Note to Nit because it asks for a change. Event APPROVE: nothing above P4. Reviewed against 418d431..1215742.

Round 12

Churn guard PROCEED: 10 addressed, CRF-204 contested. Law skipped (+22 since R11). Netero (resumed): no findings. Fix round (delta 1215742..e941530, 3 commits, 4 files). Panel: bisky (resumed for CRF-204), gon, leorio, mafuuu, razor (wildcard, random). CRF-204 closed 1/1. Gon's P2 on :188 to Nit, merged with Leorio's; Gon's rename P4 dropped (CRF-218). Event APPROVE. Reviewed against 1215742..e941530.

Round 13

Churn guard PROCEED: 5 of 5 addressed. Law skipped (+3). Netero (resumed): no findings. Fix round (delta e941530..5e507a9, 2 commits, comments and one rename). Panel: gon, leorio, mafuuu, razor (wildcard, random). Gon's three P2s: one kept as Nit (CRF-224, comment on code the PR changed), two dropped as ping-pong with earlier adopted findings (CRF-225, CRF-226). Event APPROVE. Reviewed against e941530..5e507a9.

Round 14

Rebased onto 4ed589d (round-13 head maps to 2170fae). Churn guard PROCEED: CRF-224 addressed. Law skipped (+65). Netero (resumed): no findings; rebase joins match main. Restructure round (rebase conflict resolutions merge main's chat projects, ACPContext, attachments panel, turn action bar, skill preferences). Panel: nami, mafuuu, bisky, melody, pariston, gon, leorio, hisoka; knov (wildcard, random). Pariston and Knov P3 on the pending-ID type hazard to P4 (the realized bug is fixed; remaining risk is future consumers, as CRF-181). Nami's attachments reload moved out of scope (same path on main). Gon P2s to Nit. Event APPROVE. Reviewed against 4ed589d..a3e8aef, focus 2170fae..a3e8aef.

Round 15

Rebased onto 36d77b8 (round-14 head maps to 87aedb7). Churn guard PROCEED: 4 addressed, 3 contested. Law ran (+814 since R10): Split, Advisory, CRF-93 stays closed. Netero (resumed): no findings; rebase join matches main. Restructure round (749f465 restores main's queued-message edit work on the store; 7496838 changes placement). Panel: pariston, knov, gon, leorio (resumed for disputes); nami, mafuuu, bisky, melody, komugi, hisoka, ging-react; meruem (wildcard, random). Placement in 7496838 checked against chatstate by Pariston, Knov, Nami, Mafuuu, Melody, Leorio; mutations by Bisky, Melody, Meruem. Event APPROVE. Reviewed against 36d77b8..5063feb, focus 87aedb7..5063feb.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 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-10-30T20:23:27.132349Z 5063feb 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

This comment has been minimized.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR makes patchChatMessages cancel an in-flight background refetch of the messages query before each cache write. Findings: 2 P2, 3 P3, 1 P4, 2 Nit. The cancel also discards refetches whose purpose is to load state the stream does not send, and a fetchNextPage in flight still overwrites the write. Re-applying the write after any in-flight fetch settles, instead of cancelling, would address both P2 findings and the no-op cancel.

Out of scope (needs a ticket or explicit acceptance by a human):

  • codersdk/chats.go:962: ChatMessagesResponse carries no history version, so the client cannot tell whether a REST read is older than the stream events it already applied; every client-side guard for this race is a timing heuristic.
  • site/src/api/queries/chats.ts:955: the isBackgroundRefetch parameter type requires queryKey, which the body never reads.
  • site/src/api/queries/chats.ts:958: the inline comment repeats the JSDoc's first-fetch rationale, so the two copies can drift.
  • site/src/pages/AgentsPage/components/ProjectPage/ProjectChatsList.test.tsx: "loads the next page when the end of the list scrolls into view" timed out at 5000 ms on an unmodified head during a loaded run and passed on rerun.

Notes:

  • site/src/api/queries/chats.ts:2392: a queued-message delete already bumps queue_version, so the stream sends a queue_update; with this PR that write cancels the refetch deleteChatQueuedMessage starts whenever it lands first, so during a running turn the invalidation mostly costs a discarded request.

🤖 This review was automatically generated with Coder Agents.

Comment thread site/src/api/queries/chats.ts Resolved
Comment thread site/src/api/queries/chats.ts Resolved
Comment thread site/src/api/queries/chats.test.ts Resolved
Comment thread site/src/api/queries/chats.ts Resolved
Comment thread site/src/api/queries/chats.ts Resolved
Comment thread site/src/api/queries/chats.ts Resolved
Comment thread site/src/api/queries/chats.test.ts Resolved
Comment thread site/src/api/queries/chats.ts Resolved
@mafredri mafredri changed the title fix(site): stop stale message refetches overwriting the stream fix(site/src/api/queries): keep stream writes made while a messages fetch is in flight Oct 8, 2026
@mafredri
mafredri force-pushed the fix/chat-messages-refetch-overwrite branch from 5ec0d69 to 2037768 Compare October 8, 2026 12:11
@mafredri

This comment has been minimized.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

@mafredri

This comment has been minimized.

coder-agents-review[bot]

This comment was marked as outdated.

@linear-code

linear-code Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

CODAGT-1124

CODAGT-903

@mafredri
mafredri force-pushed the fix/chat-messages-refetch-overwrite branch from 2037768 to 62621a3 Compare October 9, 2026 09:36
@mafredri
mafredri changed the base branch from main to fix/chat-stream-history-replay October 9, 2026 09:36
@mafredri mafredri changed the title fix(site/src/api/queries): keep stream writes made while a messages fetch is in flight fix(site): stop fetches from overwriting streamed chat messages Oct 9, 2026
@mafredri

This comment has been minimized.

@mafredri
mafredri force-pushed the fix/chat-messages-refetch-overwrite branch from 62621a3 to 028881d Compare October 9, 2026 10:35
@mafredri
mafredri force-pushed the fix/chat-messages-refetch-overwrite branch from 7d672d8 to 96b147e Compare October 9, 2026 12:04
@mafredri

This comment has been minimized.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This round redesigns the fix: after the first page loads nothing replaces the messages cache, older pages are appended, a pending edit is hidden in the store instead of truncating the cache, and send and edit responses apply only when ahead of the cache. Findings: 13 P3, 9 P4, 8 Nit (most are tests and comment wording). All round-2 findings are addressed by removing the replay. The redesign holds up against every interleaving the reviewers traced: edit response before and after the stream's reset, a second edit from another tab, older-page loads racing resets, and responses after leaving the chat.

Out of scope (needs a ticket or explicit acceptance by a human):

  • coderd/database/queries/chats.sql:2643: isAheadOfCachedMessages relies on two server rules (message IDs follow commit order; every deletion inserts a newer message) that only this client comment states; SoftDeleteContextFileMessages deletes without inserting and has no caller, so wiring it up would let a late response restore a deleted message.
  • site/src/pages/AgentsPage/components/ChatConversation/chatQueueReconciliation.ts:81: the queue-promote failure path and the /compact failure path (submitChatTurn.ts:165) still restore pre-request snapshots over stream updates delivered meanwhile.
  • site/src/pages/AgentsPage/components/ChatConversation/useChatStore.ts:221: "Compute the last REST-fetched message ID" is wrong; the cache also holds stream and response writes.
  • site/src/pages/AgentsPage/components/ChatConversation/useChatStore.ts:206: the wsStatusReceivedRef comment cites a window-focus refetch that App.tsx:20 disables.
  • site/src/pages/AgentsPage/components/ChatConversation/useChatStore.ts:248: upsertCacheMessages and replaceCacheMessages are useCallbacks against site/AGENTS.md:82, and the first name hides that it invalidates prompts, automations and searches.
  • site/src/pages/AgentsPage/components/ChatConversation/useChatStore.ts:311: the prevChatIDRef.current !== chatID branch never runs, because KeyedAgentChatPage remounts the page per agentId; comments still describe one store serving several chats.

Notes:

  • useChatStore.ts:317: "the page only adds messages to the store and never removes any" holds only because the stream's reset removes messages that a cache-only edit response deleted after the user left and reopened the chat.
  • chatStore.ts:309: when the edit response beats the stream's history_reset, old-turn message_part events still on the socket show under the edited message until the reset clears them; the window predates this PR.
  • PR description: "turn fill requests" is not defined; for example, "a page that starts in the middle of a turn also requests that turn's older messages".

🤖 This review was automatically generated with Coder Agents.

Comment thread site/src/api/queries/chats.ts Resolved
Comment thread site/src/api/queries/chats.test.ts Resolved
Comment thread site/src/api/queries/chats.ts Resolved
@mafredri
mafredri force-pushed the fix/chat-messages-refetch-overwrite branch from 61d7798 to 4e5f251 Compare October 9, 2026 15:02
@mafredri mafredri changed the title fix(site): stop fetches from overwriting streamed chat messages fix: stop fetches from overwriting streamed chat messages Oct 9, 2026
@mafredri

mafredri commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

In reply to AMREM-3 (Nit, PR description:1): #30478 (review)

The description now says what the fill is: since #30524, a page that starts in the middle of a turn also fetches that turn's older messages.

🤖 Posted using /amend-review skill via Coder Agents.

@mafredri

mafredri commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

$@codex review\n/coder-agents-review\n\n> 🤖 This review was automatically generated with Coder Agents.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

…t renders

The locked editor is a visual state, so the create form test of its
contenteditable attribute is gone and an AgentChatInput story shows it.
The pending row test in ConversationTimeline clicks every Edit button
and checks the callback. The ChatPageContent test of the draft's
workspace uploads during an edit only checked which chips render, so it
is gone. Other ChatPageContent tests drop their checks of what renders.
…rce does

The harness passes the row the shown queue marks, which the source
calls markedID. The server names no longer fit, because this tab's
pending begin or end marks the row too.
… SendShowsPromptAtSubmit

submitChatTurn tests check that a send shows its prompt at submit, so
the story only drives the page into that state for the screenshot.
…is, and drop two comments

The comments restated the guard and the function body below them. The
comment on the request-in-flight condition named the rollback as the
restorer of the kept content; the rollback is the reason a target is
not loaded then.
…ctly in its tests

Only the deleted edit test passed another input component, and the
composer is queried by its role like the rest of the suite.
…pt a fixed timestamp

SendingFromHistoryDoesNotSnapToBottom built the message with the
current time, so the story data changed on every run.
… no longer fail

useConversationEditingState calls neither focus nor isMobileViewport,
so the mobile focus test and the focus assertions checked nothing. The
matchMedia helper had no other use.
…ies the page cannot show

The page passes the row that the shown queue marks as the row under
edit, so a row's marker and the under-edit ID always agree. A pending
begin or end changes the marker at the click.
…ns a reason

A pending row's action buttons were disabled natively, so they left the
tab order and their tooltip could not show. They now use the reason
tooltip that the Edit button already has.
Edit on a sent message or a queued row did nothing during a request,
and the buttons gave no reason. The page now passes no edit handler
while a request is pending, so the buttons are not shown, and the
handlers and the hook lose their in-flight check.
…pace upload during an edit

ChatPageContent shows the compose draft's workspace uploads while an
edit request runs, and no story showed that state. The story uploads a
file to the draft, saves an edit against a request that never settles,
and leaves the screenshot to Pixel. It reuses the rebuilt workspace,
whose agent is connected, so the composer accepts workspace uploads.
submitChatTurn.ts is its only caller, and it builds the content of a
send and a queued save as well as an edit, so neither the file under
api/queries nor the name said what it is.
… the invalidation by its queries

It invalidates the prompt history and the chat search. The messages
query that the name referred to no longer exists.
…ng actions on stored state

A pending action ended at the next stream event of a type, which the
client cannot match to its own request: two deletes before the first
result ended together at the first queue_update, and the second row
showed again. Each action now shows only its effect on the row or
message acted on, and ends when the stored state holds its result.
upsertDurableMessages and setQueuedMessages took a snapshot version that
nothing reads: pending actions end on the stored state, and the stream
resumes from the version that advanceSnapshotVersion records.
The chat store shows a pending send or edit until the stream reports new
user content, oldest first, so the server must make the changes in the
order the user made them. A shared mutation scope runs the requests one
at a time, and a request that waits is pending, which keeps the composer
from accepting another submit meanwhile.
…ed actions at a connection's first read

When the stream falls behind several of the user's actions, one read can
report all of them, and counting new user content can end the wrong
action and leave another for good. A connection's first read holds the
result of every request that settled before it opened, so those actions
end there. The store now leaves request order to the mutations, queues a
send behind an earlier pending message, and keeps the shown queue's
identity while only the stream state changes.
… pending begin of an edit on another row

The server ends a row's edit when another row's edit begins, so after two
begins the first one's result shows only if the client reads the queue in
between. When one read covers both, the first begin never ended.
…omment

compactChat and clearChat change the chat too but do not share the scope.
…ved actions at the first status and edits by ID

A connection's first read can span several WebSocket messages and ends
with its status event, so ending the resolved actions after the first
message let a deleted row show again. Counting an edit's message as new
content could end an earlier send instead and leave the edit hiding the
transcript; an edit now ends by its message ID and replaces the earlier
sends, whose results it deletes.
…at an edit deletes and where the status event comes

Three comments said more than the code does: an edit also deletes the
edited message, the queue is cleared as its own step, and a first read
can send events after its status event.
…ueued row as new by its ID, not by the highest ID

The server delivers a steer row before an older queue row. When one
read reported both, the older row was below the highest stored row ID
and did not count, so one pending send never ended and showed next to
its stored message.
…pending actions without a reconnect rule

A reconnect ended the pending actions whose requests had resolved,
because counting could leave one pending for good. Two changes make
every such action end on the stream's state: rows count as new by ID,
and a message edit replaces an earlier pending edit, whose message it
deletes.
… the received row IDs and the replaced actions' tests for what they hold

The set holds every queued row ID the store received, including rows
that are no longer stored, and two tests named an end at a read for an
action that its replacement ends at the click.
…nto main dropped

Replaying the branch's commits with their side preferred dropped main's
attachments hook changes, so this restores the tree of the merge with main.
…at's status between visits

A chat rendered without a status from the moment it opened until the
stream's first status event. The timeline renders a chat without a status
as an ended turn: the working block shows the duration up to its last
stored step, and the turn's last text shows as the answer. When the stream
reported running, the block's clock jumped and the text folded into the
block. This happened on every return to a running chat, because the end of
a visit cleared the status.

The end of a visit now keeps the status and the turn error, and a new
store takes its first status from the chat record.
…eep a chat's status between visits"

This reverts commit 2e9e9ac.
…e stream reports one

The timeline and the composer read the status from the chat store only,
and the store has none from the moment a chat opens, or reopens, until the
stream's first status event. The timeline renders a chat without a status
as an ended turn: the working block shows the duration up to its last
stored step, and the turn's last text shows as the answer. When the stream
reported running, the block's clock jumped and the text folded into the
block.

Both now fall back to the chat record's status, as the page already does
for its other readers. The chat list's watcher keeps that status current
while the chat is closed.

This branch had an error being deployed

1 failed and 1 inactive deployments
main — 5e06eb78 Deployed Nov 17, 2026 by mafredri via cla #258864
docs-preview — 5e06eb78 Deployed Nov 17, 2026 by mafredri via cleanup #174
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants