Skip to content

fix(wsl): Commits history wakes a stopped distro only on the user's own act - #35854

Merged
nwparker merged 2 commits into
mainfrom
nwparker/wsl-git-history-wake
Oct 29, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/wsl-git-history-wake

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​81 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​17

Flag-off: applies with the flag on or off, to Commits history on any WSL worktree (bridge or WSL host).
User-risk: Low.

  • Opening a workspace whose WSL distro is stopped no longer starts it just to show Commits. The panel shows the existing stopped-distro error instead.
  • The user's own switch to the workspace, a click to expand Commits, or the Refresh button still starts it.

ELI5

Orca must start a stopped WSL distro only when you ask (rule E9). The Commits list counted every time it appeared as you asking: a remount, a restored panel, or Orca re-showing the sidebar. Now only a real action counts: switching to that workspace, opening Commits, or pressing Refresh.

What Changed

  • Before: use-git-history.ts loaded history with wakeWslDistro: true whenever its effect ran with Commits expanded and visible. That covered a mount, a remount, a worktree change, Orca hiding and re-showing the sidebar, and a base-ref or owner change.
  • After: that load wakes only when one of these holds:
    1. The user expanded Commits. That means expanded now, collapsed at the previous run, in the same worktree. "Expanded at mount" is restored state. Collapsed sections are stored per worktree, so switching to a worktree whose saved view has Commits open doesn't count either.
    2. The user switched to the workspace. fix(wsl): a passive restore never starts a stopped WSL distro; its bridge panes wait with Start #35813's shared takeWorkspaceSwitchWake(worktreeId, 'git-history', { withinMs: 10_000 }) is true once per switch, within the same window fix(wsl): a passive restore never starts a stopped WSL distro; its bridge panes wait with Start #35813 uses for restored panes.
  • Every other load is background. The Refresh button keeps its explicit { wakeWslDistro: true }.

Why

Linked Issue

Internal WSL tracker, E9. This was taken over from wsl-e9-preflight's queue and follows #35813.

Visual Proof

N/A: no visual change. A stopped distro shows the existing error state.

Testing

use-git-history-wsl-wake.test.tsx has five tests, all of which fail with the change reverted:

  • a mount or remount with Commits open stays background;
  • a noted user switch wakes once, and a remount after it doesn't;
  • a user expand wakes, while an Orca hide and re-show plus a ref refresh don't;
  • another worktree's restored expanded view doesn't wake;
  • Refresh still wakes.

Also run:

  • the source-control suites and workspace-switch-user-act tests pass (479);

  • the load rule: pnpm tc, typecheck:ci, check:code-quality:changed, the anti-slop lint and the ast-grep gates.

  • I manually tested these changes locally

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

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

  • Renderer only, with no wire change. SSH and runtime-host repos read history on their owner, as before. The wake flag only matters for WSL.

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)
  • 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 Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The history hook now requests a WSL wake for automatic loads only after a qualifying workspace switch or a Commits expansion in the same worktree. Mounts, restored expansion state, sidebar re-shows, and background refreshes do not enable the wake option. Tests cover these cases and confirm that an explicit refresh can still request a wake.

Priority: Low

Merge Risk: Low · up to b00b3

Re-showing Commits can unexpectedly start a stopped WSL distro in two narrow cases. The change is mergeable with bounded follow-up.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title follows the conventional commit format and names the主要 change: Commits history wakes a stopped WSL distro only on the user's own action. It matches the raw summary, which describes gating th…
Description check Passed The description covers most template sections: ELI5, What Changed, Why, Testing, Review, Notes, and Checklist are filled in with specific before/after behavior and mechanism. The Linked Issue section …
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Title check

Explanation

The title follows the conventional commit format and names the主要 change: Commits history wakes a stopped WSL distro only on the user's own action. It matches the raw summary, which describes gating the wake to expand, workspace switch, and Refresh. It is specific and single-sentence, though it is somewhat long at 75 characters.

Full details: Description check

Explanation

The description covers most template sections: ELI5, What Changed, Why, Testing, Review, Notes, and Checklist are filled in with specific before/after behavior and mechanism. The Linked Issue section is weak. It says 'Internal WSL tracker, E9' and does not contain a 'Fixes #' issue reference, which the template requires for outside contributors. The Visual Proof section is marked N/A with a reason. Manual testing is unchecked, and the final lint/typecheck/test/build checkbox is unchecked. The AI Disclosure section is blank.

