Skip to content

fix(web): opening a very large folder no longer freezes the Files panel - #930

Merged
yaacovcorcos merged 3 commits into
mainfrom
claude/files-large-folder-20261114
Nov 14, 2026
Merged

yaacovcorcos merged 3 commits into
mainfrom
claude/files-large-folder-20261114

Conversation

@yaacovcorcos

@yaacovcorcos yaacovcorcos commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #929 (the T3 2bee33e alignment); it retargets to main once #929 merges.

Opening a folder with tens of thousands of entries no longer freezes the Files panel. A 50,000-entry folder now opens in about 170 ms instead of blocking the panel for seconds, and a refresh after most of a large folder was deleted no longer blocks for about 15 s.

Why it froze

Scient's lazy Files tree applied each folder listing to the tree as one batch. The tree (@pierre/trees) re-indexes a folder's later children and rebuilds its visible-count chunks for every row it adds or removes, so a batch costs the folder's size for every row in it:

One folder Batched adds Rebuild
5,000 entries 37 ms 7 ms
20,000 entries 423 ms 18 ms
50,000 entries 2.4 s (over 5 s with names out of order) 39 ms
Removing 49,990 of 50,000 15 s 5 ms

T3 fixed the same freeze in its own tree (#29996). Scient keeps its lazy tree, so the alignment did not carry T3's fix; this ports the idea.

What changes

  • When the batch would cost more than a rebuild (T3's measured break-even of 300 folder operations per path), the tree is rebuilt from the entries Scient already knows, then given one real change as a small batch. The tree clears a drag, remaps rename, focus and selection, and refreshes an open search only on a real change, so this keeps all of that as a batch does.
  • An entry that changed kind (a file now a folder) gets a first rebuild without either form, so a rename or selection on it ends instead of moving to the replacement; its focus stays, as in a batch.
  • Rows the tree shows before the disk has them, such as a new entry being named, are tracked through addProvisional and kept, unless their folder is removed.
  • Removed entries are forgotten in one pass; each used to scan every known entry.
  • Small listings still batch, unchanged.

Known limit: with a search open, a large listing that removes matching rows shows the old matches for one update, which can scroll the results to the top. The tree has no atomic rebuild-and-refresh, and the alternative is a freeze of up to 15 s. Opening a folder only adds rows, and a test shows the results never shrink then.

Found, not changed here: any folder listing that arrives while a new Files entry is being named takes the focus from the name field, which then makes the entry with its first name. It happens with a 5-entry listing too, and on the alignment branch without this change. It needs its own fix.

Verification

  • Unit: 21 controller tests, among them a large listing keeping open folders, selection and new rows (one in a closed folder); a mass deletion; a kind change; 1,000 selected entries changing kind with one batched operation; an open search; and small listings still batching. With the rebuild turned off, every assertion about the tree's state passes the same way through the batch, so the rebuild changes only the cost.
  • Browser (FileBrowserPanel): a 50,000-entry folder, names out of order, opens with the open folder kept; without the change the folder does not appear within the test's wait. An open search stays accurate while the folder's listing arrives. The Files panel, folder actions, panel files column and bidi suites pass (23 tests).
  • Static: web typecheck, lint, fmt.
  • Codex review (GPT-6.1 Sol, high), five rounds, the last with no findings: all earlier findings fixed (rename and selection moving to a kind-changed replacement, search close losing scroll and expansion, hidden new rows, a deleted drag source staying active, new rows reviving a removed folder, thousands of kind changes batched, focus on a kind-changed entry); the search limit above was judged reasonable.

Platforms

  • macOS arm64: all of the above, run locally.
  • Windows and Linux: not run locally; CI covers them. Nothing here is platform-specific.

🤖 Generated with Claude Code

yaacovcorcos and others added 2 commits November 14, 2026 23:44
Scient's lazy Files tree applied each listing to the tree as one batch,
and the tree reworks a folder's children for every row added or removed:
opening a 50,000-entry folder blocked the panel for seconds, and a
refresh after most of it was deleted for about 15 s.

When the batch would cost more than a rebuild (T3's measured break-even,
as in its #29996), the tree is rebuilt from the known entries and then
given one real change as a small batch, so it still clears a drag,
remaps rename, focus and selection, and refreshes an open search as a
batch does. When entries changed kind, a first rebuild without either
form ends a rename or selection on them, so neither moves to the
replacement. Rows the tree shows before the disk has them, such as a new
entry being named, are tracked and kept unless their folder is removed.
Removed entries are forgotten in one pass instead of one scan each.

With a search open, a large listing that removes matching rows can
show the old matches for one update, which may scroll the results to
the top; opening a folder only adds rows and keeps the scroll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Nov 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from codex/t3-sync-2bee33eb19-20261114 to main November 14, 2026 22:03
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.5 KiB 5.5 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 4.2 KiB 4.2 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 22.3 KiB 22.3 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.5 KiB 5.5 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 4.2 KiB 4.2 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 22.7 KiB 22.7 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 12.0 KiB 12.0 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 45.1 KiB 45.1 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 45.1 KiB 45.1 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 12.2 KiB 12.2 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.1 KiB 384.1 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 45.6 KiB 45.6 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 45.6 KiB 45.6 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: ab54752 · PR result: a6f803a · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Bounded compact HTTP snapshot with live cursor.

  • Codex decoded thread snapshot: 88.2 KiB
  • Claude decoded thread snapshot: 88.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@yaacovcorcos
yaacovcorcos added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit e5db1d2 Nov 14, 2026
60 checks passed
@yaacovcorcos
yaacovcorcos deleted the claude/files-large-folder-20261114 branch November 14, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant