Skip to content

perf(wsl): fold the first libc probe into the WSL host facts exec - #35324

Merged
nwparker merged 2 commits into
mainfrom
nwparker/wsl-facts-fold-libc
Oct 28, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/wsl-facts-fold-libc

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​48 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37

ELI5

Since #35070, connecting to a WSL distro reads the kernel version, home folder and platform in one trip into the distro. This adds the C-library check (ldd --version) to that same trip, so each connect makes one fewer trip before the server starts.

What Changed

  • WSL_HOST_FACTS_COMMAND now ends with printf '\n__ORCA_WSL_LIBC__\n'; LC_ALL=C ldd --version 2>&1 || true. readWslHostFacts accepts the libc section only in its exact place: a blank line, then the marker line. Everything after the marker is the probe's output, so a multi-line answer such as musl's stays whole. Output missing that section fails the shape, and everything falls back to separate probes, as before.
  • resolveOrcadRemoteContext's fifth parameter is now an options object: known: { loginHome?, firstLibcProbeOutput? }. It replaces perf(wsl): read the kernel, login home and platform in one exec #35070's knownLoginHome string, whose only caller is the WSL path. firstLibcProbeOutput answers exactly one call of the libc probe's first command (LINUX_LIBC_FIRST_PROBE, now exported). If that output proves nothing, the probe's fallbacks (getconf, loaders) still run over the transport.
  • The WSL caller passes the libc output only when the same exec also proved the platform.

Why

Lead decision: batch (a′) of the pre-launch batching proposal. It is low-risk and WSL-only. Batches (b) and (c) stay held because they touch shared SSH fence code.

SSH blast radius: no behavior change. SSH callers pass no known facts, so resolveOrcadRuntimeTarget keeps its default exec, and the probe text is unchanged. The shared files only gain an export and an optional parameter.
Flag-off: no change. The facts exec runs only on the WSL host deploy path (ORCA_INTERNAL_WSL_HOSTS).
User-risk: low. The same probe runs, in the same shell as the other facts. A misparse falls back to the old separate probes.

Linked Issue

Internal WSL-via-orcad tracker, D3 bar (restart → first usable prompt).

Visual Proof

N/A: no UI.

Testing

  • orcad-remote-primitives.test.ts: a folded glibc answer yields linux-x64-glibc with no ldd exec. An unhelpful folded answer still runs the getconf fallback, and doesn't re-run ldd.
  • wsl-orcad-held-context.test.ts: a multi-line musl answer is kept whole; output without the libc section is rejected; the context receives { loginHome, firstLibcProbeOutput }; fallbacks pass no libc. The real-sh shape test still parses.
  • src/main/wsl, managed-server, ssh and node-runtime suites: 4379 passed. pnpm tc, typecheck:ci, code-quality, anti-slop and ast-grep pass.
  • Automated tests added/updated

Status

Ready for e9-reviewer. The lane re-measure is this PR's WSL2 run: preLaunchCommands should drop from 20 to 19.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A for visuals with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered (SSH passes no known facts)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (CI runs the rest)

The WSL connect's facts exec now also runs the libc probe's first command after its own marker.
resolveOrcadRemoteContext takes it (with the login home) as a known fact, answering that one
probe; the fallbacks still run over the transport if it proves nothing. One fewer serial guest
round trip per connect; SSH passes no known facts, so its probes are unchanged.
@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: ready for e9-reviewer. Head 69fe0b0.

Checks run: pnpm tc, typecheck:ci, code-quality:changed, anti-slop, oxlint, ast-grep, plus the wsl, managed-server, ssh and node-runtime suites (4379 passed).

Lane re-measure: this PR's WSL2 run. Expect preLaunchCommands to go from 20 to 19.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

The PR folds the first libc probe into the WSL host-facts command, avoiding one separate command before server startup.

  • WSL connections reuse the first libc probe from the host-facts command.

Reviews (2) · Last reviewed commit: "fix(wsl): run the libc fallbacks through..." · Reviewed by Greptile

With a folded first answer, the remaining libc probes used the fenced orcad runner; they now
use the same plain execCommand the default probe does, so they match main exactly.
@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: e9-reviewer's LOW is fixed. Head e749b0f.

The libc fallbacks now run through execCommand(connection, command, { signal }), the same as the default probe. A test asserts the getconf fallback uses that exact call.

Checks run: pnpm tc, typecheck:ci, code-quality:changed, anti-slop, oxlint, ast-grep, plus the touched suites (134 passed).

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 31 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: d3c60ecf-2858-4813-8b66-5c3a052b020a
Commits

Reviewing files that changed from the base of the PR and between 69fe0b0 and e749b0f.

Files selected for processing: 2
  • src/main/managed-server/install/orcad-remote-context.ts
  • src/main/managed-server/install/orcad-remote-primitives.test.ts

No actionable comments were generated in the recent review.

Recent 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: 10f5b22b-86e3-4423-9619-877d35fdc445
Commits

Reviewing files that changed from the base of the PR and between f70c29b and 69fe0b0.

Files selected for processing: 6
  • src/main/managed-server/install/orcad-remote-context.ts
  • src/main/managed-server/install/orcad-remote-primitives.test.ts
  • src/main/node-runtime/linux-libc-probe.ts
  • src/main/wsl/wsl-orcad-deploy.test.ts
  • src/main/wsl/wsl-orcad-held-context.test.ts
  • src/main/wsl/wsl-orcad-held-context.ts

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

Walkthrough

The WSL host-facts command now captures Linux libc probe output, and the parser returns it with the other host facts. The held-context path passes that output to remote context resolution. The resolver can use it for the first matching libc probe while continuing to execute other commands remotely. Tests cover recognized glibc output, fallback probing, and host-facts parsing.

Priority: Pending latest changes

Merge Risk: Minimal · previous review 69fe0

WSL reuses the first libc probe while retaining fallback detection. No merge-blocking issue was established.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the change, motivation, scope, testing, and compatibility impact. However, the required Linked Issue section does not contain an actual issue link or Fixes #<issue> referenc… Add the actual linked issue using the required format, such as Fixes #12345. Add or explicitly complete the omitted template sections, including AI Disclosure, Review, Agent skill upstream boundary, and Notes, if applicable.
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: batching the first libc probe into the WSL host-facts execution. It is concise and specific.
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 explains the change, motivation, scope, testing, and compatibility impact. However, the required Linked Issue section does not contain an actual issue link or Fixes #&lt;issue&gt; reference, and several template sections are omitted.

Resolution

Add the actual linked issue using the required format, such as Fixes #12345. Add or explicitly complete the omitted template sections, including AI Disclosure, Review, Agent skill upstream boundary, and Notes, if applicable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. 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 5 functions across 6 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 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.

@nwparker
nwparker merged commit a55bfbb into main Oct 28, 2026
76 of 78 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