Repository navigation
fix(wsl): Commits history wakes a stopped distro only on the user's own act - #35854
Conversation
Walkthrough
Priority: Merge Risk:
|
[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
SummaryCommits history now requests a WSL wake for a same-worktree expansion or a recorded user switch, rather than every visible load.
Reviews (2) · Last reviewed commit: "test: a mount and a base-ref move read C..." · Reviewed by Greptile |
| const userAct = | ||
| userExpanded || | ||
| (activeWorktreeId !== null && | ||
| takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', { | ||
| withinMs: SWITCH_MOUNT_WINDOW_MS | ||
| })) |
There was a problem hiding this comment.
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.
| 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.
4eb18fe to
b00b3dd
Compare
There was a problem hiding this comment.
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
Files selected for processing: 3-
src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-wsl-wake.test.tsxsrc/renderer/src/components/right-sidebar/source-control/sync/use-git-history.tssrc/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.
-
| const userAct = | ||
| userExpanded || | ||
| (activeWorktreeId !== null && | ||
| takeWorkspaceSwitchWake(activeWorktreeId, 'git-history', { | ||
| withinMs: SWITCH_MOUNT_WINDOW_MS | ||
| })) |
There was a problem hiding this comment.
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)
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 }
Flag-off: applies with the flag on or off, to Commits history on any WSL worktree (bridge or WSL host).
User-risk: Low.
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
use-git-history.tsloaded history withwakeWslDistro: truewhenever 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.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.{ wakeWslDistro: true }.Why
{ worktreeId, expanded }rather than only the expanded flag. Per-worktree collapsed state can flip on a switch with no click.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.tsxhas five tests, all of which fail with the change reverted:Also run:
the source-control suites and
workspace-switch-user-acttests 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
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)