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
fix(web): recreated folders no longer show deleted files - #36590
An already mounted Files panel can show deleted filenames after a folder disappears and is recreated under the same name. A successful child read can race with a parent refresh that observes the removal, leaving the old listing marked as loaded.
Invalidate removed child branches when their parent listing arrives, and prevent reads and queued refreshes belonging to a removed folder from updating its replacement. Preserve reads of newly created children whose parent cache has not refreshed yet.
Found in Wout's bughunt and independently confirmed by Claude Opus 5.5 on ac180919a67fa99bc34dba6c3ad0a970c22764c9. Reconfirmed on current main e80468ba256a025c68dbf331c76a7cca46f71dfc: the supplied reloads a removed folder browser test expected src/new.ts and received src/old.ts.
Validation: the same reproduction passes with the fix. The adjacent Files browser tests and pnpm exec vp run check:changed pass. Coverage uses the public hook in Chromium with controlled directory responses. Full-app filesystem race reproduction and scenarios:prove remain unproven; ordinary child ENOENT already clears the loaded marker and does not reproduce this ordering. Web and desktop share this hook; no native shell, mobile, RPC contract, provider or permission behavior changes.
Size: medium, confined to the directory hook and its existing browser tests, with no storage or migration.
Council review
Reviewer
Round 1
Round 2
Claude Opus 5.5
7/10
9/10
GPT 6.1 Sol
6/10
9/10
Round one found stale shared-query reuse, removed-generation refresh ownership, invalidation against old ancestor listings, and inadequate overlap coverage. These findings were addressed in one fix batch, followed by fresh second-round reviews of the delta. Replacement reads wait for a detached query to settle before fetching fresh data. Local cubic raised the ancestor rescan concern as P2, addressed by scoping invalidation to the arriving parent listing. Cubic could not load repository context for the fork.
Round two has no blockers or shoulds. Deferred nits: an older parent response can discard a newer child listing and require another read; grouping per-folder state would reduce future cleanup coupling. Neither needs expanding this fix. Remaining limits: a hung detached read delays its replacement; another consumer independently refreshing the same atom could still supply an overlapping snapshot. No full-app filesystem race or large-tree performance claim is made.
Created with GPT 6.1 Sol (lead, hunter, review and fixes) and Claude Opus 5.5 (independent verification, build, trim and review) in T3 Code through the Codex and Claude harnesses.
When a refresh's parent listing no longer holds a folder, the file tree kept
that folder's cached listing and loaded marker, so recreating it showed the
old children and a late read of the old folder could reattach them.
An authoritative listing now purges every detached folder's cache, loaded,
requested and error state, and drops its in-flight request so a late read is
ignored and a queued follow-up refresh does not start.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
Macroscope's review found this PR approvable — The file browser now clears stale folder listings and ignores outdated reads so recreated folders no longer display deleted files. The change is limited to in-memory display state and directory reads, without modifying files or product defaults.
No code changes detected at 606ec29. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 1e39bc3 and 606ec29.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
useDirectoryEntries now reconciles cached listings and request state when parent listings change. Browser tests cover retaining a loaded child during refresh and loading the current contents when a removed folder reappears.
Changes: Directory listing reconciliation
Layer / File(s)
Summary
Listing and request reconciliation apps/web/src/components/files/useDirectoryEntries.ts, apps/web/src/components/files/useDirectoryEntries.browser.test.tsx
The hook tracks listings and detached requests, ignores stale results, and removes cached state for descendants no longer present. Tests cover refresh behavior and reloading a folder after it is removed and recreated.
This change makes the Files panel load the current contents when a folder is deleted and recreated under the same name, instead of showing the old files. The change is confined to a client-side hook and its tests, with no data or contract changes. The mounted-panel path was not tested end to end, but no concrete defect was established, so it is ready to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix and the scenario: a recreated folder no longer shows deleted files. It matches the changeset, which invalidates removed child listings in useDirectoryEntries and prevents stale…
Description check
The description covers the problem, the change, scope, and verification. It has a clear problem statement, an explanation of the invalidation and race handling, and a reproduction result from the supp…
Linked Issues check
Issue #36589 requires that a recreated folder load its current contents after a parent listing observes the removal, even when a concurrent child read had succeeded with old contents. The whole-PR dif…
Out of Scope Changes check
All changes sit in the two files named in the PR: the directory hook (useDirectoryEntries.ts) and its browser test (useDirectoryEntries.browser.test.tsx). The hook changes (listings map, detached requ…
Full details: Title check
Explanation
The title names the fix and the scenario: a recreated folder no longer shows deleted files. It matches the changeset, which invalidates removed child listings in useDirectoryEntries and prevents stale reads from updating a replacement folder. It follows the conventional commit format from the template.
Full details: Description check
Explanation
The description covers the problem, the change, scope, and verification. It has a clear problem statement, an explanation of the invalidation and race handling, and a reproduction result from the supplied browser test. It links issue #36589 and states the limits of the verification, including the unproven full-app filesystem race. It uses a council review table that the template does not require. The Verification section lists the adjacent tests and check command, and it names what was not checked. It does not include the before/after screenshots that the template asks for on UI changes, but this change is a hook-level behavior fix with no visual change, so the omission is acceptable. The description is mostly complete.
Full details: Linked Issues check
Explanation
Issue #36589 requires that a recreated folder load its current contents after a parent listing observes the removal, even when a concurrent child read had succeeded with old contents. The whole-PR diff of apps/web/src/components/files/useDirectoryEntries.ts addresses this path:
When a successful parent listing lacks a requested child directory, the hook deletes that path from listings, loaded, requested, requests, and followUpRefreshes, and clears its loading and error state.
The in-flight request for the removed path moves to detachedRequests. Its .then returns early when requests.current.get(directoryPath) !== request, so the stale old-contents read cannot update directories.
A new read for the same path awaits the detached request before it queries. Its result applies only when it is still the current request.
Queued follow-up refreshes run only while the path remains in requested.
The browser test reloads a removed folder when it reappears under the same name in useDirectoryEntries.browser.test.tsx covers the issue ordering: old child read, parent removal, then recreation with src/new.ts, and checks that the replacement listing is loaded and refresh callers share one promise. The mock change keys controlled queries by generation and request, so test runs stay isolated.
Limits: I did not run the tests. The PASS rests on code reading and the author's reported results. The code path that keeps reads of newly created children before the parent refresh was not traced in full; the diff shows no explicit guard for that case, but the author reports it is covered.
Full details: Out of Scope Changes check
Explanation
All changes sit in the two files named in the PR: the directory hook (useDirectoryEntries.ts) and its browser test (useDirectoryEntries.browser.test.tsx). The hook changes (listings map, detached requests, removed-descendant purge, guarded follow-ups and result application) implement the stale-listing fix in #36589. The test changes add the removal/recreation regression test and the generation-keyed mock, which support that fix. The mutation-rescan test extension checks that a child load followed by a root refresh keeps both entries, which relates to the same listing-merge behavior. The PR reports no changes to native shell, mobile, RPC contracts, providers, permissions, storage, or migrations, and the diff does not show any. No unrelated changes were found.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Expand src/old.ts in the mounted Files panel. Refresh with a real child response delayed across a root listing that reports src missing. Deliver the old child response, recreate src containing only new.ts, refresh and expand it. Genuine RPC messages were scheduled deterministically; directory responses were not fabricated. Both sides used Chromium, 1280×800, light theme, fresh isolated state and identical synthetic data.
…6590)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 28f1786)
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
size:M30-99 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
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.
An already mounted Files panel can show deleted filenames after a folder disappears and is recreated under the same name. A successful child read can race with a parent refresh that observes the removal, leaving the old listing marked as loaded.
Invalidate removed child branches when their parent listing arrives, and prevent reads and queued refreshes belonging to a removed folder from updating its replacement. Preserve reads of newly created children whose parent cache has not refreshed yet.
Found in Wout's bughunt and independently confirmed by Claude Opus 5.5 on
ac180919a67fa99bc34dba6c3ad0a970c22764c9. Reconfirmed on current maine80468ba256a025c68dbf331c76a7cca46f71dfc: the suppliedreloads a removed folderbrowser test expectedsrc/new.tsand receivedsrc/old.ts.Validation: the same reproduction passes with the fix. The adjacent Files browser tests and
pnpm exec vp run check:changedpass. Coverage uses the public hook in Chromium with controlled directory responses. Full-app filesystem race reproduction andscenarios:proveremain unproven; ordinary child ENOENT already clears the loaded marker and does not reproduce this ordering. Web and desktop share this hook; no native shell, mobile, RPC contract, provider or permission behavior changes.Size: medium, confined to the directory hook and its existing browser tests, with no storage or migration.
Council review
Round one found stale shared-query reuse, removed-generation refresh ownership, invalidation against old ancestor listings, and inadequate overlap coverage. These findings were addressed in one fix batch, followed by fresh second-round reviews of the delta. Replacement reads wait for a detached query to settle before fetching fresh data. Local cubic raised the ancestor rescan concern as P2, addressed by scoping invalidation to the arriving parent listing. Cubic could not load repository context for the fork.
Round two has no blockers or shoulds. Deferred nits: an older parent response can discard a newer child listing and require another read; grouping per-folder state would reduce future cleanup coupling. Neither needs expanding this fix. Remaining limits: a hung detached read delays its replacement; another consumer independently refreshing the same atom could still supply an overlapping snapshot. No full-app filesystem race or large-tree performance claim is made.
Created with GPT 6.1 Sol (lead, hunter, review and fixes) and Claude Opus 5.5 (independent verification, build, trim and review) in T3 Code through the Codex and Claude harnesses.
Closes #36589