Skip to content

fix(browser): report workspace ownership for isolated sidecar tabs - #42741

Closed
6fmh wants to merge 1 commit into
stablyai:mainfrom
6fmh:fix/issue-42718-explicit-browser-workspace
Closed

6fmh wants to merge 1 commit into
stablyai:mainfrom
6fmh:fix/issue-42718-explicit-browser-workspace

Conversation

@6fmh

@6fmh 6fmh commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Browser tabs opened by the headless server can belong to a workspace even though their isolated browser process has no workspace data. The server now reports the workspace it recorded instead of returning worktreeId: null.

What Changed

Project the parent registry's workspace ID when rewriting Electron sidecar tab results. This covers tab listings and nested tab results, including popups that inherit their opener's workspace. Unscoped tabs continue to report null.

Why

The isolated sidecar deliberately has no workspaces. The parent registry already holds the authoritative ownership and uses it to scope operations, so its public metadata should agree with that ownership.

Linked Issue

Partial fix for #42718: correct the null workspace metadata. Keep the issue open pending reproduction of paired-client placement and cookie behavior. This change does not implement client routing or share browser sessions.

Visual Proof

N/A

This changes server-side JSON metadata only; no rendered UI or interaction changes. The owning registry reproduction returned worktreeId: null before and worktreeId: "workspace-a" after for the same registered tab and its popup.

Testing

  • I manually tested these changes locally (standalone registry reproduction on Windows, without launching the desktop app).
  • Automated tests added/updated.
  • Every added test fails without this change and avoids the test anti-patterns.

The real registry regression fails with only the production overlay removed and passes when restored (1 test). It exercises a workspace tab, inherited popup, unscoped tab, and nested tab result with hardcoded expectations.

Normal pnpm test src/main/orcad/browser-providers/electron/electron-sidecar-tab-registry.test.ts --maxWorkers=1 passed (1/1), including workspace package build and the native runtime guard. The actual tracked pre-commit hook passed lint, JS plugins, AST gates, React Doctor, and formatting.

Immediately before pushing, ORCA_CODE_QUALITY_BASE=upstream/main pnpm check:changed --base=upstream/main --maxWorkers=1 passed all 25 checks in 179 seconds, including related unit tests, node/web/CLI typechecks, formatting, lint, changed-code quality, import boundaries, localization extraction, test-file runners, and all selected ratchets. Windows validation used the supported private pnpm task-state directory with automatic dependency verification disabled to preserve the shared checkout's dependency links.

Full repository lint/typecheck/test/build and paired Windows-desktop/Linux-server cookie placement have not been validated locally.

Risk

Level: Low for the metadata change.

The public workspace field now comes from the server registry. Incorrect registry ownership would surface as incorrect metadata; no ownership, cookie partition, browser placement, saved state, or routing is changed. A plain revert restores the prior projection.

AI Disclosure

Implemented and reviewed with OpenAI Codex assistance. The regression was supplied by another Codex worker and adopted by the primary owner; that handoff is not independent human review.

Review

The change uses existing registry state with one map lookup per rewritten tab. It introduces no platform-specific paths, shortcuts, or process launches and does not assume a Git worktree. Local, remote/SSH, mobile callers, agents, and integrations receive the same JSON shape with corrected ownership metadata. Authentication and browser contexts retain their existing behavior. The broader paired-client report remains unverified, so this PR stays draft.

A second Codex agent reviewed exact commit 35dad151 without edits, tests, or app launches and found no blocking defect in this partial metadata fix. It checked the parent registration/sidecar boundary, popup inheritance, unknown nested results, unscoped tabs, and regression quality, and confirmed that top-level create/switch shapes and paired placement/cookies remain unchanged.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content is copied or translated.

Notes

Remaining work: reproduce explicit-workspace tab creation on a paired Windows desktop/Linux server and verify client placement, split placement, and authenticated session reuse against current upstream routing.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I stated the risk and how to back it out
  • Visual proof is N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (broader validation remains for CI)

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @6fmh. #47136 fixes this with #42737's approach, which also covers tab profile show. Its test borrows your compact shape, and you're credited as co-author on the squash commit.

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Closing since this landed in #47136, with you credited as co-author. Thanks for the fix!

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