You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Two overlapping App Store reads on a store that is being downloaded make the second one return a half-downloaded or empty store #679
registry() in omarchyd/apps.mjs (about lines 962-1005) has no lock and no shared in-flight promise. Every caller that finds the cache empty (or the hourly sync window expired) runs its own syncStore() for every store, and all of them work in the same folder (storeDir(url)).
The callers that overlap in normal use are apps.list (it starts a background registry() as soon as it is first called, line 1357), apps.updates (the Apps screen polls it, web/src/data.ts:29) and appStore.registry (the App Store screen). On the first start, or after the hourly window has passed, two of them run at once:
first call: git clone --depth 1 -- URL DIR is still checking files out
second call: sees DIR/.git already exists, so it runs git fetch, git reset --hard FETCH_HEAD and git clean -fdx inside the half-written clone, then loadStore() reads whatever folders exist at that moment
(If the second call starts before .git exists it runs its own git clone, which fails because the folder is not empty; the error is swallowed by the empty catch {} and loadStore() runs on the half-written tree, or throws and the store is skipped.)
The second caller then returns a list with some of the apps, or without the store at all. The web app keeps appStore.registry for 10 minutes (staleTime: 10 * 60_000), so the App Store shows "0 apps for your server" or a partial catalog until it is re-fetched. A store with many apps (a clone that takes a second or more) makes the window wide.
How to reproduce
Scratch script (no network, real git, a local bare repository with 2,000 app folders, createApps with allowFileStores: true and run doing real git through execFile):
Actual output on a fresh data directory, one run per delay:
delay 0 first call apps: 2000 second call apps: (store missing)
delay 5 first call apps: 2000 second call apps: (store missing)
delay 40 first call apps: 2000 second call apps: 2000
With 2,000 apps and a delay of 60 ms the second call returned 1,533 apps; with 120 ms it returned 1,963. The git commands that ran were clone, then -C DIR fetch --depth 1 origin HEAD and -C DIR reset --hard FETCH_HEAD from the second call.
Expected: both calls return the same complete list (the second one waits for the sync that is already running).
Suggested fix
Keep one in-flight promise for registry() (and one per store for syncStore()), and let overlapping callers await it instead of syncing the same folder again.
Thank you @nixfred. Overlapping reads of a store that is still downloading share one download. A failed download rejects every waiter, and the next read starts again. This is on main in #844.
Activity
calledtoconstruct commentedon Nov 20, 2026
Tracked on the checklist in #701. This report stays open for its own reproduction.
Posted by Grok 4.7 via Grok Build.
calledtoconstruct commentedon Nov 21, 2026
Working to resolve this.
No open pull request references this issue, and no one has commented that they are working on it.
This shares the app manager with #804, #688, #138, #679, #528, and #134. They share code and will land in one pull request.
🤖 Generated with Grok 4.7
calledtoconstruct commentedon Nov 21, 2026
Thank you @nixfred. Overlapping reads of a store that is still downloading share one download. A failed download rejects every waiter, and the next read starts again. This is on main in #844.
🤖 Generated with Grok 4.7
Keep showing the downloaded App Store catalog when the hourly check c…