Repository navigation
Conversation
The installed sidecar has no workspace catalog, so its tab replies report worktreeId null. Project the worktree recorded at creation onto list, show, and profile-show results, including popups adopted from their opener.
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
|
Thanks @eisen0419, this was the right fix. I carried it over in #47136 with your commit kept as is. The only change is a shorter test. It's bundled with a few other orcad browser fixes from the same audit, and you're credited as co-author on the squash commit. |
|
Closing since this landed in #47136, with you credited as co-author. Thanks for the fix! |
ELI5
When
orcadopens a browser tab in its local Electron sidecar for a specific workspace (orca tab create --worktree ...), the sidecar itself runs in an isolated temporary profile without a workspace catalog and reportsworktreeId: null.orcadalready recorded the resolved workspace ID when creating the tab, and now puts that workspace ID back onto tab queries (tab list,tab show,tab current,tab profile-show, and adopted popups) instead of exposingworktreeId: null.What Changed
In
ElectronSidecarTabRegistry(src/main/orcad/browser-providers/electron/electron-sidecar-tab-registry.ts):worktreeId: z.string().nullable().optional()toElectronSidecarTabSchemaandElectronSidecarResult.worktreeId(ornullwhen unscoped) inrewriteTabsobrowser.tabList,browser.tabShow,browser.tabCurrent, and popups adopted from a scoped opener report their registeredworktreeIdrather than the sidecar'snull(including unscopedorca tab list --worktree alland mergedBrowserClientPageQuerieslistings).worktreeIdinrewriteResultwhen'worktreeId' in rewritten(prior to rewritingbrowserPageIdfrom the sidecar ID to the public ID) sobrowser.tabProfileShowpreserves the registeredworktreeIdwithout addingworktreeIdto unrelated RPC results such as snapshots or evaluations.Why
#42718 was reported on
v1.4.258(released 14 hours before #41989 shipped paired-desktop tab placement inv1.4.259). Onmain, server-agenttab create --worktree <selector>already routes to a volunteering paired "This device" desktop viaopensOnPairedDesktop, while intentionally falling back toorcad's Electron sidecar when no desktop volunteers, when the desktop is set to "Server (streamed)", or when server-only parameters (--placement server, non-web URLs, older desktops) are used. However, tabs created on the Electron sidecar still lost their explicit--worktreescope in every subsequent query becauseElectronServeBrowserProcess.invokestripsworktreebefore calling the sidecar andElectronSidecarTabRegistrynever projected the storedworktreeIdback onto sidecar tab payloads (unlikeexternalChromiumTabInfo). Projecting the registry'sworktreeIdkeeps workspace scope truthful from a single source of truth onorcad.Linked Issue
Fixes #42718
Visual Proof
N/A—orcadElectron sidecar RPC registry projection fix (src/main/orcad/browser-providers/electron/electron-sidecar-tab-registry.ts) with no renderer UI layout or visual change.Testing
Verified on macOS:
src/main/orcad/browser-providers/electron/electron-sidecar-tab-registry.test.tscoveringtab list(reconcileTabs),tab show(rewriteResult),tab profile-show(top-levelrewriteResult), and popup adoption from a scoped opener; all 4 new tests fail withworktreeId: nullbefore the fix and pass after.src/main/orcad(121 passed, 2 skipped).oxlint,oxlint --config config/oxlint-js-plugins.json,ast-grep scan --config config/sgconfig.yml --min-severity warning, andoxfmt --checkcleanly on both touched files.Risk
Level: Low
Scoped strictly to
ElectronSidecarTabRegistrytab and profile-show result rewriting fororcad's Electron sidecar browser provider. Top-levelworktreeIdprojection inrewriteResultis gated by'worktreeId' in rewritten, so sidecar RPC responses that do not carryworktreeIdkeep their exact shape. Paired-desktop placement (opensOnPairedDesktop), SSH browser bridges, and persisted state are untouched; a plain revert cleanly restores previous behavior.AI Disclosure
Implemented and cross-reviewed with Grok 4.7 (
grok-4.7) and Gemini (gemini-4-carbon).Review
orcadwith no OS-specific branches across Linux, macOS, and Windows.orca serve(orcad) sidecar tabs without altering paired-desktop or SSH bridge placement.orca tab list --worktree all --json,orca tab show,orca tab current,orca tab profile-show, andBrowserClientPageQueriesmerged workspace listings now report the resolvedworktreeIdinstead ofnull.O(1)Map.getlookup onpagesBySidecarIdper returned tab row.host.resolveBrowserWorkspace.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)