Skip to content

perf(desktop): avoid file-tree rescans on text-only stream updates - #571

Merged
huichen merged 2 commits into
mainfrom
claude/stream-filetree-refresh
Sep 12, 2026
Merged

huichen merged 2 commits into
mainfrom
claude/stream-filetree-refresh

Conversation

@huichen

@huichen huichen commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #570: stop using historical tool activity as evidence that every text/thinking tick changed the filesystem.

  • Invalidate the file tree only for newly ingested tool start/end/result or run termination/error events (termination covers interrupted writes).
  • Do not rescan directories for text, reasoning, tool argument deltas or empty reads.
  • Reuse the existing projection snapshot for empty/overlapping reads.
  • Retain the panel's 2s coalescing and manual refresh behavior.

Confirmed impact

A test using the real FileTreePanel, useFileTree, event bus and run projector, with mocked IPC and virtual time, reproduced 60 unnecessary listDirectory calls during 120 seconds of text/reasoning at 10 updates/sec after a completed tool. After the fix the same phase makes 0 calls; initial/tool-completion refreshes remain intact.

This is a deterministic request-count improvement, not a claimed CPU/FPS or disk-throughput percentage. Impact and reproduction are recorded in desktop/DEV_MD/STREAMING_RENDERING_FIXES.md.

Validation

  • The integration test fails on the baseline (60 unexpected calls), then passes with the fix.
  • Tool end/result, cancellation/error and empty-read snapshot identity covered by additional tests.
  • Desktop typecheck and ESLint passed.
  • Full desktop Vitest: 106 files / 915 tests passed.
  • No Rust, storage schema or RPC contract changes.

@huichen
huichen enabled auto-merge (squash) September 12, 2026 07:17
@huichen
huichen merged commit 3a66814 into main Sep 12, 2026
12 checks passed
@huichen
huichen deleted the claude/stream-filetree-refresh branch September 12, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant