Repository navigation
fix(client-runtime): opening a thread no longer freezes with thousands of threads - #25853
juliusmarminge wants to merge 5 commits into
Conversation
… quiet list per changed thread Co-Authored-By: Claude Opus 5.5 <[email protected]>
…date The quiet thread shell list read one quiet atom per thread, and each of those read the whole thread index. Every shell frame re-ran all of them and rebuilt the list once per changed thread, which froze the renderer for about a minute when a thread opened with ~13k threads. The list now builds from each enabled environment's threads and pending subagent requests, the same way the other shell lists do. It holds shells through streaming ticks itself, keyed by thread and pruned on every rebuild. Fixes #25823 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The thread list now maintains its own cached shells rather than subscribing to each thread individually, reducing update fan-out for large histories. Existing filtering and streaming-update suppression remain intact, with effects confined to client presentation state. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
t3dotgg
left a comment
There was a problem hiding this comment.
Note
🤖 GPT-6.1 Sol responding on behalf of Theo
Approved at da9db8b08b16130745600e1aa682bcdb24850884.
I applied the new regression test to current main bbd9593973. It failed because the list delivered partial updates. With the implementation applied, all 12 tests passed, and vp run check:changed passed, including typechecks for seven packages. The source and test paths are unchanged on main 8d94203c17.
This removes per-thread atom fan-out. Cross-environment delegated approvals can still notify the task before its parent's request flag, as on main; this approval does not claim atomic delivery for those updates.
…s of threads (upstream pingdotgg#25853) Cherry-picked from pingdotgg#25853 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Additional validation on official macOS arm64 v0.1.5, following my v0.1.3 synthetic reproduction and live debugger confirmation. The freeze recurred after upgrading from locally patched 0.1.3 to unmodified 0.1.5. Both the shipped Packaged-logic measurementsThe factory and relevant helpers were extracted from the shipped asset and run with the earlier synthetic harness and its existing source model/schema/reactivity dependencies (v0.1.3 checkout, Node 26.0.0, Effect 4.0.5). This checks the packaged algorithm; it is not a full v0.1.5 source-suite or browser benchmark. Timing covers one synchronous
Additional checks passed for unchanged list identity, streaming-only count changes retaining quiet shells, a single complete list after bulk title changes, thread removal, and environment disable/re-enable. As noted in the existing approval, this does not establish atomic delivery across cross-environment delegated-approval updates. Installed-app observationVerified that exactly one of 2,681 ASAR payload files changed, updated archive integrity metadata, and installed the locally signed copy with the original app preserved. The long conversation loaded, the desktop served the patched asset, and the existing remote server stayed running. Local record counts and settings hash were unchanged. Renderer CPU was 0.9% in an early idle observation and 8.0% around two minutes after launch; these are bounded observations, not a sustained frame-rate measurement. I did not capture a new live JS profile of the unmodified 0.1.5 recurrence. One practical cost of the local workaround: ad-hoc signing changes the designated requirement, so the macOS automatic updater rejects the next official build. The official update package itself passed signature/notarization checks. An official release containing this fix would avoid that manual-upgrade tradeoff. This supports the existing PR rather than a competing fix. Is there any remaining validation needed for merging it? I can check a proposed revision against this large-thread workload. Validation performed with Codex assistance; no private conversation data is included. |
# Conflicts: # packages/client-runtime/src/state/threadShell.ts
|
The automated pipeline stopped on this pull request and will not merge it: someone else pushed to fix/issue-25823 (head is now da9db8b); the pipeline does not build on commits it did not review It stays open for a person to finish or close. |
Dismissing prior approval to re-evaluate 3a4a1c8
|
Thanks for this. #35848 makes the same change and is the one being kept. #35848 carries this same fix and regression test forward with newer main incorporated. It explicitly supersedes this submission, so it is the version to continue reviewing. Your implementation and original commits are preserved there, including the streaming-update suppression and hidden-thread filtering. Closing as a duplicate. |
Problem
With ~13k threads, opening a large orchestration thread froze the desktop renderer for about a minute.
environment-quiet-thread-shell-listread one per-thread quiet shell atom per thread. That kept every per-thread shell atom observed. Each shell frame from the server then re-ran all of them and rebuilt the whole list once per changed thread, part-way through propagation. Subscribers also received the half-applied lists in between. A driver over the real atoms with 13,037 threads and 5 changed threads per frame measured 83 ms and 5 list rebuilds per frame on main.Change
quietThreadShellsAtomnow builds directly from each enabled environment's thread array and pending subagent requests, the same waythreadShellsAtomandnavigationThreadShellsAtomalready do. It applies the same streaming-tick hold per thread from list-local previous shells, which are rebuilt each pass so removed threads are dropped. The list no longer subscribes to per-thread atoms, so a shell frame rebuilds it once, with the final values. Order, membership (subagent and archived threads included) and reference stability when nothing changed are unchanged. Point reads throughquietThreadShellAtomare untouched.Scope and approval
Fixes #25823
Verification
vp test run packages/client-runtime/src/state/threadShell.test.ts: 10/10 pass. The new test "delivers one quiet shell list per snapshot update that changes several threads" fails on main because one update delivers three lists, two of them half-applied (a renamed, b, c, d, thena renamed, b renamed, c, d). It passes on this branch.vp run check:changed: format, lint, knip, typecheck (7 packages) and tests pass.Runtime transcript from a scratch driver over the real
createEnvironmentThreadShellAtomswith synthetic threads. It mounts the quiet list as the sidebar does and times onlyregistry.setper shell frame (Node 26, this VM):The list still walks every thread once per frame. That per-frame cost is now in line with the other shell lists, which already did the same.
Driver (scratch, not committed): issue-25823-quiet-list-driver.ts. Transcript: issue-25823-driver-transcript.txt
No visual change, so there are no captures. Not checked: the reporter's real 13k-thread desktop profile, and mobile (it shares this client-runtime code but reads only point atoms).
Claude Opus 5.5 (lead, red test, implementation, reviewer B) and GPT-6.1-Sol (reviewer A), in T3 Code via the Claude Code and Codex harnesses.
🤖 Generated with Claude Code