Skip to content

fix(source-control): open reused Git graph in the split target when the workspace does not show it yet - #50017

Merged
nwparker merged 1 commit into
stablyai:mainfrom
TuanNancy:followup/graph-tab-reuse
Nov 26, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
TuanNancy:followup/graph-tab-reuse

Conversation

@TuanNancy

@TuanNancy TuanNancy commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

If you hold Cmd (or Ctrl) and click the Graph button on a repo card in a folder workspace, Orca should open the Git graph in a new side-by-side pane. But if that repo's graph was already open somewhere else (for example in the repo's own worktree), Orca ignored the request and put the graph in the pane you were already using. Now it opens in the new side pane as asked. If the graph is already showing in the current workspace, Orca just jumps to it, as before.

What Changed

  • Before: in openGitGraph (src/renderer/src/lib/source-control/graph/git-graph-tab.ts), the branch for a graph whose file is already in openFiles called openWorkspaceEditorItem(...) without a target group. The lazy split resolver (resolveTargetGroupId, passed by the repo card's modifier-click) never ran, so the tab landed in the active group.
  • After: that branch first checks whether the placement workspace already shows a git-graph tab with the same entityId.
    • If it does, no target is passed. openWorkspaceEditorItem activates the existing tab and no empty split is created.
    • If it does not, the resolver runs and its group id is passed as targetGroupId, so the new tab lands in the split.
  • openWorkspaceEditorItem now gets useAppStore.getState() read after the resolver runs. The resolver can create the split group through createEmptySplitGroup, and the ORCA_LAYOUT_OWNER=main path checks the target group against the state it is given.
  • New test in git-graph-tab.test.ts: open a child repo's graph in the child worktree, then split-open it from the folder. The folder tab must land in the split group, and opening it again must not call the resolver a second time, so no extra empty split appears.

Why

A split-open should always put the reused graph in the group the caller asked for. Skipping the resolver on the reuse path was left over from the two-argument API in #49629. Running the resolver only when a new tab will actually be drawn keeps the existing "jump to the open tab" behavior and avoids leaving empty splits.

Linked Issue

Refs #49597 (follow-up to #49629; that issue's main bug was already fixed there)

Visual Proof

N/A: this changes which pane an existing tab is placed in. It is covered by a store-level test that fails on main ("expected vi.fn() to be called 1 times, but got 0 times") and passes with this change. No visual design changes.

Testing

  • Reproduced on main: with main's git-graph-tab.ts restored, the new test fails because the resolver is never called. With this change it passes.
  • Extra probes (not committed):
    • Graph already shown in the folder: no resolver call and no new split (same on both).
    • Graph reopened in its own worktree: no split (same on both).
    • Graph open only in the folder, then reopened from the child: lands in the split (fails on main, passes here).
  • vitest on git-graph-tab.test.ts and change-scope-bar.test.tsx: 8/8 pass.
  • oxlint, oxfmt --check, anti-slop oxlint, code-quality oxlint, ast-grep, and the changed-code quality gate are all clean on the touched files.
  • Platforms: renderer store logic only, so behavior is the same on macOS, Linux and Windows. Tested with unit tests on macOS.

Performance

None that matters, because this only runs when the user clicks the Graph button. That is a renderer click handler, not a hot path. It adds one .some() over the placement workspace's tabs (openWorkspaceEditorItem already does the same scan) plus one O(1) useAppStore.getState(). Measured cost of the extra scan per click: 0.11 us with 10 tabs, 1.3 us with 1,000 tabs, and about 1.8 ms with 100,000 tabs (adversarial). All are well under 16 ms. There is no new I/O, IPC, polling or subprocess work.

Risk

Level: Low. Only the git-graph reuse path changes. Callers that pass no resolver behave exactly as before. The change-scope-bar resolver always returns undefined, so it is unchanged too. The riskiest part is the placementHasTab check. If it disagreed with openWorkspaceEditorItem's own lookup, an empty split could be left behind. Both use the same entityId match, and the test checks that a second open does not split again. SSH, WSL and mobile are not affected, because host routing is untouched. To back it out, revert this commit.

Review

  • Correctness: the resolver runs only when a new tab will be drawn, so it does not create empty splits.
  • Cross-platform, remote/SSH, mobile: renderer layout state only, no change.
  • Security: none.

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

Original fix by @TuanNancy in #50017. Their authorship is kept through the Co-authored-by trailer.

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)

@TuanNancy

Copy link
Copy Markdown
Contributor Author

CI note: only CodeRabbit has completed on this PR; the required workflows appear not to have started yet, which matches the first-time-contributor action_required gate. Maintainer: please approve the workflow run when convenient. Local pnpm check:changed passes and no further code changes are needed from me at this point.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

For an existing open-file entry, openGitGraph checks whether the placement workspace has a Git Graph tab with the same entity ID. If one exists, it skips target-group resolution. Otherwise, it resolves the target group and passes it with freshly read app state to openWorkspaceEditorItem. The added test checks that repeated opens resolve the split target once and place the target graph tab in that group.

Merge Risk: Minimal · up to 45ac4

