worker: Add indexing dashboard in development#4189
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc9fd377b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
wow! 🤩 |
|
you can actually have multiple workers in development using env vars (i think it’s ALL_PRIORITY_WORKER_COUNT and HIGH_PRIORITY_WORKER_COUNT), can this handle showing multiple workers indexing simultaneously? |
There was a problem hiding this comment.
Pull request overview
Adds a development-time “indexing dashboard” by emitting indexing progress events from IndexRunner through the worker/task stack, collecting them in the realm-server worker manager, and rendering a simple HTML dashboard (plus JSON endpoint).
Changes:
- Introduces an
IndexingProgressEventflow fromIndexRunner→ tasks →Worker→ realm-server worker process IPC → worker-manager. - Adds an in-memory
IndexingEventSinkwith tests and exposes/_indexing-dashboard+/_indexing-status(non-ECS). - Updates CI to include the new realm-server test module.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/worker.ts | Adds IndexingProgressEvent type and reportProgress plumbing into task args. |
| packages/runtime-common/tasks/index.ts | Extends TaskArgs with optional reportProgress callback. |
| packages/runtime-common/tasks/indexer.ts | Passes reportProgress through to IndexRunner as onProgress. |
| packages/runtime-common/index-runner.ts | Emits indexing progress events (start, per-file, finish). |
| packages/realm-server/worker.ts | Sends progress events over IPC to worker-manager. |
| packages/realm-server/worker-manager.ts | Adds event sink, dev-only routes, and parses `progress |
| packages/realm-server/indexing-event-sink.ts | New: stores active indexing + limited history snapshots. |
| packages/realm-server/handlers/handle-indexing-dashboard.ts | New: renders HTML dashboard from the sink snapshot. |
| packages/realm-server/tests/indexing-event-sink-test.ts | New: validates event sink behavior for start/visit/finish and concurrency across realms. |
| packages/realm-server/tests/index.ts | Registers the new test module. |
| .github/workflows/ci.yaml | Adds indexing-event-sink-test.ts to the realm-server test matrix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function reportProgress(event: IndexingProgressEvent) { | ||
| if (process.send) { | ||
| process.send(`progress|${JSON.stringify(event)}`); | ||
| } | ||
| } |
| /** Active indexing state per realm */ | ||
| #active = new Map<string, RealmIndexingState>(); | ||
|
|
||
| /** Recently completed indexing runs (most recent first) */ | ||
| #history: RealmIndexingState[] = []; | ||
|
|
||
| /** Max history entries to keep */ | ||
| #maxHistory = 50; | ||
|
|
||
| handleEvent(event: IndexingProgressEvent): void { | ||
| switch (event.type) { | ||
| case 'indexing-started': { | ||
| this.#active.set(event.realmURL, { | ||
| realmURL: event.realmURL, | ||
| jobId: event.jobId, | ||
| jobType: event.jobType ?? 'unknown', | ||
| status: 'indexing', | ||
| totalFiles: event.totalFiles ?? 0, | ||
| filesCompleted: 0, | ||
| files: event.files ?? [], | ||
| completedFiles: [], | ||
| startedAt: Date.now(), | ||
| lastUpdatedAt: Date.now(), | ||
| }); | ||
| break; |
When I ran the realm server for this I had |
The reason you only see one active job despite having 8 workers is that realms are started sequentially in packages/realm-server/server.ts:279-284: Seems true? |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
that's true--but that's just at startup. there are other scenarios after startup that could use multiple workers. like you run 2 different realm full reindex jobs, and then maybe do a incremental index because of an auto save. if you had it configured as such, that could be 3 concurrent jobs right there. |
|
could we include an update to the README.md to describe how to access this? |
|
I'm not sure if it's useful, but you might also want to show pending jobs in the queue too (just like you show completed jobs) |


I’m often wondering when developing how much is left to index:
This adds an event sink for index runners to report on their progress and a worker manager dashboard to report that.