Skip to content

fix(browser): show profiles changed outside the window in the profile menu without a reload - #32723

Merged
AmoabaKelvin merged 7 commits into
mainfrom
browser-profile-list-sync
Oct 24, 2026
Merged

AmoabaKelvin merged 7 commits into
mainfrom
browser-profile-list-sync

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​172 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​172
Prod 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​107 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94

Summary

A browser profile made with orca tab profile create didn't show up in an open window's profile menu until something reloaded the list (a restart, opening Settings). The same went for profiles deleted from the CLI, re-sourced by a CLI cookie import, or created and removed by per-repo and per-workspace profiles. Paired clients missed them too.

Root cause. Main's session registry owns the profile list, but it never said when the list changed. The renderer loaded the list only at startup, from the Settings panes, and after its own actions.

Fix.

  • Announce at the owner. BrowserSessionRegistry now fires onProfilesChanged after every create, delete and source change. The runtime forwards it the same way it forwards repo and automation changes: the window notifier sends browser:session:profilesChanged to the local renderer, and a browserProfilesChanged client event goes to paired clients. Each side refetches only that host's list. The new event type needs no negotiation, because older clients drop unknown event types and older servers just never send it.
  • Keep deleted-profile tabs out of Default. Once the list refreshes live, a tab whose profile was deleted elsewhere used to fall back to Default's cookie jar. The partition hook now gives such a tab a partition main refuses, the same one the per-workspace placeholder uses. A toolbar-switched tab already behaves this way when its profile is deleted.
  • Drop a stale default pick. A successful full listing now clears a default pick that the host no longer lists, so new tabs don't open on a deleted profile. A failed fetch and incremental updates leave the pick alone.

Known gaps (not changed here):

  • On orcad with the Electron browser sidecar, profile RPCs run in the sidecar. orcad doesn't forward the sidecar's client events, so paired clients of that setup keep their old refresh triggers.
  • Before the local list first loads, a tab on a named profile with no stored partition still resolves to Default. That already happens on main.

Linked Issue

Fixes #29081
Linear: STA-10664

Testing

  • browser-session-registry.test.ts: the registry announces create, managed create, source change and delete after the list reflects each one, and stays quiet on refused calls. Fails without the fix.
  • runtime-client-ipc-bridge-ownership.test.ts: a host's browserProfilesChanged frame goes through the real stream decoding and lands that host's new list in the store, leaving the local list alone. Fails if the event type is missing from the client allowlist.
  • use-browser-page-webview-partition.test.ts: a tab whose profile disappears from the loaded list no longer resolves to Default's partition. Fails on main with persist:default.
  • browser-session-profiles.test.ts: a full listing drops a stale default pick, and a failed server fetch keeps it. Each fails without its fix.
  • Focused suites for the registry, IPC bridges, store slices, browser pane and startup wiring, plus check:code-quality:changed, check:react-doctor:changed and the focus-read, max-lines and runtime-electron ratchets.
  • Live run: hidden dev builds of main and of this branch side by side, driven over CDP, calling the installed orca tab profile create against each.

Visual Proof

Before (main): after the CLI call, main lists "Made by CLI" but the open window's menu still shows only Default.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

After (this branch): the menu lists "Made by CLI" right after the CLI call, with no reload.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

@AmoabaKelvin
AmoabaKelvin marked this pull request as ready for review October 23, 2026 17:38
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The main process now emits profile-change notifications after registry updates. Local and runtime renderer bridges use those notifications to refresh host profile lists. Current refreshes reconcile default-profile selections that are no longer listed. Browser partition resolution now returns an unadmitted partition when a requested profile is missing.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Moderate · up to a3724

Profile tabs can receive Default cookies, paired clients can miss external profile changes, and remote creation can duplicate profiles; these behaviors should be fixed 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 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 32 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: browser profile lists now update in the open window's profile menu when profiles change outside the window, without a reload. The changeset adds a registry change call…
Description check Passed The description follows the template closely. It has a Summary with root cause and fix, a Linked Issue (Fixes #29081, Linear STA-10664), a Testing section listing specific tests and a live run, and a …
Linked Issues check Passed Issue #29081 requires profiles created, deleted, or sourced outside the renderer to appear in the open window profile menu without a reload. BrowserSessionRegistry now reports profile changes after …
Out of Scope Changes check Passed The paired-client browserProfilesChanged event extends the same profile-list freshness fix to affected hosts. The deleted-profile partition prevents a live refresh from falling back to Default. Stal…
Full details: Title check

Explanation

The title names the main change: browser profile lists now update in the open window's profile menu when profiles change outside the window, without a reload. The changeset adds a registry change callback, runtime forwarding to the local renderer and paired clients, and client-side refetch. The title uses the conventional 'fix(browser):' prefix and stays under one sentence. It omits the paired-client and stale-default-pick parts, which is acceptable.

Full details: Description check

Explanation

The description follows the template closely. It has a Summary with root cause and fix, a Linked Issue (Fixes #29081, Linear STA-10664), a Testing section listing specific tests and a live run, and a Visual Proof section with before/after media. It lacks the template's ELI5 section, the 'Why' section explaining alternatives considered, and the 'Review' and 'AI Disclosure' sections. The Testing checkbox for manual testing is not ticked, though the live run is described. The Summary covers the what and how, but the ELI5 and the alternatives rationale are missing.

Resolution

Consider adding the template's ELI5 section in plain language. Add a Why section that explains why announcing at the registry owner was chosen over the alternatives. Fill in or remove the AI Disclosure section as appropriate. Tick the manual testing checkbox if the live run covers it.

Full details: Linked Issues check

Explanation

Issue #29081 requires profiles created, deleted, or sourced outside the renderer to appear in the open window profile menu without a reload. BrowserSessionRegistry now reports profile changes after successful mutations. Main forwards the report to the local renderer through browser:session:profilesChanged. The renderer refetches the affected host list. The added registry and IPC tests cover this behavior. The change also preserves the reported profile-list state rules for stale selections and failed fetches.

Full details: Out of Scope Changes check

Explanation

The paired-client browserProfilesChanged event extends the same profile-list freshness fix to affected hosts. The deleted-profile partition prevents a live refresh from falling back to Default. Stale-selection cleanup, request ordering, and fixture updates support correct profile-list behavior and its tests. The reported orcad sidecar gap is documented as unchanged behavior, not unrelated implementation. No unrelated change is demonstrated.

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: 2


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ad212a8f-eb4a-4ea1-96eb-dcb5eabafb2d
📥 Commits

Reviewing files that changed from the base of the PR and between 9b6a2e8 and d061d2e.

📒 Files selected for processing: 32
  • src/main/browser/browser-session-registry.test.ts
  • src/main/browser/browser-session-registry.ts
  • src/main/runtime/runtime-notifier-contract.ts
  • src/main/runtime/workspaces/workspace-host-notifications.ts
  • src/main/startup/main-process-quit-pending-writer.test.ts
  • src/main/startup/main-process-quit-update-veto.test.ts
  • src/main/startup/main-process-runtime-service.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/preload/api/browser-api.ts
  • src/preload/api/browser-bridge-page-interaction-and-sessions.ts
  • src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-partition.test.ts
  • src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-partition.ts
  • src/renderer/src/hooks/ipc-events-agent-status-window-test-fixtures.ts
  • src/renderer/src/hooks/ipc-events-close-routing-test-harness.ts
  • src/renderer/src/hooks/ipc-events-terminal-create-window-test-fixtures.ts
  • src/renderer/src/hooks/ipc-events/browser-state-capture-paint-hold.test.ts
  • src/renderer/src/hooks/ipc-events/browser-state-ipc-bridge.ts
  • src/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge-ownership.test.ts
  • src/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge.ts
  • src/renderer/src/hooks/useIpcEvents-browser-tab-create.test.ts
  • src/renderer/src/hooks/useIpcEvents-cli-worktree-activation.test.ts
  • src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts
  • src/renderer/src/hooks/useIpcEvents-ssh-disconnect-cleanup.test.ts
  • src/renderer/src/hooks/useIpcEvents-updater-status.test.ts
  • src/renderer/src/runtime/runtime-client-events.ts
  • src/renderer/src/store/slices/browser-session-profiles.test.ts
  • src/renderer/src/store/slices/browser/browser-host-state.ts
  • src/renderer/src/store/slices/browser/browser-managed-profile-actions.ts
  • src/renderer/src/store/slices/browser/browser-profile-list-actions.ts
  • src/renderer/src/web/preload-api/web-browser-api.ts
  • src/shared/browser-profile-scope.ts
  • src/shared/runtime-client-events.ts

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

@AmoabaKelvin
AmoabaKelvin force-pushed the browser-profile-list-sync branch from 4bde6af to 98e5ab1 Compare October 23, 2026 22:15

@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 · Use the unadmitted partition until local profiles… · use-browser-page-webview-partition.ts:28-31

src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-partition.ts:28-31
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Use the unadmitted partition until local profiles are loaded.

When a named tab has no stored partition, the initial browserSessionProfilesByHostId entry is undefined. Because the guard also requires localProfiles, it skips unadmittedBrowserPartition(sessionProfileId) during asynchronous hydration. The resolver then selects ORCA_BROWSER_PARTITION or another fallback partition, so the tab can read or write cookies in the fallback jar instead of its isolated profile partition.

Suggested fix
-  if (sessionProfileId && !sessionProfile && localProfiles) {
+  if (sessionProfileId && !sessionProfile) {
     return unadmittedBrowserPartition(sessionProfileId)
   }

ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 94b3ad4f-cf49-4028-baec-ca0150bfc843
📥 Commits

Reviewing files that changed from the base of the PR and between 4bde6af and 98e5ab1.

📒 Files selected for processing: 3
  • src/main/browser/browser-session-registry.ts
  • src/main/startup/main-process-quit-pending-writer.test.ts
  • src/main/startup/main-process-quit-update-veto.test.ts

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

@AmoabaKelvin
AmoabaKelvin force-pushed the browser-profile-list-sync branch from 98e5ab1 to a37243c Compare October 24, 2026 03:32

@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 (2)

Minor · Forward sidecar profile changes to paired clients. · workspace-host-notifications.ts:193-196

src/main/runtime/workspaces/workspace-host-notifications.ts:193-196
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Forward sidecar profile changes to paired clients.

startOrcadBrowserProvider() installs the sidecar command factory for runtime browser RPCs. Profile create, delete, and import therefore run in the sidecar registry. browserProfilesChanged is emitted only from the main-process browserSessionRegistry.onProfilesChanged callback. The unary sidecar transport has no event subscription or forwarding path.

As a result, runtime-client-ipc-bridge.ts does not call fetchBrowserSessionProfiles() for paired clients after a sidecar mutation. Their cached profile lists can remain stale until a reload or explicit refetch. Emit the same client event after successful sidecar-originated profile mutations, including import, at the main runtime boundary.

Minor · Isolate unresolved named profiles before the local… · use-browser-page-webview-partition.ts:31-39

src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-partition.ts:31-39
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Isolate unresolved named profiles before the local list loads.

A reachable profile tab can have sessionProfileId set and sessionPartition unset before the local profile list is written. In that state, localProfiles is undefined, so this guard is skipped. The fallback can return the shared ORCA_BROWSER_PARTITION, and ensureBrowserPageWebview assigns it to the Electron <webview> partition. The tab can therefore load with Default’s cookies instead of an isolated partition.

Remove the localProfiles condition. Resolved profiles and tabs with an explicit partition keep their existing behavior.

Suggested fix
-  if (sessionProfileId && !sessionProfile && localProfiles) {
+  if (sessionProfileId && !sessionProfile) {

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee4769f4-2c83-4566-ac76-9292f81a79f2
Commits

Reviewing files that changed from the base of the PR and between 98e5ab1 and a37243c.

Files selected for processing: 1
  • src/renderer/src/hooks/ipc-events/browser-state-ipc-bridge.ts

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

@AmoabaKelvin
AmoabaKelvin merged commit 785daec into main Oct 24, 2026
42 checks passed
@AmoabaKelvin
AmoabaKelvin deleted the browser-profile-list-sync branch October 24, 2026 05:06
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.

[Bug]: A browser profile created from the CLI doesn't appear in Orca's profile menu until the list is reloaded

1 participant