Skip to content

fix(frontend): A finished upload confirms itself instead of vanishing - #5793

Closed
ardaerzin wants to merge 1 commit into
mainfrom
fe-fix/drive-upload-reveal
Closed

fix(frontend): A finished upload confirms itself instead of vanishing#5793
ardaerzin wants to merge 1 commit into
mainfrom
fe-fix/drive-upload-reveal

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Context

Uploading a file into an agent's drive can look like it failed. The optimistic tile shows progress, then disappears the moment the write lands, and the real file takes its place from the refetched listing. When a drive filter hides that file, nothing takes its place. The tile just blinks out into an empty grid.

Two filters do this. Hidden files (any dot-prefixed path) when the eye toggle is off, and git-ignored files, which are off by default. An .env dropped into a cloned repo hits both, since the root .gitignore carries **/*.env*. Nothing else confirmed the write either: the drive only toasted for downloads, never for uploads.

Changes

Every completed upload now toasts, and anything the filters would have swallowed reveals itself instead of vanishing.

Hidden-ness is decidable from the path, so showHidden flips before the toast fires and the message explains the change: Uploaded .env.ee.dev · showing hidden files.

Git-ignored-ness is not decidable on the client. The listing simply omits the entry, so absence is the only available signal. The new useUploadReveal hook watches each completed batch against the refetched directory. A file still missing from a settled listing flips the git-ignored toggle, and the toast updates to · showing git-ignored files.

Uploads that finish within 300ms of each other toast as one message, so dropping a folder gives you one line instead of one per file.

The settle rule is the subtle part, so it lives in a pure function (ruleOnBatch) rather than buried in an effect. It rules on a batch only once every destination directory is loaded and no longer fetching. It gets there either by observing the refetch that the upload's own cache invalidation kicks off, or after a 1.5s floor when that refetch was too quick to observe. A directory that never loads (an upload into a collapsed folder, say) ages out at 6s and is dropped without a verdict, so a filter never flips on a guess.

Tests

  • Seven unit tests on ruleOnBatch covering confirm, wait, the settle floor, the observed refetch, give-up, and a root-level upload.
  • tsc --noEmit and eslint are clean on the touched files.
  • Not verified against a running stack. The interesting paths need a real mount with a git-ignored destination.

What to QA

  • Open the Files drawer on a session whose drive holds a cloned repo. Drop a .env file into a folder inside it. You get an "Uploaded ... showing git-ignored files" toast, the git-ignored toggle (the dashed-file icon) turns on, and the file stays visible where the progress tile was.
  • Turn hidden files off with the eye in the toolbar, then upload any dotfile. The toast says "showing hidden files" and the eye flips back on.
  • Upload a normal file into a plain folder. One success toast, the file appears in place, and neither toggle changes.
  • Drop a folder of several files at once. One toast for the batch, not one per file.
  • Regression: make an upload fail (kill the network mid-write). The red retry tile still appears in the grid and no success toast fires.

An upload's optimistic tile is dropped the moment the write lands, and the real
file takes its place from the refetched listing — unless a drive filter hides it
(a dotfile with hidden files off, or a git-ignored .env). The tile then blinked
out into nothing, which reads as a failed upload, and nothing else confirmed the
write: the drive only toasted for downloads.

Every completed batch now toasts, and whatever the filters would have swallowed
is revealed. Hidden-ness is decidable from the path, so it flips before the
toast. Git-ignored-ness is not — the listing simply omits the entry — so the file
is confirmed against the refetched directory, and one still missing from a
settled listing flips the git-ignored toggle, with the toast saying why the view
changed.

The settle rule is pure and tested: it only rules once the destination directory
is loaded and no longer fetching, either from observing the invalidation's own
refetch or after a 1.5s floor when that refetch was too quick to see. A directory
that never loads ages out and is dropped without touching a filter.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug report Something isn't working frontend labels Aug 6, 2026
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 6, 2026 7:48pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Completed uploads now appear automatically in Drive Explorer, even when directory loading or visibility filters would otherwise hide them.
    • Git-ignored uploaded files can automatically enable the relevant visibility filter.
    • Upload completion notifications are shown after successful uploads.
  • Bug Fixes

    • Improved handling of uploaded files while destination folders are still loading or updating.

Walkthrough

Upload completion paths now flow from useMountUpload through DriveExplorer into useUploadReveal. The new hook batches paths, waits for directory listings to settle, and reveals hidden or Gitignored uploads when needed.

Changes

Drive upload reveal flow

Layer / File(s) Summary
Batch evaluation and reveal state
web/oss/src/components/Drives/useUploadReveal.ts, web/oss/src/components/Drives/useUploadReveal.test.ts
Adds batch verdicts for confirmed, filtered, waiting, and unresolved uploads. The hook monitors directory fetch state, updates visibility filters, manages timers, and reports success messages. Tests cover these verdicts and root-level paths.
Upload completion callback wiring
web/oss/src/components/Drives/useMountUpload.ts, web/oss/src/components/Drives/useDriveUploads.ts
Adds an optional onUploaded callback. Successful uploads report their drive-root-relative paths without recreating upload execution logic when the callback changes.
DriveExplorer reveal integration
web/oss/src/components/Drives/DriveExplorer.tsx
Connects upload completion callbacks, lazy-tree files, directory loading state, repository scope, and hidden-file/Gitignored filters to useUploadReveal.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant DriveExplorer
  participant useDriveUploads
  participant useMountUpload
  participant useUploadReveal
  DriveExplorer->>useUploadReveal: obtain upload completion callback
  DriveExplorer->>useDriveUploads: pass callback
  useDriveUploads->>useMountUpload: configure callback
  useMountUpload->>useUploadReveal: report completed path
  useUploadReveal->>DriveExplorer: update visibility filters
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: completed uploads confirm themselves instead of disappearing.
Description check ✅ Passed The description directly explains upload confirmation, filter reveal behavior, batching, settle logic, tests, and QA coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fe-fix/drive-upload-reveal

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
web/oss/src/components/Drives/useUploadReveal.ts (1)

1-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce the file-level comment.

Lines 1-12 include product history and UI rationale. Keep only a short comment for the listing-settle constraint. Keep release context in the PR description.

As per coding guidelines, “Keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b561530-939a-4f44-85c8-7c34a963b6a8

📥 Commits

Reviewing files that changed from the base of the PR and between ecacb20 and 85a68a9.

📒 Files selected for processing (5)
  • web/oss/src/components/Drives/DriveExplorer.tsx
  • web/oss/src/components/Drives/useDriveUploads.ts
  • web/oss/src/components/Drives/useMountUpload.ts
  • web/oss/src/components/Drives/useUploadReveal.test.ts
  • web/oss/src/components/Drives/useUploadReveal.ts

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 9, 2026
@mmabrouk

mmabrouk commented Aug 9, 2026

Copy link
Copy Markdown
Member

Landed in release/v0.112.0 as part of the 0.112.0 release. The release branch now contains this work at commit ae71a92. Closing here since there is nothing left to merge.

@mmabrouk mmabrouk closed this Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug report Something isn't working frontend lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants