Repository navigation
Description
An expanded directory in the sidebar file tree sometimes shows "Loading…" forever. It happens after the repo contents change (an agent turn writing files, a build step, a checkout), and it never resolves on its own.
Repro
No reliable one yet. Both @adamatan and @simion have hit it, always after files changed on disk while a folder was open.
Workaround, and the first thing to check when it happens
Collapse the stuck folder and expand it again. That drops it out of the children cache and forces a fresh read.
This also splits the search space, so please note which one you see:
- Contents appear right away: the tree lost the cached listing (a state bug in the frontend).
- Still stuck: the directory read itself is failing or hanging (a
task_dir_listbug).
A console check helps too. ensureLoaded logs dir list failed and refetchDir logs refetch dir failed, but the settle-triggered reload swallows its errors silently. A stuck row with a clean console points at the reload path.
Where it can come from
Not reproduced, so these are readings of the code, not a diagnosis. All three break the same invariant: a directory is in expanded with no entry in children, nothing in flight, and no retry.
The row itself never checks whether a read is running. src/components/task/FileTree.tsx:499 renders "Loading…" whenever an open directory has no cached children, so a dropped listing and a genuinely slow read look identical.
-
The settle reload drops directories whose read failed.
FileTree.tsx:148turns a rejectedtaskDirListintonulland skips that key, thenFileTree.tsx:157replaces the whole children map rather than merging. A directory being rewritten on disk at that moment (a build output dir, a generated tree) reads as an error, gets dropped, and stays stuck. This fits the screenshot:buildandreferenceare both stuck while hand-written directories are fine. It also explains why it only shows up when the repo changes, sincesameChildrenatFileTree.tsx:156skips the replace entirely when nothing changed. -
Expanding a folder during an in-flight reload.
ensureLoadedwriteschildren[rel], then the reload's wholesale replace atFileTree.tsx:157clobbers it. The folder is still expanded, so it renders "Loading…" with nothing left to fill it. -
Restoring expanded folders on task switch. The mount effect (
FileTree.tsx:120) has the same drop-on-failure shape for folders restored fromexpandedByTask.
Fix direction
Merge the reload result into the children cache instead of replacing it. Drive the "Loading…" row off the in-flight loading set (FileTree.tsx:88) so a stuck folder is visibly different from a slow one. Retry or surface a failed directory read rather than swallowing it.
@simion I have not found a clean repro either. I will dig into it, starting with whether the collapse/expand test above heals it.
Activity
simion commentedon Aug 4, 2026
Happened to me too. Any ideas on how to reproduce?
adamatan commentedon Aug 4, 2026
Not yet, it's inconsistent.
fix(files): a folder whose read fails keeps its contents instead of h…
simion commentedon Aug 18, 2026
Fix on main, 0863bdf. Still no repro, so this closes the state hole rather than the trigger.
The mechanism, as far as the code goes. The settle reload (bumped by
fsRevision, so it fires exactly when files just changed) re-read root plus every expanded dir, dropped the ones whose read rejected, and then replaced the whole children map with what was left.task_dir_listrejects on a transient miss:safe_task_pathcanonicalizes, so a directory that is momentarily absent while a build or a generator rewrites it is ENOENT. The dir stayed inexpandedwith no listing, nothing in flight and no retry, and the row rendered "Loading…" offisOpen && !kidsalone. That is your cause 1, and it fitsbuildandreferencebeing the two stuck rows.Changes:
rootEntriesto[]and blank the tree.togglestarts a load from inside asetExpandedupdater, so the stateloadingcould lag and fire a duplicate read.Cache logic is in
src/lib/explorer/dirCache.tswith unit tests, since there is nothing to test against otherwise. Two e2e cases infiles.e2e.tsdrive a real failure withchmod 000; the merge one fails against the old replace, verified by reverting it.Leaving this open. If it was something else, the retry row will say so next time instead of looking the same as a slow read.
simion commentedon Aug 18, 2026
Closing. Fixed by 0863bdf, details above.
It cannot sit on "Loading…" now: an expanded folder either has a listing, has a read in flight, or shows a retry row. If a folder ever shows that row, that is a directory read genuinely failing, which is a different bug from this one. Open a new issue with the path and I will look at what
task_dir_listis rejecting.simion commentedon Aug 19, 2026
This shipped in v0.28.0, released today.
fix(files): say what went wrong when a folder will not read