Skip to content

fix(browser): settle client-hosted download toasts after their page closes - #28913

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/browser-download-toast-survives-pane
Oct 15, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/browser-download-toast-survives-pane

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When a client-hosted browser page downloads a file for a remote workspace, Orca shows a "Downloading report.pdf…" spinner toast. Switching to another workspace while it downloads unmounts the browser pane. The spinner could remain after the download finished because nothing heard its finish event. Now the app keeps listening after the workspace switch, so that event updates the toast to its final result.

What Changed

  • Before: start a client-hosted browser download, then switch to another workspace. After the download finishes, the "Downloading…" spinner remains. Loading toasts have no close button and never time out.
  • After: when that download finishes, its toast updates even after the browser pane unmounts during a workspace switch.

Mechanism:

  • Who listened before: these toasts are for pages this desktop runs for a remote workspace, which Orca calls client-hosted pages. They have no download shelf, so the toast is their only download UI. The listener for download events lived inside the browser pane, which unmounts when switching workspaces while the download keeps running. The "finished" event then arrived with nothing listening.
  • Who listens now: one app-level listener in useAppShellServices, which already holds subscriptions that must outlive any single view. It claims a download when it starts, if the page is client-hosted according to the store's page handle. It then follows that download by id until it finishes, even if the browser pane has unmounted.
  • One shared check: "is this page client-hosted?" is now a single store function, isClientHostedBrowserPageHandle. The browser view uses it to choose its view type, and the toast listener uses it to claim downloads, so the two can't disagree.

Why

The bug came from the toast's owner living shorter than the download. Adding an X to a progress spinner, or dismissing the toast when the view unmounts, would hide the symptom and lose the result. Download completion would go unreported in both cases. The app-level listener lives as long as the download events it handles, so it can report the final result across workspace views.

Follow-up: #28936 will settle interrupted downloads needing manual resume; until then, their spinners can remain.

Linked Issue

N/A (maintainer; found while auditing toasts that can't be closed, after #28900)

Visual Proof

Before/after screenshots: QA screenshots. The same toast updates after a workspace switch when a finish event arrives. QA exercised controlled client-hosted main-process IPC; paired host transfer and the setup script remain unverified.

Testing

  • Moved the existing download-notice tests from the per-page view to the app-level listener. New cases:

    • the toast settles after the page's handle is gone;
    • downloads from local browser pages, which have their own download shelf, get no toast.
  • Controlled client-hosted QA reproduced the stranded toast on a workspace switch. Ordinary browser tab switch and close left the hidden pane mounted and settled normally in that fixture. Paired host transfer was not verified.

  • CI covers lint, typecheck and the full unit suite.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Renderer-only. The event wire format is unchanged, so mixed client and host versions are unaffected. Local browser pages keep their own download shelf, and the listener ignores their downloads. The web client's preload stubs these subscriptions, so nothing changes there.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…loses

The download progress toast for a page this desktop hosts for a remote
workspace was driven by a listener inside that page's pane. Switching
pages or closing the tab unmounted the listener mid-download, so the
finish never reached the toast and its spinner (no close button, no
timeout) stayed for the session. An interrupted download had the same
result because Chromium sends no finish for it.

Own the toasts from one app-level listener that claims a download when
it starts, and end the spinner on an interrupt.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 15, 2026 01:51
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The browser pane now uses a shared predicate to identify client-hosted page handles. App-shell services invoke the download-notice hook, which tracks requests for hosted pages and processes progress and completion events. Tests mount the hook directly and cover page-handle changes, interrupted downloads, and unclaimed events.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 51f11

Interrupted downloads from client-hosted browser pages can leave the download spinner running indefinitely instead of showing the "Couldn't finish the download." error. This change was meant to fix exactly that case, so handle the interrupted state before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the main change: keeping client-hosted download toasts updated after the browser page closes or unmounts.
Description check Passed The description is complete and matches the repository template. It explains the user impact, mechanism, rationale, linked-issue exception for a maintainer, visual proof, testing, compatibility consid…
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7956dabb-5d38-442e-8286-bfdddd6a6721
📥 Commits

Reviewing files that changed from the base of the PR and between 0905ad4 and fc56802.

📒 Files selected for processing: 8
  • src/renderer/src/app-shell/use-app-shell-services.ts
  • src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.tsx
  • src/renderer/src/components/browser-pane/browser-client-hosted-download-notices.test.tsx
  • src/renderer/src/components/browser-pane/browser-client-hosted-download-notices.ts
  • src/renderer/src/components/browser-pane/client-hosted-browser-pane-test-rig.ts
  • src/renderer/src/store/slices/browser.ts
  • src/renderer/src/store/slices/browser/browser-host-state.ts
💤 Files with no reviewable changes: 2
  • src/renderer/src/components/browser-pane/client-hosted-browser-pane-test-rig.ts
  • src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Settle the toast when progress reports… · browser-client-hosted-download-notices.ts:52-54

src/renderer/src/components/browser-pane/browser-client-hosted-download-notices.ts:52-54
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Settle the toast when progress reports interrupted.

If a claimed download reports state: 'interrupted', this handler calls toast.loading again. If no finished event follows, the spinner remains indefinitely. Handle interrupted before the loading call and show the existing failure error for the same toast ID. The earlier review comment concerns cleanup after an error toast; this path never shows one.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d073ac0-a3f1-4efd-a5f6-e7e13ec88cc6
📥 Commits

Reviewing files that changed from the base of the PR and between fc56802 and 51f117b.

📒 Files selected for processing: 2
  • src/renderer/src/components/browser-pane/browser-client-hosted-download-notices.test.tsx
  • src/renderer/src/components/browser-pane/browser-client-hosted-download-notices.ts
💤 Files with no reviewable changes: 1
  • src/renderer/src/components/browser-pane/browser-client-hosted-download-notices.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@OrcaWin

OrcaWin commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Switching to another workspace during a client-hosted browser download could leave “Downloading…” spinning after the file finished: the browser pane unmounted and took its download listener with it. The app now owns that listener and follows downloads it already claimed through the producer’s finish event, even after the pane or page handle disappears.

The review removed the renderer’s premature error on interrupted progress; only a finish event now chooses the final notice. An interrupted download that never emits finish can still leave a spinner and a small tracking entry. That producer-side policy is deferred to draft #28936.

Verified at 51f117b8bec4537e66ee0b013c46911e41e1f251:

  • Two review rounds, architecture challenge, performance review, and final readiness review; no new findings in round two.
  • Six targeted tests and Linux lint, code-quality, React, renderer typecheck, and full CI typecheck passed. Exact-head PR workflow and required aggregate passed.
  • M4Air CDP comparison against main 1bdbc2364801a30d33b62c49247dc22b93b497e1: the same controlled main-process download events leave main loading after workspace unmount or handle removal; the branch shows the saved result. A real local download still uses its shelf with no global toast. Default Terminal 1 matched; the second local filename gained “(1)” because the first file already existed.

Client-hosted evidence is controlled IPC, not a paired remote transfer. Paired transfer and setup-script execution remain unverified. Ordinary tab switch/close kept the hidden pane mounted and settled normally in this fixture. No merge was performed.

Before, after workspace switch and finish:
Main: download toast remains loading

After, with the same events:
Branch: download toast shows the saved result

@brennanb2025
brennanb2025 merged commit 215bdbd into main Oct 15, 2026
36 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/browser-download-toast-survives-pane branch October 15, 2026 06:36
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.

2 participants