Skip to content

Fix History tab lane focus and destructive git safety#349

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-detection-0a52
Closed

Fix History tab lane focus and destructive git safety#349
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-detection-0a52

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 23, 2026

Bug and impact

  1. Broken commit deeplinks — Navigating to /history?surface=commits&laneId=…&commitSha=… (e.g. Activity “View commit”) called setSelectedCommitSha and then setFocusLaneId, which always clears commit selection. Users landed on the lane with no commit focused; shareable links were unreliable.

  2. Destructive git on the wrong lane — History keeps its own focusLaneId, independent of the globally selected lane. After switching lanes on Lanes/Work and returning to History, hard reset / force-push / lane delete could target the previously focused lane while the user believed they were on the current selection.

  3. Destructive git with missing worktree — Commit and lane git menus treated hasWorktree / hasLane as Boolean(laneId) even when the lane record had no worktree path or commit history failed with “worktree is missing”, leaving destructive actions enabled in the UI.

Root cause

  • Redundant setFocusLaneId after commit URL hydration in HistoryPage.
  • No resync of History focus lane when the tab becomes active.
  • Worktree availability not derived from lane metadata or load errors.

Fix

  • Stop re-focusing the lane after applying commitSha from the URL (lane is already set earlier in hydration).
  • When History is active and URL does not own lane/commit-only deeplink state, align focusLaneId with selectedLaneId.
  • Pass laneHasWorktree from lane metadata; disable commit context actions when worktree is missing or load reports it.

Validation

  • npm run test -- --run src/renderer/components/history/historyGitActions.test.ts src/renderer/components/history/historyUrlHydration.test.ts src/renderer/components/history/historyLaneActions.test.ts (28 passed)

Related open PRs (not duplicated)

Open in Web View Automation 

Opening History with both laneId and commitSha cleared the selected commit
because setFocusLaneId ran after setSelectedCommitSha. Sync focus lane with
the globally selected lane when returning to History (unless URL drives
state), and gate commit/lane git actions on an actual worktree path.

Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored May 23, 2026 9:12am

@arul28
Copy link
Copy Markdown
Owner

arul28 commented May 25, 2026

Consolidated into #356.

@arul28 arul28 closed this May 25, 2026
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