Skip to content

perf: bound dashboard scans under large ~/.grok installs - #22

Open
jfodchuk wants to merge 1 commit into
joeynyc:mainfrom
jfodchuk:perf/bound-dashboard-scans
Open

perf: bound dashboard scans under large ~/.grok installs#22
jfodchuk wants to merge 1 commit into
joeynyc:mainfrom
jfodchuk:perf/bound-dashboard-scans

Conversation

@jfodchuk

@jfodchuk jfodchuk commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Under multi-session load with a large ~/.grok tree (installer bin/downloads bulk + active session JSONL writes), the dashboard event loop could stall: static GET / took multi-second responses in one Windows repro.

This keeps live reads bounded (matches the project design principle) without changing the ACP/browser contract.

Changes

  • server/grok-store.ts: skip installer/cache top-level dirs (bin, downloads, vendor, marketplace-cache, bundled, node_modules, .git) when sizing grokHome; raise dashboard cache from 2s → 5s
  • server/live-monitor.ts: ignore high-churn paths (updates.jsonl, events.jsonl, recap_requests, memtrace); liveness poll 2s → 4s; refresh debounce 80ms → 250ms. Live feed still tails updates/events on the timer.
  • server/grok-store.test.ts: wait for liveness emission after updates.jsonl append (no longer chokidar-driven); timeout 10s

Measured impact (local, multi-session)

Metric Before After
GET / under load 0.5–3.6s ~60–90ms
/api/dashboard 0.6–1.8s ~100ms

Note: some perceived UI lag was also display/TV input lag; the I/O-bound server scans remain a real issue with large ~/.grok homes.

Test plan

  • npx vitest run server/grok-store.test.ts (includes live feed append case)
  • npm run check / npm run build (TypeScript + client/server build)
  • CI npm run verify on Linux (full suite; some Windows-only failures exist pre-existing around file modes / spawn and are unrelated)
  • Manual: start UI with several live Grok sessions and a large ~/.grok, confirm dashboard stays responsive and live agents still update within ~4s

Tradeoff

Live feed updates from updates.jsonl/events.jsonl now arrive on the liveness poll (~4s) rather than immediate chokidar events. Summary/signals/active_sessions still trigger faster refresh via the watcher.

Dashboard rebuilds were walking installer/cache bulk (bin, downloads, etc.)
and chokidar-watching high-churn session logs, which saturated the Node
event loop under multi-session load.

Skip non-session top-level dirs when sizing grokHome, lengthen the
dashboard cache and live refresh cadence, and stop watching
updates/events JSONL (still tailed on the liveness timer).
@jfodchuk
jfodchuk force-pushed the perf/bound-dashboard-scans branch from 5dcf819 to a24c21c Compare July 29, 2026 21:46
@jfodchuk

Copy link
Copy Markdown
Author

Rebased onto current \main\ (post v0.10 / v0.11 Build Studio). No content conflicts; still applies cleanly to \server/grok-store.ts\ and \server/live-monitor.ts.

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