Problem
WorkspaceSearchIndex.make treats finder.waitForIndexReady() as meaning the index is fully live. It is not: the background filesystem watcher is still starting at that point. Measured on this repo:
waitForIndexReady returned at 52ms; isWatcherReady=false
isWatcherReady became true at 1094ms => ~1.0s blind window
ScanProgress exposes isWatcherReady separately from isScanning and isWarmupComplete, and waitForIndexReady only polls the latter two.
Impact
Any external filesystem change in that ~1s window after an index is created is missed permanently — the watcher was not listening, and nothing triggers a rescan afterwards. The entry list silently under-reports until something forces scanFiles().
This is most likely to bite exactly when it is most visible: right after a workspace is first opened, which is when a user is most likely to be creating files.
Found while scoping #2 — the first probe run hit this and produced a false negative (an externally created file never appearing) before the cause was identified.
Sketch
In WorkspaceSearchIndex.make (apps/server/src/workspace/WorkspaceSearchIndex.ts), extend the readiness wait to also require getScanProgress().isWatcherReady, within the existing 15s budget and reusing the existing WorkspaceSearchIndexScanTimedOut failure. Decide deliberately whether a watcher that never becomes ready should fail index creation or degrade to serving a non-live index — degrading is probably right, since search still works, but it should be a choice rather than an accident.
Acceptance criteria
- A file created externally immediately after the index is constructed appears in
listEntries without an explicit refresh.
- Index creation still completes within the existing 15s timeout on a large repo.
Conventions
Read docs/internals/code-conventions.md and .macroscope/check-run-agents/effect-service-conventions.md first.
Problem
WorkspaceSearchIndex.maketreatsfinder.waitForIndexReady()as meaning the index is fully live. It is not: the background filesystem watcher is still starting at that point. Measured on this repo:ScanProgressexposesisWatcherReadyseparately fromisScanningandisWarmupComplete, andwaitForIndexReadyonly polls the latter two.Impact
Any external filesystem change in that ~1s window after an index is created is missed permanently — the watcher was not listening, and nothing triggers a rescan afterwards. The entry list silently under-reports until something forces
scanFiles().This is most likely to bite exactly when it is most visible: right after a workspace is first opened, which is when a user is most likely to be creating files.
Found while scoping #2 — the first probe run hit this and produced a false negative (an externally created file never appearing) before the cause was identified.
Sketch
In
WorkspaceSearchIndex.make(apps/server/src/workspace/WorkspaceSearchIndex.ts), extend the readiness wait to also requiregetScanProgress().isWatcherReady, within the existing 15s budget and reusing the existingWorkspaceSearchIndexScanTimedOutfailure. Decide deliberately whether a watcher that never becomes ready should fail index creation or degrade to serving a non-live index — degrading is probably right, since search still works, but it should be a choice rather than an accident.Acceptance criteria
listEntrieswithout an explicit refresh.Conventions
Read
docs/internals/code-conventions.mdand.macroscope/check-run-agents/effect-service-conventions.mdfirst.