This fixes where a child repository's Git Graph tab opens when it is already open and a split is requested. It is narrow, covered by a test, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

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 names the fix (reused Git graph opens in the split target when the workspace does not show it yet), which matches the main change in git-graph-tab.ts and its new test. It is long (17 words) …
Description check Passed The description follows the repository template and fills in ELI5, What Changed, Why, Linked Issue, Visual Proof (N/A with reason), Testing, Performance, Risk (Low, with rollback), Review, Agent skill…
Full details: Title check

Explanation

The title names the fix (reused Git graph opens in the split target when the workspace does not show it yet), which matches the main change in git-graph-tab.ts and its new test. It is long (17 words) but specific and accurate.

Full details: Description check

Explanation

The description follows the repository template and fills in ELI5, What Changed, Why, Linked Issue, Visual Proof (N/A with reason), Testing, Performance, Risk (Low, with rollback), Review, Agent skill boundary, Notes, and Checklist. The Linked Issue uses 'Refs #49597' rather than a 'Fixes #' closing link, and the template asks for an issue to always be linked. The 'Level' and AI Disclosure sections are present. The final checklist item for pnpm lint/typecheck/test/build is unchecked, which the template allows when CI covers it. The Testing section lists no manual test on Linux or Windows, but states the platform used.

  • 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: d4a3ad1a-ee61-49bd-9efe-16291603ad73
Commits

Reviewing files that changed from the base of the PR and between a5ada19 and 45ac4b1.

Files selected for processing: 2

  • src/renderer/src/lib/source-control/graph/git-graph-tab.test.ts
  • src/renderer/src/lib/source-control/graph/git-graph-tab.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.

…he workspace does not show it yet

When a child repo's Git graph file was already open but the placement
workspace (e.g. a folder workspace) had no tab for it, openGitGraph's
reuse branch never ran the lazy split resolver, so a modifier-click
opened the graph in the active group instead of a new split. Run the
resolver only when the placement workspace lacks a matching graph tab,
and pass a fresh store snapshot since the resolver may create the group.

Refs stablyai#49597

Co-authored-by: VNATdev-ops <[email protected]>
@nwparker
nwparker force-pushed the followup/graph-tab-reuse branch from a5ada19 to 45ac4b1 Compare November 26, 2026 23:15
@nwparker nwparker changed the title fix(source-control): resolve split target when reusing a folder graph fix(source-control): open reused Git graph in the split target when the workspace does not show it yet Nov 26, 2026
@nwparker
nwparker merged commit c50600c into stablyai:main Nov 26, 2026
55 checks passed
DoozyX added a commit to DoozyX/orca that referenced this pull request Nov 27, 2026
Merges stablyai/orca 7030f25 (320 commits) into fork main 3e499a0.

Conflict resolutions:
- Antigravity usage (stablyai#50137): upstream stops reading agy usage for account
  safety. Carried into the fork's per-account status bar: dropped the
  Antigravity usage menu, accounts prop and checked-item setup flag from
  AccountUsageDetailsMenu, StatusBarUsageArea, the controller and provider
  visibility (and its fork-retained test); the omp slot stays, including in
  the rate-limit full cycle and the usage-tracking doc.
- Lazy Zod schemas (stablyai#49897): took upstream's lazyZodSchema wrapping and kept
  the fork's ProjectGroupUpdate.claudeAccountId, the omp status-bar item and
  _ompStatusBarDefaultAdded, and the federated release receipt's
  currentOwnerDispatchId/terminalReleaseState. Fork-only omp usage and
  AccountHome schemas are now lazy too; baseline pruned. Feature-interaction schemas
  stay in the fork's feature-interaction-params.ts, now lazy too.
- Git graph: openGitGraph keeps the fork's options object (afterOpen) and
  takes upstream's placementWorkspaceId (stablyai#49629, stablyai#50017) as an option;
  callers and upstream's test use it. The fork's branches/tags dock passes
  the folder placement too (same bug as stablyai#49597), and it and the graph tab
  share a new useGitGraphRefsEpoch hook (keeps git-graph-tab under 400). Source control keeps the fork's
  branches/tags dock beside upstream's file-list header; fork git-graph
  rendering tests pass the new tabId.
- Claude background tasks: upstream skips ambient artifact monitors; the
  fork's monitored-work rows and untyped-row handling stay.
- Claude managed hook: local POSIX keeps the fork's runtime-home wrapped
  command; getPosixManagedEventHook takes the command, so upstream's
  PreToolUse timeout applies to both local and remote entries.
- local-worker-start: keep the fork's reminted pane handle (#29) and add
  upstream's retained-chat assertStarting and launch warnings.
- Mobile web bundle fence: keep the fork's 11.25 MiB (above upstream's
  11 MiB + 16 KiB).
- en.json: union of the fork's ProjectGroupSettingsDialog and upstream's
  AutoNameFailed keys.
- Skills: regenerate bundled guides (upstream's shared CLI paragraph), union
  the add-only digest ledger, regenerate manifest and sources.
- tracked-upstream-cache test: fixed far-future expiry instead of
  Date.now() for upstream's new wall-clock ratchet.

Claude-Session: https://claude.ai/code/session_01BPjp5wba1X5fDbTK4YStHM
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