Resolution

Optionally, add a real issue reference in the Linked Issue section (replace 'Internal WSL tracker, E9' with 'Fixes #NNN' or explain why no public issue exists). Also, check the manual testing box or state that manual testing was not done, and complete the AI Disclosure section if applicable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The change is limited to WSL wake requests from the Commits history panel.

The PR still needs the previously reported fix to prevent background reads from waking WSL again.

Findings

  1. P1 Background reads wake WSL again ▶

Summary

Commits history now requests a WSL wake for a same-worktree expansion or a recorded user switch, rather than every visible load.

  • Commits history wakes a stopped WSL distro only after a user action.

Reviews (2) · Last reviewed commit: "test: a mount and a base-ref move read C..." · Reviewed by Greptile

Comment on lines +170 to +175
const userAct =
userExpanded ||
(activeWorktreeId !== null &&
takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', {
withinMs: SWITCH_MOUNT_WINDOW_MS
}))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Background reads wake WSL again

When the user switches to a workspace with Commits collapsed, then expands it within ten seconds, userExpanded || ... skips takeWorkspaceSwitchWake. The switch stays unused. A later compareBaseRef change or sidebar re-show within that window sends wakeWslDistro: true again without another user action. If the user has stopped the distro meanwhile, that background read starts it again.

Call takeWorkspaceSwitchWake even when userExpanded is true, then combine both results.

Suggested change
const userAct =
userExpanded ||
(activeWorktreeId !== null &&
takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', {
withinMs: SWITCH_MOUNT_WINDOW_MS
}))
const switchWake =
activeWorktreeId !== null &&
takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', {
withinMs: SWITCH_MOUNT_WINDOW_MS
})
const userAct = userExpanded || switchWake

…wn act

Showing Commits woke the distro on every mount, remount and re-show. Now
only the user expanding Commits in the same worktree, or the user's own
switch to the workspace (once per switch), may start it; the Refresh
button keeps its explicit wake (E9).
#35778's base-move refetch test expected every shown-history read to
wake a stopped WSL distro; only the user's own act does now.
@nwparker
nwparker force-pushed the nwparker/wsl-git-history-wake branch from 4eb18fe to b00b3dd Compare October 29, 2026 09:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


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: 2d897c5c-53b8-4ffc-85c8-1005bd114e50
Commits

Reviewing files that changed from the base of the PR and between 401468b and b00b3dd.

Files selected for processing: 3
  • src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-wsl-wake.test.tsx
  • src/renderer/src/components/right-sidebar/source-control/sync/use-git-history.ts
  • src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx

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

Comment on lines +170 to +175
const userAct =
userExpanded ||
(activeWorktreeId !== null &&
takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', {
withinMs: SWITCH_MOUNT_WINDOW_MS
}))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Consume the switch when expansion already requests a wake.

If the user switches to a workspace while Commits is collapsed and then expands Commits, userExpanded skips takeWorkspaceSwitchWake. The switch remains available. A sidebar re-show within 10 seconds then requests another wake, although that load should stay in the background. Check and consume the pending switch before combining it with userExpanded. (raw.githubusercontent.com)


Minor · Functional Correctness · Quick win

Consume the workspace switch wake while the sidebar is hidden.

When the sidebar is hidden, the combined visibility guard returns before takeWorkspaceSwitchWake. The switch wake can then remain pending until the sidebar is shown again, causing that re-show load to wake a stopped WSL distro. Consume the wake only in the hidden-sidebar branch. Keep the separate history-visibility guard so delayed history visibility does not consume it.

Suggested fix
-    if (!isBranchVisible || !isGitHistoryExpanded || !isGitHistoryVisible) {
+    if (!isBranchVisible) {
+      if (activeWorktreeId !== null) {
+        takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', {
+          withinMs: SWITCH_MOUNT_WINDOW_MS
+        })
+      }
+      return
+    }
+    if (!isGitHistoryExpanded || !isGitHistoryVisible) {
       return
     }

@nwparker
nwparker merged commit cd821ab into main Oct 29, 2026
41 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.

1 participant