Skip to content

fix(wsl): re-read a paired host's refused default base ref, and close the signal race - #35812

Merged
nwparker merged 1 commit into
mainfrom
nwparker/e9-base-ref-paired-refetch
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/e9-base-ref-paired-refetch

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​141 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​66 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​45

ELI5

#35778 stopped Orca from starting a stopped WSL distro just to show a repo's default branch. It reloads that branch once the distro runs again, but only for repos on this computer. This PR covers a repo on a paired Orca host (another machine you connect to): the client asks again until the host can answer. It also fixes a small timing gap where the "distro is running again" message could be missed.

What Changed

  • Before:
    • A client viewing a paired host's WSL repo got "unknown" for the default branch while that host's distro was stopped, and kept it until you switched repos. The host's "distro is running" message only reaches the host's own windows.
    • Locally, the renderer started listening for that message only after main had answered. A distro that started in between was missed.
  • After:
    • The host's repo.baseRefDefault read also returns which distro refused (refusedWslDistro, optional).
    • A client that can't hear the host's signal (a paired host, or the browser client) asks again when the window regains focus and every 30 s while the window is visible. It stops as soon as an answer isn't refused.
    • Locally, the listener is attached before the first read. If the distro is reported running while the read is in flight, the client reads again as soon as the refusal arrives.
  • Mechanism: watchRuntimeRepoBaseRefDefault in runtime-repo-client.ts, which both Settings and Source Control already use. RuntimeRepositoryRefQueries.getDefault returns the new field.

Why

Re-asking is cheap and safe. The host's check lists running distros at most once a minute, from a shared lease, and never starts one. A new host-to-client push stream would need capability negotiation with older peers, and no existing host status push carries WSL distro state. A bounded re-poll that only runs while a refusal is showing is the smallest change that recovers the value.

Attaching the listener first, and remembering signals that arrive while a read is in flight, closes the race without an extra round trip to main. It can't loop, because each read only re-asks for signals seen during that read.

Flag-off: the gate doesn't change; this only changes when an already-refused value is asked for again.
User-risk: while a paired host's distro stays stopped, a client re-asks every 30 s while the page is visible and on focus. Each re-ask costs the host at most one shared wsl --list --running per minute and never starts the distro.

Linked Issue

Fixes #

Visual Proof

N/A. No new UI. The existing unknown state is replaced by the real value once the distro runs.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

runtime-repo-base-ref-default-wsl-retry.test.ts:

  • Local:
    • It reads again when the refusing distro runs.
    • It reads again when the distro started while main was answering. Removing the in-flight tracking makes this test fail.
    • It ignores other distros, doesn't re-ask after an answer that wasn't refused, and stops when cancelled.
  • Paired host:
    • It re-asks on focus.
    • It re-asks every 30 s only while visible, and stops once answered (fake timers).
    • It stops when cancelled.
    • The browser client, which has no running signal, falls back to polling.

base-ref-default-wsl-gate.test.ts: the runtime read returns refusedWslDistro when blocked.

Local checks: pnpm tc, typecheck:ci, check:code-quality:changed and anti-slop oxlint pass.

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

  • Remote compatibility: refusedWslDistro is a new optional field in an RPC result. Older clients ignore it and show unknown, as they do today. Params are unchanged.
  • Mobile: its reader keeps only defaultBaseRef, so it's unchanged.
  • SSH and folder repos: unchanged, never refused.

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)

… the signal race

A paired host's repo.baseRefDefault now names the stopped distro that refused
it. Clients that cannot hear that host's running signal re-ask on window
focus and every 30 s while visible, until it answers. Locally, the running
listener is attached before the first read, so a signal that lands while main
is answering triggers a re-read instead of being lost.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 4c96fd81-afaf-4eae-bf34-daea28e6643d
Commits

Reviewing files that changed from the base of the PR and between 6de2007 and 6a5e781.

Files selected for processing: 4
  • src/main/ipc/repos/base-ref-default-wsl-gate.test.ts
  • src/main/runtime/runtime-repository-ref-queries.ts
  • src/renderer/src/runtime/runtime-repo-base-ref-default-wsl-retry.test.ts
  • src/renderer/src/runtime/runtime-repo-client.ts
  • 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: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Makes refused default-branch reads recover for paired hosts and closes the local signal race.

  • A refused default-branch read refreshes when its WSL distro can answer.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Listen before reading] --> B[Read default branch]
  B --> C{Read refused?}
  C -->|No| D[Show result; stop polling]
  C -->|Yes| E{Can hear host signal?}
  E -->|Yes| F[Wait for matching running signal]
  F --> B
  E -->|No| G[Retry on focus or visible 30-second tick]
  G --> B
  C -->|Matching signal arrived during read| B
Loading

Reviews (1) · Last reviewed commit: "fix(wsl): re-read a paired host's refuse..." · Reviewed by Greptile

@nwparker
nwparker merged commit 21fdaee into main Oct 29, 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.

1 participant