Skip to content

refactor(preflight): rename execCommandInWsl to execCommandInWslOrThrow - #17375

Merged
nwparker merged 1 commit into
mainfrom
nwparker/exec-command-or-throw-v2
Aug 30, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/exec-command-or-throw-v2

Conversation

@nwparker

@nwparker nwparker commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

Why

Orca has a recurring WSL bug class: a probe that cannot reach its distro returns the same value as one that asked and got "no". It has shipped three times — the preflight CLI cache (#17350), the glab auth status VM wakeups (#8941), and listRunningWslDistrosAsync failing closed (#17072).

execCommandInWsl throws on failure, and its callers wrap it like this:

try {
  await execCommandInWsl(target, `${shellQuote(command)} --version`)
  return true
} catch {
  return false // "not installed" and "could not ask" are now the same value
}

Naming it ...OrThrow puts the throwing contract in front of whoever writes that catch, so the swallow is visible at the call site rather than something you have to go read the callee to discover. It pairs with the ratchet and reference doc added in #17352.

Change

Pure mechanical rename — no behaviour, signature, or error-handling changes.

  • src/main/ipc/preflight-command-exec.ts — export renamed, both internal call sites updated, doc comment now states the throwing contract and that callers must distinguish "absent" from "unreachable".
  • src/main/preflight/agent-detection.ts — import + 2 call sites (gh auth status, glab auth status).
  • docs/reference/wsl-probe-failure-semantics.md — the canonical example now shows the name a reader will actually grep for.

5 call sites total. No test changes needed — mocks target the module, not this symbol.

Follow-up, deliberately not here

execLocalPreflightCommand (same file) has the identical throwing contract and sits in the same try { … } catch { return false } blocks. After this rename the pair reads inconsistently — one says OrThrow, the other doesn't, while both collapse to a silent false. Worth its own small PR; kept out to keep this diff mechanical.

Verification

  • pnpm run typecheck (full, not just tc:node) — clean
  • pnpm test src/main/ipc/preflight src/main/wsl/wsl-probe-failure-semantics.test.ts — 83 passed / 1 skipped
  • oxlint on both changed source files — clean

Pure rename, no behavior change. Callers like isCommandAvailable and
isCommandOnPath wrap this in try { ... return true } catch { return false },
collapsing "distro unreachable" and "command absent" into the same value —
a recurring bug class in this subsystem (see
docs/reference/wsl-probe-failure-semantics.md). The OrThrow suffix makes
that swallow visible at the call site instead of implicit in the function
name, so a reviewer notices when a new caller does the same collapse.
@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR mechanically renames the internal WSL command executor to make its throwing contract explicit, without changing runtime behavior.

  • Renames execCommandInWsl to execCommandInWslOrThrow.
  • Updates all internal imports and call sites.
  • Clarifies the throwing contract in source documentation.
  • Updates the canonical WSL probe failure-semantics example.

Confidence Score: 5/5

The PR appears safe to merge because the rename is complete and introduces no behavioral change.

All repository references to the internal executor use the new name, with no stale imports, re-exports, mocks, configuration references, or public API exposure identified.

Important Files Changed

Filename Overview
src/main/ipc/preflight-command-exec.ts Renames the exported WSL executor and its two internal references while preserving its implementation and signature.
src/main/preflight/agent-detection.ts Updates the import and both authentication-probe call sites to use the renamed executor.
docs/reference/wsl-probe-failure-semantics.md Updates the documented failure-semantics example to use the new symbol name.

Reviews (1): Last reviewed commit: "refactor(preflight): rename execCommandI..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f2582c5b-da06-4393-b9a6-be8f182c5509

📥 Commits

Reviewing files that changed from the base of the PR and between 58a52a8 and 32db368.

📒 Files selected for processing (3)
  • docs/reference/wsl-probe-failure-semantics.md
  • src/main/ipc/preflight-command-exec.ts
  • src/main/preflight/agent-detection.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The WSL command helper is renamed to execCommandInWslOrThrow, with documentation that it throws on all failures. Command availability and path checks use the renamed helper. WSL GitHub and GitLab authentication probes also use it. The documentation example now demonstrates catching probe failures and returning false.

Merge Risk: ⚪ Minimal · up to 32db3

This PR only renames a throwing WSL command helper and updates its references and documentation without changing behavior; the reported checks are clean, and no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the motivation, scope, affected files, follow-up boundary, and verification. However, it omits several required template sections, including ELI5, Linked Issue with a … Complete the required template sections. Add an ELI5 summary, a Linked Issue using the required Fixes # format, Visual Proof with N/A and a reason if applicable, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist…
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: renaming execCommandInWsl to execCommandInWslOrThrow.
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: Description check

Explanation

The description clearly explains the motivation, scope, affected files, follow-up boundary, and verification. However, it omits several required template sections, including ELI5, Linked Issue with a Fixes # entry, Visual Proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist.

Resolution

Complete the required template sections. Add an ELI5 summary, a Linked Issue using the required Fixes # format, Visual Proof with N/A and a reason if applicable, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist. Keep the existing change and verification details.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Export renamed to execCommandInWslOrThrow — the throwing contract is now in the name, with a concise doc comment stating that an unreachable distro and a genuinely missing command both throw and must not be collapsed into "absent".
  • Call sites updated — both internal call sites in preflight-command-exec.ts (isCommandAvailable, isCommandOnPath) and the two gh/glab auth-status call sites in agent-detection.ts now use the new name.
  • Reference doc aligned — the canonical example in docs/reference/wsl-probe-failure-semantics.md shows the name a reader will actually grep for.

I confirmed the rename is complete (no remaining references to execCommandInWsl), the new doc comment matches the throwing behavior in runPreflightCommandInWsl (throws on timeout and non-zero exit), and no tests reference the symbol directly — the mocks target ./preflight-wsl-command, so the claim that no test changes are needed holds.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 1215cc9 into main Aug 30, 2026
50 of 52 checks passed
@nwparker
nwparker deleted the nwparker/exec-command-or-throw-v2 branch August 30, 2026 08:53
nwparker added a commit that referenced this pull request Aug 30, 2026
…17380)

Sibling of execCommandInWslOrThrow (#17375) with the identical throwing
contract, sitting in the same `try { ... } catch { return false }`
blocks. After that rename the pair read inconsistently — one announced
that it throws, the other did not, while both collapse to a silent
false at the call site.

Also states the contract in a doc comment: it rejects rather than
reporting "absent", so a caller that swallows the rejection makes "not
installed" and "could not run it" the same answer.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ow (stablyai#17375)

Pure rename, no behavior change. Callers like isCommandAvailable and
isCommandOnPath wrap this in try { ... return true } catch { return false },
collapsing "distro unreachable" and "command absent" into the same value —
a recurring bug class in this subsystem (see
docs/reference/wsl-probe-failure-semantics.md). The OrThrow suffix makes
that swallow visible at the call site instead of implicit in the function
name, so a reviewer notices when a new caller does the same collapse.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#17380)

Sibling of execCommandInWslOrThrow (stablyai#17375) with the identical throwing
contract, sitting in the same `try { ... } catch { return false }`
blocks. After that rename the pair read inconsistently — one announced
that it throws, the other did not, while both collapse to a silent
false at the call site.

Also states the contract in a doc comment: it rejects rather than
reporting "absent", so a caller that swallows the rejection makes "not
installed" and "could not run it" the same answer.
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