@devries-cameron20 / t3code-1 / commits / ecb938da58
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(web): provider status pushes no longer re-render every timeline row (#20854)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 17, 2026 at 03:37 UTC ecb938da581938e2a4470e2e52092477e9bcfa2f
4 files changed +80 -48
apps/web/src/components/ChatView.tsx
-5
@@ -5565,10 +5565,6 @@ export default function ChatView(props: ChatViewProps) {
5565 const timelineSkills = activeProviderStatus
5566 ? resolveProviderSkillsForCwd(activeProviderStatus, gitCwd)
5567 : EMPTY_PROVIDER_SKILLS;
5568 - const timelineProviders =
5569 - environmentById.get(
5570 - displayedThreadRef?.environmentId ?? activeThread?.environmentId ?? environmentId,
5571 - )?.serverConfig?.providers ?? EMPTY_PROVIDERS;
5568 const threadFindControlsRef = useRef<ThreadFindControls | null>(null);
5569 const [isThreadFindActive, setIsThreadFindActive] = useState(false);
5570 const openThreadFind = () => threadFindControlsRef.current?.open();
@@ -8139,7 +8135,6 @@ export default function ChatView(props: ChatViewProps) {
8135 }
8136 listRef={legendListRef}
8137 timelineEntries={displayedTimeline.entries}
8142 - providerStatuses={timelineProviders}
8138 runs={paintOnlyDisplayedTimeline ? [] : (serverProjection?.runs ?? [])}
8139 latestRun={paintOnlyDisplayedTimeline ? null : activeActivityRun}
8140 runningRunId={paintOnlyDisplayedTimeline ? null : activeRunningTurnId}
apps/web/src/components/chat/MessagesTimeline.test.tsx
+15 -7
@@ -404,7 +404,6 @@ function buildProps() {
404 listRef: createRef<LegendListRef | null>(),
405 latestRun: null,
406 turnDiffSummaries: [],
407 - providerStatuses: [],
407 runs: [],
408 routeThreadKey: "environment-local:thread-1",
409 onOpenTurnDiff: () => {},
@@ -1975,10 +1974,21 @@ describe("MessagesTimeline", () => {
1974 } as never,
1975 });
1976
1978 - const markup = renderToStaticMarkup(
1977 + const { RegistryProvider } = await import("@effect/atom-react");
1978 + const { serverEnvironment } = await import("../../state/server");
1979 + const renderWithProviders = (element: ReactElement) =>
1980 + renderToStaticMarkup(
1981 + <RegistryProvider
1982 + initialValues={[
1983 + [serverEnvironment.providersValueAtom(ACTIVE_THREAD_ENVIRONMENT_ID), providerStatuses],
1984 + ]}
1985 + >
1986 + {element}
1987 + </RegistryProvider>,
1988 + );
1989 + const markup = renderWithProviders(
1990 <MessagesTimeline
1991 {...buildProps()}
1981 - providerStatuses={providerStatuses}
1992 timelineEntries={[
1993 buildHandoffEntry({
1994 fromProviderInstanceIds: ["codex_personal"],
@@ -2010,10 +2020,9 @@ describe("MessagesTimeline", () => {
2020 modelSelection: { instanceId: "claudeAgent", model: "claude-fable-5" },
2021 },
2022 ] as never;
2013 - const legacyMarkup = renderToStaticMarkup(
2023 + const legacyMarkup = renderWithProviders(
2024 <MessagesTimeline
2025 {...buildProps()}
2016 - providerStatuses={providerStatuses}
2026 runs={legacyRuns}
2027 timelineEntries={[
2028 buildHandoffEntry({
@@ -2028,10 +2037,9 @@ describe("MessagesTimeline", () => {
2037 expect(legacyMarkup).toContain("Claude Fable 5");
2038 expect(legacyMarkup).not.toContain("Full conversation context");
2039
2031 - const bareMarkup = renderToStaticMarkup(
2040 + const bareMarkup = renderWithProviders(
2041 <MessagesTimeline
2042 {...buildProps()}
2034 - providerStatuses={providerStatuses}
2043 timelineEntries={[
2044 buildHandoffEntry({
2045 fromProviderInstanceIds: ["codex_personal"],
apps/web/src/components/chat/MessagesTimeline.tsx
+4 -13
@@ -28,7 +28,6 @@ import {
28 type OrchestrationV2TurnItem,
29 type RunAttemptId,
30 type ScopedThreadRef,
31 - type ServerProvider,
31 type ServerProviderSkill,
32 type RunId,
33 ThreadId,
@@ -286,7 +285,7 @@ import { useV2ItemSupport } from "../../state/v2ItemSupport";
285 import { Collapsible, CollapsibleTrigger, CollapsiblePanel } from "../ui/collapsible";
286 import {
287 isV2LifecycleItem,
289 - SubagentAvatar,
288 + EnvironmentSubagentAvatar,
289 SubagentElapsed,
290 SubagentNotificationLink,
291 V2LifecycleRow,
@@ -315,7 +314,6 @@ interface TimelineRowSharedState {
314 resolvedTheme: "light" | "dark";
315 workspaceRoot: string | undefined;
316 skills: ReadonlyArray<Pick<ServerProviderSkill, "name" | "displayName">>;
318 - providerStatuses: ReadonlyArray<ServerProvider>;
317 runs: ReadonlyArray<HandoffTimelineRun>;
318 activeThreadEnvironmentId: EnvironmentId;
319 onRevertToTurnCount: (targetTurnCount: number, messageId: MessageId) => void;
@@ -493,7 +491,6 @@ interface MessagesTimelineProps {
491 timestampFormat: TimestampFormat;
492 workspaceRoot: string | undefined;
493 skills?: ReadonlyArray<Pick<ServerProviderSkill, "name" | "displayName">>;
496 - providerStatuses: ReadonlyArray<ServerProvider>;
494 runs: ReadonlyArray<HandoffTimelineRun>;
495 anchorMessageId: MessageId | null;
496 onAnchorReady: (messageId: MessageId, anchorIndex: number) => void;
@@ -589,7 +586,6 @@ const ConversationTimeline = memo(function ConversationTimeline({
586 timestampFormat,
587 workspaceRoot,
588 skills = EMPTY_TIMELINE_SKILLS,
592 - providerStatuses,
589 runs: runsProp,
590 anchorMessageId,
591 onAnchorReady,
@@ -1219,7 +1215,6 @@ const ConversationTimeline = memo(function ConversationTimeline({
1215 resolvedTheme,
1216 workspaceRoot,
1217 skills,
1222 - providerStatuses,
1218 runs,
1219 activeThreadEnvironmentId,
1220 onRevertToTurnCount,
@@ -2936,7 +2931,6 @@ function V2EventTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "event"
2931 resourceSummary={row.resourceSummary}
2932 createdAt={row.createdAt}
2933 timestampFormat={ctx.timestampFormat}
2939 - providerStatuses={ctx.providerStatuses}
2934 runs={ctx.runs}
2935 onOpenThread={ctx.onOpenThread}
2936 />
@@ -3185,12 +3179,11 @@ const V2SubagentGroup = memo(function V2SubagentGroup({
3179 >
3180 <span className="flex shrink-0 items-center -space-x-1.5" aria-hidden>
3181 {agents.slice(0, 3).map(({ item, status }) => (
3188 - <SubagentAvatar
3182 + <EnvironmentSubagentAvatar
3183 key={item.id}
3184 + environmentId={ctx.activeThreadEnvironmentId}
3185 + providerInstanceId={item.providerInstanceId}
3186 driver={item.driver}
3191 - provider={ctx.providerStatuses.find(
3192 - (provider) => provider.instanceId === item.providerInstanceId,
3193 - )}
3187 status={agents.length === 1 ? status : undefined}
3188 />
3189 ))}
@@ -3233,7 +3226,6 @@ const V2SubagentGroup = memo(function V2SubagentGroup({
3226 item={item}
3227 createdAt={row.createdAt}
3228 timestampFormat={ctx.timestampFormat}
3236 - providerStatuses={ctx.providerStatuses}
3229 runs={ctx.runs}
3230 onOpenThread={ctx.onOpenThread}
3231 />
@@ -5195,7 +5187,6 @@ const SimpleWorkEntryRow = memo(function SimpleWorkEntryRow(props: WorkEntryRowP
5187 outcome={item.outcome}
5188 createdAt={props.workEntry.createdAt}
5189 timestampFormat={ctx.timestampFormat}
5198 - providerStatuses={ctx.providerStatuses}
5190 onOpenThread={ctx.onOpenThread}
5191 fallback={<WorkEntryLogRow {...props} />}
5192 />
apps/web/src/components/chat/V2LifecycleRow.tsx
+61 -23
@@ -7,6 +7,7 @@ import { SubagentTooltipContent } from "./SubagentTooltipContent";
7 import { useAtomValue } from "@effect/atom-react";
8 import { scopeThreadRef, scopeProjectRef } from "@t3tools/client-runtime/environment";
9 import { environmentThreadDetails } from "../../state/threads";
10 +import { EMPTY_SERVER_PROVIDERS, serverEnvironment } from "../../state/server";
11 import { MiddleTruncate } from "../ui/middle-truncate";
12 import * as DateTime from "effect/DateTime";
13 import { WorkLogRow } from "./WorkLog";
@@ -72,7 +73,6 @@ export function V2LifecycleRow(props: {
73 readonly resourceSummary?: boolean | undefined;
74 readonly createdAt: string;
75 readonly timestampFormat: TimestampFormat;
75 - readonly providerStatuses: ReadonlyArray<ServerProvider>;
76 readonly runs: ReadonlyArray<HandoffTimelineRun>;
77 readonly onOpenThread: (threadId: ThreadId) => void;
78 }) {
@@ -125,9 +125,9 @@ export function V2LifecycleRow(props: {
125 }
126 if (item.type === "handoff") {
127 return (
128 - <HandoffRow
128 + <EnvironmentHandoffRow
129 + environmentId={props.environmentId}
130 endpoints={resolveHandoffEndpoints(item, props.runs)}
130 - providers={props.providerStatuses}
131 failed={item.status === "failed"}
132 />
133 );
@@ -192,10 +192,6 @@ export function V2LifecycleRow(props: {
192 origin={item.origin}
193 status={item.status}
194 driver={item.driver}
195 - provider={props.providerStatuses.find(
196 - (provider) => provider.instanceId === item.providerInstanceId,
197 - )}
198 - providers={props.providerStatuses}
195 title={formatSubagentDisplayTitle(item.title ?? "Subagent")}
196 result={item.result}
197 progress={item.progress}
@@ -253,14 +249,16 @@ export function SubagentElapsed({ agent }: { agent: Parameters<typeof AgentElaps
249 return <AgentElapsed agent={agent} />;
250 }
251
256 -export function SubagentAvatar({
252 +function SubagentAvatar({
253 driver,
258 - provider,
254 + displayName,
255 + iconUrl,
256 status,
257 className,
258 }: {
259 driver?: ProviderDriverKind | undefined;
263 - provider?: ServerProvider | undefined;
260 + displayName?: string | undefined;
261 + iconUrl?: string | undefined;
262 status?: OrchestrationV2TurnItem["status"] | undefined;
263 className?: string;
264 }) {
@@ -275,8 +273,8 @@ export function SubagentAvatar({
273 {driver ? (
274 <ProviderInstanceIcon
275 driverKind={driver}
278 - displayName={provider?.displayName ?? driver}
279 - acpRegistryIconUrl={provider?.iconUrl}
276 + displayName={displayName ?? driver}
277 + acpRegistryIconUrl={iconUrl}
278 className="z-auto"
279 iconClassName="size-3.5"
280 />
@@ -295,6 +293,35 @@ export function SubagentAvatar({
293 );
294 }
295
296 +/**
297 + * Reads only the two provider fields the avatar draws. Provider status pushes
298 + * replace the provider objects (fresh `checkedAt`), so selecting strings keeps
299 + * the avatar from re-rendering when nothing it shows changed.
300 + */
301 +export function EnvironmentSubagentAvatar({
302 + environmentId,
303 + providerInstanceId,
304 + ...props
305 +}: {
306 + environmentId: EnvironmentId;
307 + providerInstanceId: ProviderInstanceId;
308 + driver?: ProviderDriverKind | undefined;
309 + status?: OrchestrationV2TurnItem["status"] | undefined;
310 +}) {
311 + const providersAtom = serverEnvironment.providersValueAtom(environmentId);
312 + const displayName = useAtomValue(
313 + providersAtom,
314 + (providers) =>
315 + providers?.find((provider) => provider.instanceId === providerInstanceId)?.displayName,
316 + );
317 + const iconUrl = useAtomValue(
318 + providersAtom,
319 + (providers) =>
320 + providers?.find((provider) => provider.instanceId === providerInstanceId)?.iconUrl,
321 + );
322 + return <SubagentAvatar {...props} displayName={displayName} iconUrl={iconUrl} />;
323 +}
324 +
325 const NOTIFICATION_OUTCOME_STATUS: Record<
326 OrchestrationV2Notification["outcome"],
327 OrchestrationV2TurnItem["status"] | null
@@ -320,7 +347,6 @@ export function SubagentNotificationLink(props: {
347 readonly outcome: OrchestrationV2Notification["outcome"];
348 readonly createdAt: string;
349 readonly timestampFormat: TimestampFormat;
323 - readonly providerStatuses: ReadonlyArray<ServerProvider>;
350 readonly onOpenThread: (threadId: ThreadId) => void;
351 readonly fallback: ReactNode;
352 }) {
@@ -339,10 +365,6 @@ export function SubagentNotificationLink(props: {
365 origin={agent.origin}
366 status={agent.status}
367 driver={agent.driver}
342 - provider={props.providerStatuses.find(
343 - (provider) => provider.instanceId === agent.providerInstanceId,
344 - )}
345 - providers={props.providerStatuses}
368 title={formatSubagentDisplayTitle(agent.title ?? "Subagent")}
369 result={agent.result}
370 progress={agent.progress}
@@ -365,8 +387,6 @@ function SubagentTimelineLink(props: {
387 readonly providerInstanceId: ProviderInstanceId;
388 readonly origin: OrchestrationV2Subagent["origin"];
389 readonly driver: ProviderDriverKind;
368 - readonly provider: ServerProvider | undefined;
369 - readonly providers: ReadonlyArray<ServerProvider>;
390 readonly title: string;
391 readonly result: string | null;
392 readonly progress: string | undefined;
@@ -403,9 +423,10 @@ function SubagentTimelineLink(props: {
423 };
424 const content = (
425 <>
406 - <SubagentAvatar
426 + <EnvironmentSubagentAvatar
427 + environmentId={props.parentRef.environmentId}
428 + providerInstanceId={props.providerInstanceId}
429 driver={props.driver}
408 - provider={props.provider}
430 status={status ?? undefined}
431 />
432 <span className="min-w-0 flex-1">
@@ -501,6 +522,10 @@ function SubagentTimelineTooltip(
522 },
523 ) {
524 const environmentId = props.parentRef.environmentId;
525 + // The popup only mounts while open, so the full provider list is read here
526 + // instead of in every timeline row.
527 + const providers =
528 + useAtomValue(serverEnvironment.providersValueAtom(environmentId)) ?? EMPTY_SERVER_PROVIDERS;
529 const parent = useThreadShell(props.parentRef)?.source;
530 const child = useThreadShell(
531 props.threadId ? scopeThreadRef(environmentId, props.threadId) : null,
@@ -516,8 +541,8 @@ function SubagentTimelineTooltip(
541 providerInstanceId={props.providerInstanceId}
542 origin={props.origin}
543 modelSelection={props.modelSelection}
519 - provider={props.provider}
520 - providers={props.providers}
544 + provider={providers.find((provider) => provider.instanceId === props.providerInstanceId)}
545 + providers={providers}
546 driver={props.driver}
547 elapsed={props.elapsed}
548 status={props.status}
@@ -531,6 +556,19 @@ function SubagentTimelineTooltip(
556 );
557 }
558
559 +function EnvironmentHandoffRow({
560 + environmentId,
561 + ...props
562 +}: {
563 + readonly environmentId: EnvironmentId;
564 + readonly endpoints: HandoffEndpoints;
565 + readonly failed: boolean;
566 +}) {
567 + const providers =
568 + useAtomValue(serverEnvironment.providersValueAtom(environmentId)) ?? EMPTY_SERVER_PROVIDERS;
569 + return <HandoffRow {...props} providers={providers} />;
570 +}
571 +
572 export function HandoffRow(props: {
573 readonly endpoints: HandoffEndpoints;
574 readonly providers: ReadonlyArray<ServerProvider>;