Skip to content

perf: large threads open from a viewport snapshot, and typing and streaming render less - #18220

Open
maria-rcks wants to merge 240 commits into
t3/perf-wave2from
t3/perf-wave3
Open

maria-rcks wants to merge 240 commits into
t3/perf-wave2from
t3/perf-wave3

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

stacked on #18219. this diff shows only this layer.

recorded largest-thread opening: wave 2 above and wave 3 below

threads open from a viewport snapshot and fetch older history as needed. streamed text updates its own row, typing stays local to the editor, and unchanged timeline entries are reused. server activity updates patch sqlite fields and subscribers share encoded events; independent config discovery runs concurrently.

historical medians of five interleaved linux/chromium runs, 0db57d8 → 1634ef4, before trimming:

metric before after
largest thread cold open, paint 927 ms 371 ms
streamed reply, main-thread work per batch 20.7 ms 6.08 ms
empty composer, script per key 6.28 ms 3.11 ms

the later trim-only recheck measured largest-thread paint at 349.5 → 322 ms, with overlapping ranges. the historical table is not a fresh measurement of the integrated head.

model: claude-opus-5-5 coordinating gpt-6.1-sol subagents, harness: claude code in t3 code.

# Conflicts:
#	apps/server/src/vcs/VcsStatusBroadcaster.test.ts
#	apps/web/src/components/CommandPalette.logic.ts
#	apps/web/src/components/CommandPalette.tsx
#	apps/web/src/components/CommandPaletteHost.tsx
#	apps/web/src/components/ThreadRouteView.tsx
#	apps/web/src/components/settings/SettingsFontPreviews.tsx
FROM orchestration_v2_projection_turn_items AS item
JOIN orchestration_v2_projection_runs AS run ON run.run_id = item.run_id
WHERE item.thread_id = ${threadId}
AND item.type = 'user_message'

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.

🟡 Medium orchestration-v2/ProjectionStore.ts:3420

A viewport with one old user turn followed by many notification-driven wake runs includes every historical checkpoint, producing an unbounded checkpoint list. turn_starts filters to user_message rows, so those notification-started runs do not fill the raw-turn budget and the computed cutoff remains 0; include notification-started runs in this budget, as the timeline's run_starts does.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/server/src/orchestration-v2/ProjectionStore.ts around line 3420:

A viewport with one old user turn followed by many notification-driven wake runs includes every historical checkpoint, producing an unbounded checkpoint list. `turn_starts` filters to `user_message` rows, so those notification-started runs do not fill the raw-turn budget and the computed cutoff remains `0`; include notification-started runs in this budget, as the timeline's `run_starts` does.

# Conflicts:
#	apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts
#	apps/web/src/components/ChatView.tsx
#	apps/web/src/components/chat/ChatComposer.tsx
# Conflicts:
#	apps/desktop/src/app/DesktopObservability.test.ts
#	apps/desktop/src/app/DesktopObservability.ts
#	apps/mobile/src/connection/environment-cache-store.test.ts
#	apps/server/src/orchestration-v2/ProjectionStore.ts
#	apps/server/src/orchestration-v2/ProviderTurnStartService.ts
#	apps/server/src/ws.ts
#	apps/web/src/components/DiffWorkerPoolProvider.tsx
#	apps/web/src/components/Sidebar.tsx
#	apps/web/src/components/chat/ChatComposer.tsx
#	apps/web/src/components/files/FileBrowserPanel.tsx
#	apps/web/src/components/settings/KeybindingsSettings.tsx
#	apps/web/src/components/settings/SettingsFontPreviews.tsx
#	apps/web/src/connection/storage.ts
#	packages/client-runtime/src/state/threadHistoryMerge.ts

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants