{{ message }}
feat(site/src): reconcile chats-by-workspace cache across archive and watch paths - #27901
Merged
DanielleMaywood merged 2 commits intoAug 6, 2026
Conversation
Contributor
Author
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
DanielleMaywood
force-pushed
the
feat/by-workspace-reconciliation
branch
from
August 6, 2026 08:23
e7b7c15 to
ab5794a
Compare
DanielleMaywood
force-pushed
the
feat/by-workspace-reconciliation
branch
from
August 6, 2026 08:47
ab5794a to
9474956
Compare
DanielleMaywood
marked this pull request as ready for review
August 6, 2026 09:02
ibetitsmike
reviewed
Aug 6, 2026
Contributor
Author
There was a problem hiding this comment.
Shortened in 4a7cea4. The production comment is now one line stating the Set purpose, and the near-duplicate rationale moved into the exhaustive-kind test comment (created/deleted have their own watch branches; title/summary/diff/context do not move updated_at ordering). Net 6 lines removed.
Reply generated by Coder Agents.
ibetitsmike
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Implements Phase 2 item 5 of the chats query architecture: by-workspace cache reconciliation. Stacked on #27892; base branch
feat/chat-search-invalidation.Problem
chatsByWorkspacemappings (flatRecord<workspaceId, chatId>, IDs only, archived chats filtered server-side) go stale on archive/unarchive, workspace binding changes, and watch events (FINDINGS 2.3). Because the client cannot re-derive archived state from the cached map, the only correct repair for a stale mapping is synchronous removal plus family invalidation.Fix
removeChatFromChatsByWorkspace(queryClient, chatId)insite/src/api/queries/chats.ts: value-match removal across the by-workspace family, reference-preserving when nothing is removed (mirrors thepatchChatMessagesno-op pattern).archiveChat.onSuccessand the AgentsPageLayout archive-and-deleteonSuccesssynchronously remove the mapping; the existingonSettled/explicit invalidations then reconverge.deletedbranch removes then invalidates (remove-before-invalidate ordering);createdroot branch invalidates; merge path invalidates behind a newshouldInvalidateChatsByWorkspacepredicate (status_change,action_requiredonly;created/deletedhave their own branches, title/summary/diff/context events do not moveupdated_atordering);onOpenreconnect invalidates for convergence.useChatToolInvalidations: workspace-binding tool completion (create_workspace) also invalidates by-workspace; this is the only reconciliation path on the embed route.Confirmed exclusions
updateChatWorkspace.onMutate; the awaitedonSettledinvalidation already converges.createChatchange (already invalidates); no ACL or pin changes.Known constraints
deletedevents plus family invalidation repair the rest.patchChatworkspace-rebind branch publishes no watch event server-side, so cross-session manual rebinds converge only via the acting session'sonSettledor a WorkspacesPage remount; not fixable client-side.Testing
chats.test.ts: removal scoping and reference-preservation tests;it.eachwiring tests (archiveChat/unarchiveChat/updateChatWorkspace onSettled, createChat onSuccess invalidate by-workspace); synchronous-removal assertion forarchiveChat.onSuccess; negative assertions forupdateChatTitleandcreateChatMessage.AgentsPageLayout.test.ts: exhaustiveChatWatchEventKindtable forshouldInvalidateChatsByWorkspace.useChatToolInvalidations.test.tsx: create_workspace regression test extended with a seeded by-workspace bystander.PR generated by Coder Agents.