Skip to content

Fixed workspace UI freeze during large multi-file uploads#1

Draft
tariqismail wants to merge 1 commit into
rb81:mainfrom
tariqismail:fix/workspace-upload-freeze
Draft

Fixed workspace UI freeze during large multi-file uploads#1
tariqismail wants to merge 1 commit into
rb81:mainfrom
tariqismail:fix/workspace-upload-freeze

Conversation

@tariqismail

Copy link
Copy Markdown

Problem

Selecting a large batch of files to upload in the /workspace UI makes the whole page appear to freeze until the upload finishes. It is not a server or resource problem — the backend accepts the requests fine and never hits a memory limit.

Root cause

uploadFilesToFolder uploaded files strictly one at a time. Meanwhile the 4s workspace version poller (pollWorkspaceVersion) sees the version change after every uploaded file and fires a full tree refresh + open-tab recheck. The serialized uploads plus the polling/refresh traffic saturate the browser's ~6 connections-per-origin limit, so the UI's own requests (clicks, navigation, tree loads) queue behind the batch and the tab looks frozen until it drains.

Fix (client-side only)

  • Bounded concurrency (UPLOAD_CONCURRENCY = 3) instead of strict one-at-a-time — drains faster without monopolizing the connection pool.
  • Pause version polling during a batch (uploadInProgress guard in pollWorkspaceVersion) and do a single tree refresh when it finishes, instead of one per file.
  • Progress indicator with cancel (#upload-progress) showing count + current file; cancelling stops the remaining queue.
  • Batch guard: large selections (by file count or total size) prompt for confirmation before starting.

The progress element is static markup in workspace.html (toggled by JS), mirroring the existing chat-working-indicator pattern, so it is covered by a test_ui_pages assertion.

Tests

  • Added test_workspace_renders_upload_progress to agent/tests/test_ui_pages.py (server-rendered HTML assertion, matching the existing UI tests). python tests/test_ui_pages.py → 5/5 pass.
  • npm run build (vite) builds cleanly.

Notes

  • Touches frontend source only; the generated workspace.bundle.js is gitignored and not included.
  • No backend/API changes. docs/visual-workspace-ui.md updated to describe the new upload behavior.

Selecting many files uploaded them one at a time while the workspace
version poller kept firing full tree refreshes, saturating the browser's
~6 connections-per-origin limit and making the page appear frozen until
the batch finished.

Uploads now run with bounded concurrency, pause version polling for the
duration of a batch, and refresh the tree once at the end. A progress
indicator shows the count and current file and can cancel the remaining
queue, and large selections prompt for confirmation before starting.

Adds a UI-page test asserting the upload progress markup renders and
documents the behavior in docs/visual-workspace-ui.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant