perf(web): provider status pushes no longer re-render every timeline row #20854
main fromrefs/pull/20854/head·merged by juliusmarminge View on GitHubProblem#
Render audit, lane 4, thread view on a 5.5k-item thread, idle across one providerStatuses push where only providers[].checkedAt, usageLimits.checkedAt and versionAdvisory.checkedAt change: 818 renders in 2 commits. The audit found two causes:
ChatViewpassed the environment'sserverConfig.providerstoMessagesTimelineasproviderStatuses, andMessagesTimelineput it in theTimelineRowCtxshared state. Each push builds a new providers array, sosharedStatewas rebuilt and every row that reads the context re-rendered: about 14AssistantTimelineRow/AssistantMessageMeta/AssistantForkButton, 12TurnFoldTimelineRow, and about 300 tooltips under them. Only subagent rows, subagent notification links and handoff rows use providers.- Every
ChatMarkdownsubscribed to the whole server-config map throughusePullRequestLinking. #20852 already fixes this with a per-environmentlinkModeAtom, so this PR does not touch it.
Fix#
providerStatusesis gone fromTimelineRowCtx, theMessagesTimelineprops, andChatView, which also dropstimelineProviders.- The leaves that need providers read
serverEnvironment.providersValueAtom(environmentId)themselves:EnvironmentSubagentAvatar(subagent group header andSubagentTimelineLink) uses twouseAtomValueselectors that return onlydisplayNameandiconUrl. Those are strings, so acheckedAt-only push givesObject.is-equal results and the avatar does not re-render.SubagentTimelineTooltipreads the full list. It mounts only while its hover popup is open.- Handoff rows go through
EnvironmentHandoffRow, which reads the list and renders the existingHandoffRow.ChatView's pending-handoffHandoffRowis unchanged.
No useMemo, useCallback, memo or "use memo" was added.
Why consumers now bail out (compiled output, oxc-transform-react)#
These files were compiled with reactCompiler: { reportDiagnostics: true }, the same call reactCompilerCoverage.test.ts makes: MessagesTimeline.tsx, V2LifecycleRow.tsx and ChatView.tsx. All three report 0 diagnostics.
ConversationTimeline builds sharedState (t88) under one guard. That guard used to include $[…] !== providerStatuses. It now reads:
if ($[178] !== activeThreadEnvironmentId || $[179] !== citationThreadRef || … || $[202] !== runs || $[203] !== skills || … || $[211] !== workspaceRoot) {
t88 = { citationRequest: readyCitationRequest, … };
Nothing in that guard changes on a provider push, so TimelineRowCtx keeps its value and the use(TimelineRowCtx) readers do not re-render.
EnvironmentSubagentAvatar compiles to:
t2 = (providers) => providers?.find((provider) => provider.instanceId === providerInstanceId)?.displayName; // cached on providerInstanceId
const displayName = useAtomValue(providersAtom, t2);
The selector is stable and returns a string. useSyncExternalStore compares that string, so the avatar only re-renders when the name or icon actually changes.
What still renders on a provider push#
ChatViewitself, which reads providers for the composer, the model picker and the pending-handoff row.- Visible handoff rows and open subagent tooltips, which use model names and display names from the full list.
ChatMarkdownblocks, until #20852 lands.
After:
Checks run: MessagesTimeline.test.tsx (88 passed; the handoff test now supplies providers through the atom with RegistryProvider initialValues), the apps/web typecheck, and scoped lint on the changed files.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Approvability#
Verdict: Approved at
d5c5684Macroscope's review found this PR approvable — This is a contained web performance refactor that removes provider-status updates from the shared timeline context while preserving provider data access where the UI needs it. It introduces no new capability, schema or default change, deployment change, or static-analysis suppression.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
2d7a501f-1ca3-4335-9c1a-223edf88295b
📥 Commits
-
Reviewing files that changed from the base of the PR and between 2fbd4318fc5b610c3e7fcfcbd5bbd80b73521d8f and d5c568455d8b1576b41d443bae6882546a4b2892.
📒 Files selected for processing: 4
-
apps/web/src/components/ChatView.tsxapps/web/src/components/chat/MessagesTimeline.test.tsxapps/web/src/components/chat/MessagesTimeline.tsxapps/web/src/components/chat/V2LifecycleRow.tsx
💤 Files with no reviewable changes: 1
-
- apps/web/src/components/ChatView.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
📝 Walkthrough
-
Chat timelines no longer receive provider status lists through props. Handoff rows, subagent avatars, and tooltips read provider data from the relevant environment. The timeline props also support optional skills data.
Changes: Chat timeline provider data
Layer / File(s) Summary Timeline provider contract and wiring
apps/web/src/components/ChatView.tsx,apps/web/src/components/chat/MessagesTimeline.tsx,apps/web/src/components/chat/V2LifecycleRow.tsxTimeline props and row state no longer carry provider statuses. ChatView and timeline call sites stop passing those statuses. Environment-scoped handoff and subagent rendering
apps/web/src/components/chat/V2LifecycleRow.tsx,apps/web/src/components/chat/MessagesTimeline.tsx,apps/web/src/components/chat/MessagesTimeline.test.tsxHandoff rows, subagent avatars, and tooltips read provider data from the relevant environment. Handoff tests provide provider data through the environment atom. Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Suggested reviewers:
maria-rcks
Merge Risk: ⚪ Minimal · up to
d5c56-
This change stops provider-status pushes from re-rendering every timeline row. Provider data is now read at the components that use it. No concrete merge-blocking risk was identified.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description clearly explains the problem, root causes, implementation, remaining renders, and checks performed. However, it omits the required Scope and approval section, does not provide issue or… Add the required Scope and approval section with the triaged issue or explicit maintainer approval, or explain why this focused fix qualifies for an exemption. Add a Verification section with the observed post-change render result and state… Passed checks: 3 passed-
Check name Status Explanation Title check The title clearly and concisely describes the primary performance change: provider-status pushes no longer re-render timeline rows. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
Full details: Description check
-
Explanation
The description clearly explains the problem, root causes, implementation, remaining renders, and checks performed. However, it omits the required Scope and approval section, does not provide issue or maintainer-approval information, and does not report the post-change render measurement. It also uses ## Fix and Checks run instead of the template headings.
Resolution
Add the required Scope and approval section with the triaged issue or explicit maintainer approval, or explain why this focused fix qualifies for an exemption. Add a Verification section with the observed post-change render result and state any checks that remain incomplete. Use the template headings, and include UI evidence if the changed behavior requires it.
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
Re-measured in the app (seeded data, same scenario, median of 3):
Measured against main at 489d08a054, with this PR's commit cherry-picked onto that same commit (it applies cleanly). The server ran without
--watch, and no window had a reconnect.Scenario: the large thread (Evaluate Markdown Renderer Replacement, 713 messages) sits idle. A second browser session clicks Settings > Providers > Refresh provider status, and I measure a 15 s window. Each refresh delivers 3 to 4
providerStatusespushes, and both sides got the same number.scenario main this PR large thread idle across a provider refresh: commits / renders 4 / 1626 4 / 1254 ↳ timeline renders 580 41 ↳ AssistantTimelineRow/TurnFoldTimelineRow28 / 24 0 / 0 ↳ TooltipTrigger230 134 The timeline fan-out from
props:providerStatuses→TimelineRowCtxis gone. On main every push re-rendered every visible assistant row, its meta, its fork button and every turn fold. With this PR, the only timeline renders left areChatMarkdown state#8(one per message) andMessagesTimelineitself.What still renders:
- In one of the three PR windows, 20
SkillInlineText props:skillsrenders and a handful of rowcontextrenders showed up. That's the first refresh after a server restart, when skills actually change. #20855 handles skill identity separately. - Outside the timeline (~1050 per window, same on both sides): sidebar rows (~570), the thread details panel (~220) and the composer (~115) all re-render on each provider push. Those read the provider list or the presentation for other reasons, so they're out of scope here.
Behaviour check: in the "Take Over PR 6315" thread, subagent rows in the timeline still show the provider avatar ("Build layer 1: issue tracker core · Finished"). Hovering it still opens the subagent tooltip with the model and status ("Claude Fable 5.1 · medium · completed 24m 34s"). The lineage panel still lists all six previous agents with their icons.
- In one of the three PR windows, 20
juliusmarminge merged thisecb938d
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes