Repository navigation
fix(site/src/pages/AgentsPage): skip chat list refetch on diff status events - #32080
Conversation
… events The chat watch handler refetched every chat list on each root diff_status_change event. On dogfood a watch socket received 41 such events in 30 seconds, and each one aborted the list requests in flight and started new ones, so most chat list requests never completed. The event carries the changed diff status and the handler merges it into the cached rows, so the refetch only matters for lists whose membership depends on it. Refetch on diff_status_change only when the sidebar has a PR status filter. The event still cancels list refetches that are in flight. One started by something else is no longer restarted by this event.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| const activeChatIdForWatch = useEffectEvent(() => agentId); | ||
| const sidebarFiltersForWatch = useEffectEvent(() => sidebarFilters); |
There was a problem hiding this comment.
lmao what the heck are we doing here 😂
There was a problem hiding this comment.
This probably needs a larger cleanup later 😆
|
Codex Review: Didn't find any major issues. Breezy! 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". |
The chat watch handler refetched every chat list on each root
diff_status_changeevent. On dogfood, one watch socket received 41 of these events in 30 seconds. Each event aborted the chat list requests in flight and started new ones, so mostGET /api/v2/chatsrequests were cancelled before they completed.The event carries the changed diff status and the handler merges it into the cached rows, so the rows stay current without a refetch.
shouldInvalidateFilteredChatListnow takes the sidebar filters and asks for a refetch ondiff_status_changeonly under a PR status filter, the one sidebar filter whose membership depends on diff status.status_changeandproject_changestill refetch.Known limit: every watch event still cancels the list refetches in flight, to protect its cache write. Until now a root
diff_status_changethen restarted them. It no longer does, so a refetch that another trigger started can be dropped, and the list waits for the next trigger. Child chat and title events already behave this way.Verified with: the new
AgentsPageLayout diff status eventstests, which fail when the change is reverted and when the filters are read at mount time, theshouldInvalidateFilteredChatListtable,pnpm checkandmake pre-commit.Part of CODAGT-1515. Related to CODAGT-1219.
Decision log
diff_status_changeonly when the status changes (CODAGT-1219) would help every open tab at once, but why the events arrive is not established: one chat received 8 in 30 seconds, which a 120 second refresh interval does not explain, and the payloads were not compared. This change holds whatever sends the events.shouldInvalidateFilteredChatList, not at its call site, so the predicate and its tests state when a list refetches.useEffectEvent, likeactiveChatIdForWatch, so the socket effect keeps its dependencies and does not reconnect when filters change.status_change, and the search invalidation, which still runs on each event while a search is open.