Skip to content

fix(source-control): open another workspace from the branch picker like the sidebar - #41930

Merged
nwparker merged 1 commit into
stablyai:mainfrom
mancunianez:mancunianez/fix-chat-ui-branch
Nov 14, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
mancunianez:mancunianez/fix-chat-ui-branch

Conversation

@mancunianez

@mancunianez mancunianez commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

In Source Control, the branch picker lets you jump to the workspace that already has a branch checked out ("Open workspace"). If you had closed every tab in that workspace, the jump selected it but showed a blank window. Now it opens the workspace the same way clicking it in the sidebar does, so you get a terminal (or your default agent chat) back.

What Changed

Before: Open workspace in the branch picker, Git Graph's open-workspace action, and the folder-workspace Source Control header all called the raw store action setActiveWorktree. That only changes the selection. A workspace whose tabs were closed on purpose has a closed-terminal tombstone, which correctly blocks the automatic first-visit shell, so nothing put a surface back and the window stayed blank until the user reopened it from the sidebar.

After: all three call activateAndRevealWorktree(id, { navigationIntent: 'user-open', executionHostId, clearSidebarFilters: false }), the same activation the sidebar uses. That path reseeds an emptied workspace with the user's default surface, resumes sleeping agent sessions, and records the visit. clearSidebarFilters: false keeps the user's sidebar search/filters, since these entry points are not in the sidebar. The branch picker handler is a module-level function instead of a useCallback, since it captures nothing.

Why

Opening a workspace from the branch picker is a user action, so it should use the existing user-open path instead of a partial copy of it. Seeding a surface inside the picker would duplicate activateAndRevealWorktree's handling of sleeping agents, pending creations, and host authority.

Linked Issue

Fixes #41929

Visual Proof

Real Electron app, right after clicking Open workspace in the Source Control branch picker for a workspace whose tabs were all closed.

Before: workspace selected, blank editor After: opens with a live terminal, like the sidebar
Before: blank workspace After: terminal shown

Testing

  • I manually tested these changes locally

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

  • Every added test fails without this change and avoids the test anti-patterns

  • Reproduced in the app on macOS: create a second workspace, close all its tabs, switch away, then use Open workspace from the Source Control branch picker. Before: blank window. After: a terminal appears (screenshots above).

  • New tests/e2e/branch-picker-open-workspace.spec.ts (electron-headless): first checks that the target workspace has zero renderable tabs and a recorded close, then opens it from the branch picker and checks it is active with one visible terminal. Without the fix it fails (renderableTabs: 0, visibleTerminals: 0). With the fix it passes on macOS.

  • Targeted vitest for source-control/branches, editor/git-graph, and lib/workspace/activation: 36/36 pass.

  • oxlint (anti-slop, code-quality native plugins), ast-grep, oxfmt, and the changed-code quality gate are clean on the touched files.

Platforms: tested on macOS with a local host. The change only swaps which renderer activation function is called, and executionHostId is passed through unchanged, so SSH/remote workspaces resolve the same way. Nothing here is platform-specific.

Risk

Level: Low

activateAndRevealWorktree does more than setActiveWorktree: it switches to the terminal view, records the visit for Cmd+J recency, and may seed a default surface or resume sleeping agents. That is exactly what the sidebar already does for the same action. To back it out, revert the commit.

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

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Original fix by @mancunianez in #41930 (squashed with review follow-ups; authorship preserved).

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Git Graph navigation, the folder workspace source-control header, and the branch picker now open worktrees through activateAndRevealWorktree with the user-open intent and execution host ID. Each action disables sidebar filter clearing. An end-to-end test closes a workspace’s tabs, opens it from the branch picker, and checks that it becomes active with a renderable tab and visible terminal.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to af933

This change makes opening a workspace from the branch picker, Git Graph, and the folder workspace Source Control header behave like the sidebar, so a workspace whose tabs were closed now renders instead of showing a blank window. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the branch picker's "Open workspace" action now opens another workspace the same way the sidebar does. The description and objectives describe the same change, so the …
Description check Passed The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #41929), Visual Proof with before and after screenshots, Testing with the E2E test and pass/fail resul…
Linked Issues check Passed [#41929] The issue requires that Open workspace from the branch picker render a usable surface for an emptied workspace, as the sidebar does. The issue names three raw setActiveWorktree call sites: Wo…
Out of Scope Changes check Passed The changed files are WorkspaceBranchPicker.tsx, git-graph-workspace-navigation.ts, FolderWorkspaceSourceControlPanel.tsx, and the new E2E spec. Each source edit replaces one raw setActiveWorktree ope…
Full details: Title check

Explanation

The title names the main change: the branch picker's "Open workspace" action now opens another workspace the same way the sidebar does. The description and objectives describe the same change, so the title is accurate. The title uses a conventional-commit prefix and is 83 characters long, which is within a reasonable length.

Full details: Description check

Explanation

The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #41929), Visual Proof with before and after screenshots, Testing with the E2E test and pass/fail results, Risk with level Low and a revert plan, AI Disclosure, the agent skill boundary checkbox, Notes, and Checklist. Two gaps remain. The Testing section's manual-test box is unchecked, but the author explains this in the text. The Checklist omits the final item about pnpm lint, typecheck, test, and build, and the description does not state whether those passed. The Risk section also does not name cross-platform or SSH impact beyond a brief note. These gaps are minor, so the description is mostly complete.

Full details: Linked Issues check

Explanation

[#41929] The issue requires that Open workspace from the branch picker render a usable surface for an emptied workspace, as the sidebar does. The issue names three raw setActiveWorktree call sites: WorkspaceBranchPicker onOpenWorkspace, switchGitGraphWorkspace, and the folder workspace Source Control header open action. At head, WorkspaceBranchPicker.tsx routes openBranchWorkspace through activateAndRevealWorktree with navigationIntent 'user-open', executionHostId, and clearSidebarFilters: false. The summary reports the same activation call in git-graph-workspace-navigation.ts and FolderWorkspaceSourceControlPanel.tsx. The head-only change since the previous review adds clearSidebarFilters: false, which keeps sidebar filters intact and does not affect the reseed path. All three call sites are covered. The E2E spec asserts the reported precondition and the post-fix outcome, per the PR description. I did not run the test. I did not read activateAndRevealWorktree, so its reseed behavior rests on the issue text and the PR description. The git-graph and folder-panel edits rest on the AI summary; the diff tool was unavailable, so I could not confirm those hunks directly.

Full details: Out of Scope Changes check

Explanation

The changed files are WorkspaceBranchPicker.tsx, git-graph-workspace-navigation.ts, FolderWorkspaceSourceControlPanel.tsx, and the new E2E spec. Each source edit replaces one raw setActiveWorktree open call with activateAndRevealWorktree and the same user-open intent. Each change matches a call site named in #41929. The clearSidebarFilters: false option is part of the same call and is not described in the PR description. It preserves existing sidebar filter state, so it stays within the open action. No unrelated change was identified. The diff tool was unavailable for the incremental range, so the git-graph and folder-panel hunks rest on the summary.

  • 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

Recent 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: 66ffcf5d-a038-4b33-bec1-067c43a74cce
Commits

Reviewing files that changed from the base of the PR and between 66822c8 and af93330.

Files selected for processing: 4

  • src/renderer/src/components/editor/git-graph/git-graph-workspace-navigation.ts
  • src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx
  • src/renderer/src/components/right-sidebar/source-control/branches/WorkspaceBranchPicker.tsx
  • tests/e2e/branch-picker-open-workspace.spec.ts

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

…ke the sidebar

Open workspace in the branch picker, Git Graph's open-workspace action and
the folder workspace Source Control header called the raw setActiveWorktree.
A workspace whose tabs were closed on purpose then had no surface and the
window stayed blank. Use activateAndRevealWorktree with the user-open intent,
the same activation the sidebar uses, while keeping the sidebar filters.

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the mancunianez/fix-chat-ui-branch branch from 66822c8 to af93330 Compare November 14, 2026 01:41
@nwparker
nwparker merged commit 762f7bf into stablyai:main Nov 14, 2026
48 checks passed
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]: Open workspace in the branch picker lands on a blank window when that workspace's tabs were closed

2 participants