perf: bound dashboard scans under large ~/.grok installs - #22
Open
jfodchuk wants to merge 1 commit into
Open
Conversation
7 tasks
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
force-pushed
the
perf/bound-dashboard-scans
branch
from
July 29, 2026 21:46
5dcf819 to
a24c21c
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Under multi-session load with a large
~/.groktree (installerbin/downloadsbulk + active session JSONL writes), the dashboard event loop could stall: staticGET /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 sizinggrokHome; raise dashboard cache from 2s → 5sserver/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 afterupdates.jsonlappend (no longer chokidar-driven); timeout 10sMeasured impact (local, multi-session)
GET /under load/api/dashboardNote: some perceived UI lag was also display/TV input lag; the I/O-bound server scans remain a real issue with large
~/.grokhomes.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)npm run verifyon Linux (full suite; some Windows-only failures exist pre-existing around file modes /spawnand are unrelated)~/.grok, confirm dashboard stays responsive and live agents still update within ~4sTradeoff
Live feed updates from
updates.jsonl/events.jsonlnow arrive on the liveness poll (~4s) rather than immediate chokidar events. Summary/signals/active_sessions still trigger faster refresh via the watcher.