Skip to content

ci(ssh): Windows SSH-host lanes (inbox + preview OpenSSH) for the pinned relay - #24180

Merged
OrcaWin merged 13 commits into
mainfrom
OrcaWin/node-rt-p2-winhost
Oct 1, 2026
Merged

OrcaWin merged 13 commits into
mainfrom
OrcaWin/node-rt-p2-winhost

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​503 $\color{#cf222e}{\Huge{\mathbf{−}}}$​234 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​269
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1548 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1539

ELI5

This adds CI tests that use Windows runners (x64 and arm64) as SSH hosts, with both the inbox and the preview OpenSSH servers. Each one checks that Orca's pinned node.exe relay installs and works with no Node, npm or compiler on the SSH path.

What Changed

  • Workflow ssh-windows-hosts.yml: 4 jobs covering {windows-2022, windows-11-arm} × {inbox, preview}. It runs on path-filtered, non-draft PRs and on manual dispatch.
  • Harness: imports the Windows OpenSSH provisioning harness from OrcaWin/np-windows-ssh-provider-diagnostic (attributed in the commit) and extends it:
    • a private sshd bound to 127.0.0.1 with a pinned host key;
    • one standard account per cell, so each cell starts with an empty runtime store;
    • key auth;
    • both DefaultShell cases, PowerShell and cmd;
    • a service PATH that drops node, npm and compilers and puts logging .cmd stand-ins first.
  • Checks:
    • rung A on the pinned node.exe;
    • a ConPTY self-test with the bundled conpty.dll;
    • terminal echo;
    • runtime reuse;
    • store cleanup that keeps the runtime in use;
    • the SHA-256 of node.exe and the slot files.
  • Driver: the hostile-host driver is now host-agnostic.

Why

This covers the Windows part of the Phase 2 exit gate (preview and inbox OpenSSH) on CI runners, without the shared awin machine.

Linked Issue

Part of the Node runtime plan (Phase 2). Stacked on #24149.

Visual Proof

N/A. This is CI only.

Testing

  • The new pieces have unit tests and parse checks.

  • Fixed in review: PATH entries on drives that don't exist, and removing temporary folders with the Windows-safe helper.

  • Green on all 4 jobs (run 36759401774): x64 and arm64, each with inbox and preview OpenSSH.

  • Fixed along the way:

    • Harness parameter shadowing, per-account authorized_keys for the inbox 8.1 server, and a stale $LASTEXITCODE.
    • Session PATH comes from the registry, so the toolchain is now hidden with ACLs.
    • Two product bugs: uploads from a symlinked, junction or 8.3 short-name root, and a relay peer end recorded as a local close.
  • Open decision: standard Windows users can't launch the relay, because WMI Win32_Process.Create is denied without Remote Enable. The lane grants that for the run and warns. We need to decide whether to keep the grant or fail the lane until the launch path is fixed.

  • I manually tested these changes locally

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

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

[High risk] Adds Windows SSH testing infrastructure and relay changes.

The PR does not yet appear safe to merge: the Windows lane can pass after granting access that a standard user lacks, and provisioning can fail when the account profile unloads.

Findings

  1. P1 Profile hive may be unavailable ▶
  2. P1 WMI fallback masks launch failure ▶
  3. P2 Slot bytes go unchecked ▶

Summary

The PR adds four Windows SSH-host CI lanes covering x64 and arm64 runners with inbox and preview OpenSSH. It provisions private SSH accounts, tests the pinned relay and runtime reuse, and adds upload and relay-close fixes. No changes to this PR’s files were made since the previous review.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CI[Windows CI runner] --> SSH[Private inbox or preview sshd]
  SSH --> Account[Standard account per cell]
  Account --> Probe[Pinned relay and terminal checks]
  Probe --> Receipts[Cell receipts]
Loading

Reviews (9) · Last reviewed commit: "test(relay): drive the peer-end listener..."

Comment on lines +251 to +254
// Every slot file the relay loads, the Windows bundled ConPTY pair included, landed beside it.
for (const file of pinnedRelayAddonFiles(target)) {
expect(await observer.isFile(`${first.deployed.remoteRelayDir}/${file}`), file).toBe(true)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Slot bytes go unchecked The test compares the uploaded node.exe against its expected SHA-256, but checks the slot files only for existence. A file with incorrect bytes can therefore pass this integrity check if the terminal probe does not use it. Comparing the remote files with the verified local artifacts would make the result meaningful.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Important

One must-fix bug: in inbox mode the provisioning script reuses $name, so both inbox jobs fail before any relay cell runs (details inline).

Reviewed changes

This run read the full 27-file diff (base OrcaWin/node-rt-p2-winhard, head eeee1400).

  • Windows SSH-host lane — new .github/workflows/ssh-windows-hosts.yml (windows-2022/windows-11-arm × inbox/preview OpenSSH) and the PowerShell provisioning harness in config/ci/windows-ssh-provider/, driven by ssh-relay-windows-host-lane.test.ts against a private loopback sshd.
  • Hostile-host Docker matrix — new .github/workflows/ssh-hostile-hosts.yml, the cell table and ladder-outcome assertions (ssh-hostile-host-cells.ts), a host-agnostic driver (ssh-hostile-host-test-harness.ts) and the Docker fixture/observer.
  • Windows session command audit — ssh-session-command-audit.ts decodes each deploy command and fails a pinned deploy that emitted Add-Type.
  • Runtime refusal reclassification (production) — ssh-relay-runtime-self-test.ts now checks the missing-library markers before Error relocating|symbol not found, so a musl host missing libstdc++.so.6 classifies as missing_lib rather than wrong_libc; the new it.each row pins it.
  • Partial orcad template — build-orcad-template.mjs gains --targets <subset> for CI jobs that fill only some prebuild slots, and verify-packaged-orcad-template.cjs narrows its inventory to the same subset while still defaulting to every target for packaging.

ℹ️ A skipped lane is green

ssh-relay-windows-host-lane.test.ts:41 wraps the whole suite in describe.runIf(RUN), and invoke-pinned-relay-cells.ps1:67-71 only inspects the vitest exit code. Running the file without ORCA_RUN_SSH_WINDOWS_HOST=1 yields 1 skipped and exit 0, so a future rename of that env var (or of the recording config) would leave the job green with zero pinned-node.exe assertions. The hostile-host matrix has the same all-skip-to-green shape via its per-cell it.skipIf. Asserting at least one test executed, or requiring the per-cell receipt, would make the lane fail closed.

Technical details
# Windows lane can pass without executing its assertions

## Affected sites
- `src/main/ssh/ssh-relay-windows-host-lane.test.ts:38,41` — `RUN` gate + `describe.runIf`
- `config/ci/windows-ssh-provider/invoke-pinned-relay-cells.ps1:67-71,89` — captures only `$LASTEXITCODE`; the per-cell receipt written at `ssh-relay-windows-host-lane.test.ts:99` is never required
- `src/main/ssh/ssh-relay-hostile-hosts.docker.test.ts:50` — `it.skipIf` per cell

## Required outcome
- A cell that is expected to run and does not (env wiring regression, all cells filtered out, recording config renamed) must fail the job rather than report success.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

}

export function parseWindowsHostCellDescriptor(text: string): WindowsHostCellDescriptor {
const parsed: unknown = JSON.parse(text.replace(/^/u, ''))

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.

This regex literal embeds a raw U+FEFF after ^ — an invisible character that matches today but is easy for an editor or formatter to strip, which would silently stop the descriptor BOM being trimmed. Prefer the explicit escape \uFEFF.

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

ℹ️ The new commit is a correct fix, but the previously reported inbox $name reuse is still present, and the self-test added here does not cover it.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (eeee1400 → 2675f0f9, 2 files).

  • Private-account list rename — prove-preview-openssh.ps1 renames the account list to $ownedAccounts so it no longer collides with the case-insensitive [int]$Accounts parameter, which had made every Windows host job die before provisioning.
  • Parameter-shadowing self-test — test-preview-diagnostics.ps1 now parses both provisioning scripts and fails when a script-scope assignment rebinds a typed parameter.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +6 to +13
foreach($script in @($ast,[Management.Automation.Language.Parser]::ParseFile((Join-Path $PSScriptRoot '../invoke-pinned-relay-cells.ps1'),[ref]$null,[ref]$null))){
$params=@($script.ParamBlock.Parameters | ForEach-Object {$_.Name.VariablePath.UserPath})
$shadows=@($script.FindAll({param($node) $node -is [Management.Automation.Language.AssignmentStatementAst] -and $node.Left -is [Management.Automation.Language.VariableExpressionAst]},$true) | Where-Object {
$parent=$_.Parent;while($parent -and $parent -isnot [Management.Automation.Language.FunctionDefinitionAst] -and $parent -isnot [Management.Automation.Language.ScriptBlockExpressionAst]){$parent=$parent.Parent}
-not $parent -and $_.Left.VariablePath.UserPath -in $params
} | ForEach-Object {$_.Left.VariablePath.UserPath})
if($shadows.Count){throw "Script-scope assignment rebinds a typed param: $($shadows -join ', ')"}
}

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.

This self-test only rejects a script-scope assignment that shadows a typed parameter, so it still passes with the reported inbox bug present. prove-preview-openssh.ps1:185 reuses $name (the private account name set at line 46) as the inbox native-input loop variable, leaving $name = 'sftp-server.exe' for the later $sshArgs (line 307), the SFTP preflight (line 348) and the host-cell probe (line 355) — logins that AllowUsers rejects. $name is not a parameter, so nothing here catches it. Either rename the inbox loop variable or broaden the AST check; the inbox lanes stay broken until then.

Technical details
# Self-test scope misses the live `$name` reuse

## Affected sites
- `config/ci/windows-ssh-provider/preview-ssh/prove-preview-openssh.ps1:185` — `foreach($name in @('sshd.exe','ssh.exe','ssh-keygen.exe','sftp.exe','sftp-server.exe'))` clobbers the `$name` set at line 46. In inbox mode the loop ends on `sftp-server.exe`, so `$sshArgs` (line 307), `"[email protected]"` (line 348) and `& $ProductionRouteProbe $name ...` (line 355) all authenticate as `[email protected]`.
- `config/ci/windows-ssh-provider/preview-ssh/test-preview-diagnostics.ps1:6-13` — the new check compares assignment names against `$script.ParamBlock.Parameters` only.

## Required outcome
- Inbox provisioning must authenticate as the created `orca*` account, not `sftp-server.exe`, and a regression must fail the self-test.

## Suggested approach (optional)
- Rename the inbox loop variable (e.g. `$nativeName`); optionally extend the self-test to flag a `foreach` variable that is read after its loop changes role.

Comment on lines +333 to +336
$userEnvironment="Registry::HKEY_USERS\$($account.sid)\Environment"
if(-not (Test-Path -LiteralPath $userEnvironment)){throw 'Private account hive not loaded after its SSH logon'}
$userPath=(Get-Item -LiteralPath $userEnvironment).GetValue('Path','',[Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames)
New-ItemProperty -LiteralPath $userEnvironment -Name Path -PropertyType ExpandString -Value ((@($shimDir)+@($userPath -split ';' | Where-Object {$_})) -join ';') -Force | Out-Null

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 Profile hive may be unavailable

If Windows unloads the private account’s profile after the one-shot SSH login exits, its registry hive will no longer be mounted when this check runs. The check then throws before any relay cells run, failing the Windows host job. Keep the profile loaded while setting its PATH, or set it before the login ends.

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

Important

The new ACL-based toolchain hiding rests on a per-file property the script never controls, and its only self-check cannot detect the gap (details inline).

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (2675f0f9 → d232297f, one file).

  • Toolchain hiding moved from PATH to ACLs — prove-preview-openssh.ps1 drops the per-service Environment PATH and instead denies the private accounts read+execute on every machine PATH directory holding a hidden tool, on the premise that Win32-OpenSSH rebuilds each session's PATH from the machine and user registry.
  • Per-user shim PATH — after the account's first SSH logon the shim directory is prepended to HKEY_USERS\<sid>\Environment\Path, so the logging shims still resolve.
  • Deny cleanup — the finally cleanup removes the deny ACEs (icacls /remove:d) before removing the accounts.
  • SSH-client diagnostic excerpts — a new Diagnostic-Excerpt adds the last failing lines of ssh/sftp stderr and the sshd log tail to the receipt.

The previously reported inbox $name reuse (prove-preview-openssh.ps1:190) is unchanged by this commit and its thread remains open.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +291 to +293
foreach($directory in $hidden){
Invoke-Bounded icacls.exe (@($directory.TrimEnd('\'),'/deny')+@($ownedAccounts | ForEach-Object {"*$($_.sid):(OI)(CI)RX"})) 120 | Out-Null
$deniedToolDirs.Add($directory)

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.

The deny is applied to the directory only, so on each executable it lands as an inherited ACE — and Windows orders explicit ACEs before inherited ones, meaning any pre-existing explicit allow on the file wins. SeChangeNotifyPrivilege (granted to Everyone by default) also lets the account open node.exe by exact path even though the directory's Read is denied, and the where node.exe self-check exercises only resolution, so it can pass while execution still succeeds. Note that node has no shim here — the shim loop iterates $HiddenTools while node is only added to the deny computation — so for node.exe the ACL is the sole control, and it is contingent rather than guaranteed.

Technical details
# Directory-scoped deny does not reliably hide executables

## Affected sites
- `config/ci/windows-ssh-provider/preview-ssh/prove-preview-openssh.ps1:291-293` — deny is applied to `$hidden` *directories* with `(OI)(CI)RX`; files receive it as an inherited ACE.
- `config/ci/windows-ssh-provider/preview-ssh/prove-preview-openssh.ps1:342-350` — the only proof is `where node.exe`, i.e. command resolution, not execution.
- `config/ci/windows-ssh-provider/preview-ssh/prove-preview-openssh.ps1:279,287` — `node` is added to the deny computation (`$HiddenTools+@('node')`) but no `node.cmd` shim is written (the shim loop iterates `$HiddenTools`), so for `node.exe` the ACL is the sole control.

## Required outcome
- A private account must be unable to execute any host toolchain binary on the machine PATH, and a regression in that property must fail the run rather than pass via resolution-only probing.

## Suggested approach (optional)
- Apply the deny to each resolved executable (`icacls <file> /deny *<sid>:RX`) so it is an explicit deny on the target object, and add `/T` on cleanup.
- Or assert execution (spawn the tool / open it by exact path) instead of `where`, and cover the other hidden tools as well as `node`.

## References
- Order of ACEs in a DACL: https://learn.microsoft.com/en-us/windows/win32/secauthz/order-of-aces-in-a-dacl
- icacls canonical order: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
- Automatic propagation ("Directly applied ACEs have precedence over inherited ACEs"): https://learn.microsoft.com/en-us/windows/win32/secauthz/automatic-propagation-of-inheritable-aces
- Bypass traverse checking / `SeChangeNotifyPrivilege`: https://learn.microsoft.com/en-us/windows/win32/secauthz/privilege-constants

@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 in this delta. It is not an approval: the inbox $name reuse and the ACL toolchain-hiding gap from the earlier reviews are still open and unchanged.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (d232297f → eb40cb1b, three files across two commits).

  • Upload root resolved before the containment check — sftp-upload.ts adds a fifth-position root parameter, resolves it once with realpath, and recurses through a new internal uploadDirectoryWithinRoot so a root named via a symlink, junction, or Windows 8.3 short name (RUNNER~1 in TEMP) no longer rejects every entry as escaped. New sftp-upload.test.ts regression pins the symlink-alias root and fails without the fix.
  • One authorized_keys file per account — prove-preview-openssh.ps1 writes authorized_keys_<account> readable only by that account and points AuthorizedKeysFile at authorized_keys_%u, because inbox sshd 8.1 rejects a keys file any other account can read.
  • Vitest exit code read from the global scope — invoke-pinned-relay-cells.ps1 reads $global:LASTEXITCODE so the workflow's GetNewClosure callback does not compare a stale captured copy.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +77 to +82
if($wmi.beforeGrant -ne '0'){
Write-Host "::warning::Standard SSH user cannot launch through WMI Win32_Process.Create ($($wmi.beforeGrant)); Orca's Windows relay launch needs it. Granting the cell accounts Remote Enable on root\cimv2 so the remaining assertions run."
Grant-CellWmiLaunch @($Context.accounts[0..($Cells.Count-1)] | ForEach-Object {(Get-LocalUser -Name $_.name).SID.Value})
$wmi.granted=$true
$wmi.afterGrant=Test-PrivateWmiLaunch $Context.accounts[0].name
if($wmi.afterGrant -ne '0'){throw "WMI launch still refused after the grant ($($wmi.afterGrant))"}

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 WMI fallback masks launch failure If a standard SSH account cannot call Win32_Process.Create, this branch grants it WMI access and then runs the relay cells. The jobs can pass even though Orca's unmodified Windows relay launch would fail for that account, so the CI verdict no longer proves the intended standard-account behavior.

Knowledge Base Used: Remote connectivity and execution

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@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 blockers in this delta — the inbox $name fix is correct. One question inline about the WMI grant; the earlier ACL and self-test threads remain open.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (eb40cb1b → 059ea5d0, two files).

  • Inbox account name no longer clobbered — prove-preview-openssh.ps1 renames the inbox native-input loop variable to $binary, so $name keeps the private account name for $sshArgs, the SFTP preflight and the production-route probe. This closes the round-1 blocker that would have failed both inbox cells.
  • WMI relay-launch gap surfaced and granted — invoke-pinned-relay-cells.ps1 probes Win32_Process.Create as a standard SSH user, emits a ::warning:: and grants the cell accounts WBEM_ENABLE | WBEM_METHOD_EXECUTE | WBEM_REMOTE_ACCESS on root\cimv2 when refused, re-probes, and restores the original namespace SD in finally.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

$wmi=@{beforeGrant=(Test-PrivateWmiLaunch $Context.accounts[0].name);granted=$false}
if($wmi.beforeGrant -ne '0'){
Write-Host "::warning::Standard SSH user cannot launch through WMI Win32_Process.Create ($($wmi.beforeGrant)); Orca's Windows relay launch needs it. Granting the cell accounts Remote Enable on root\cimv2 so the remaining assertions run."
Grant-CellWmiLaunch @($Context.accounts[0..($Cells.Count-1)] | ForEach-Object {(Get-LocalUser -Name $_.name).SID.Value})

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.

The relay's Windows launch is exactly this Win32_Process.Create call (ssh-relay-deploy.ts:2544) and has no non-WMI fallback, so granting WBEM_REMOTE_ACCESS here means a green lane proves the relay works once an admin has widened root\cimv2, not on the stock host the lane otherwise models. Is the Remote Enable grant an expected, documented part of the Windows SSH-host setup, or should the relay work without it?

Technical details
# The WMI grant makes the lane's stock-host premise conditional

## Affected sites
- `config/ci/windows-ssh-provider/invoke-pinned-relay-cells.ps1:76-83` — probes `Win32_Process.Create` as a standard SSH user; if refused, grants `0x23` on `root\cimv2` for the cell SIDs and re-probes.
- `src/main/ssh/ssh-relay-deploy.ts:2517,2544` — the production Windows launch is `Invoke-CimMethod ... Win32_Process.Create`; there is no non-WMI launch path (the `windows-pipe` tests probe a pipe, they do not launch one).

## Required outcome
- A conscious decision on whether a Windows SSH host must grant the SSH account Remote Enable on `root\cimv2` before Orca can deploy the relay, and if so, where that prerequisite is documented.

## Open questions for the human
- If stock hosts lack the grant, this lane cannot certify the Windows relay on a stock host; is that acceptable as long as the receipt's `standardUserWmiLaunch` records the grant?
- Should the receipt/warning be elevated to a job annotation or summary so a green run is not read as stock-host support?

@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 in this delta. Not an approval — the ACL toolchain-hiding gap, the self-test scope gap and the U+FEFF nit from earlier reviews are still open and unchanged.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (059ea5d0 → 9d57017, two commits).

  • Terminal session held open through GC — assertTerminalEchoes now returns the multiplexer's disposer instead of closing it, so the first PTY session keeps sending keepalives while assertGcKeepsInUseRuntime runs and the relay is not reaped as silent; the probe is re-sent every 15s and the first Windows PowerShell start budget rises from 60s to 90s.
  • Relay logs captured into receipts — invoke-pinned-relay-cells.ps1 copies each cell account's .orca-remote\relay-*\relay*.log files into the receipt root after the vitest run, so a failed cell retains the relay's own close reason.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@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 in this delta. Not an approval — the ACL toolchain-hiding gap, the self-test scope gap, and the U+FEFF nit from earlier reviews remain open and unchanged.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (9d57017 → a843084, one commit, two files).

  • Peer-ended relay socket detaches before destroy — relay-reconnect-listener.ts extracts detachSocketClient and calls it from the socket end handler before socket.destroy(), with handleSocketClose reusing the same helper (second call is a map-lookup no-op). This removes the window where a relay write failing between end and close closed the client as local, holding its PTY owner for the full grace instead of the short peer-closed floor.
  • Regression test — relay-reconnect-listener-peer-end.test.ts completes a handshake, ends the client, and asserts the dispatcher received peer-closed by the time end returns; verified it fails (detached: []) with the detach removed.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@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. Not an approval — the ACL toolchain-hiding gap, the self-test scope gap, the U+FEFF nit and the WMI-grant question from earlier reviews remain open and unchanged.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (a843084 → 859eb85, one commit, one file).

  • Peer-end test now drives a real dispatcher — relay-reconnect-listener-peer-end.test.ts replaces its as unknown as RelayDispatcher cast stub with a real RelayDispatcher(() => true), subscribes through onClientDetached, and disposes the dispatcher in afterEach, so the assertion exercises the dispatcher's own detach and close-cause path instead of a hand-rolled fake. Verified locally: the test passes with the end-handler detach and fails (detached: []) without it.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin force-pushed the OrcaWin/node-rt-p2-winhard branch from 92e345a to 2acf5e5 Compare October 1, 2026 09:57
@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 1, 2026 09:57
m4air added 13 commits October 1, 2026 03:27
Copied unchanged from origin/OrcaWin/np-windows-ssh-provider-diagnostic
(config/ci/windows-ssh-provider/preview-ssh/ at 1242f3c, commits 78b3857,
c24adcc, 069aa7b): a private LocalSystem sshd service on 127.0.0.1 for a
dedicated standard user, either the Microsoft-signed Win32-OpenSSH
10.0.0.0p2-Preview ZIP (archive and every binary pinned by sha256) or the inbox
OpenSSH.Server capability binaries. The following commits extend it for the
pinned-Node relay host lanes.
The Docker matrix drove the relay deploy and inspected the container with
inline docker exec calls, so no other host could reuse it. Split it into:

- ssh-hostile-host-test-harness.ts: the deploy, ladder observation, terminal
  echo (per-shell probe), runtime reuse and GC-keeps-in-use assertions, now
  also capturing every command the deploy sent the host.
- ssh-hostile-host-observer.ts: how a driver inspects the host outside SSH;
  docker exec for containers, the local filesystem for a loopback host.
- a legacy_opt_out outcome: the ladder never runs and nothing enters the
  pinned store, whatever the host-Node path does.

Launched cells now also check the runtime's sha256 on the host and that every
slot file (the Windows bundled ConPTY pair included) landed in the relay dir.
Phase 2 exit gate, Windows half: the real deployAndLaunchRelay through a real
SshConnection against Win32-OpenSSH on 127.0.0.1, on windows-2022 (x64) and
windows-11-arm (arm64), for both the inbox OpenSSH.Server capability and the
Microsoft-signed 10.0.0.0p2-Preview release (ZIP; archive and each binary
pinned by sha256 and Authenticode, as in the imported harness).

Builds on the provisioning harness from
origin/OrcaWin/np-windows-ssh-provider-diagnostic (previous import commit):
- one private standard account per cell, so every cell starts from an empty
  runtime store;
- -HiddenTools: the private sshd service's own Environment carries a PATH
  without any machine PATH entry holding node/npm/compilers, led by logging
  .cmd shims; a session probe fails the job if node.exe still resolves;
- DefaultShell set per cell by invoke-pinned-relay-cells.ps1 and restored at
  cleanup (dispatch proven per cell via %COMSPEC%).

Cells (src/main/ssh/ssh-windows-host-cells.ts): pinned-cmd (stock sshd),
pinned-powershell (DefaultShell = Windows PowerShell) expect rung A on the
pinned node.exe with the relay self-test passing, terminal echo, runtime
reuse, GC keeping the in-use runtime, stage identity through node.exe and no
Add-Type in any decoded session command; legacy-opt-out expects the ladder
never to run and an untouched pinned store.
…rData teardown

Join-Path throws on a machine PATH entry naming a drive the runner lacks,
which would abort provisioning before any cell ran; the toolchain split now
probes with [IO.File]::Exists over [IO.Path]::Combine, and the self-test
covers an absent drive. The hostile-host harness removes its throwaway
userData with removeTreeSync so a transient Windows lock cannot fail the
lane's afterAll.
PowerShell variable names are case-insensitive, so $accounts=[List[hashtable]] assigned into
the [int]$Accounts parameter and every Windows host job died before provisioning. Rename the
list and make the provisioning self-test reject script-scope assignments that shadow a param.
…e service PATH

Win32-OpenSSH builds a session's PATH from the machine and user registry values, so the private
service's Environment never reached SSH sessions and host node.exe stayed visible. Deny the private
accounts the toolchain PATH directories, put the logging shims on each account's own PATH, and
record failing sshd and client log lines so a refused login is diagnosable from the receipt.
uploadDirectory compared each entry's realpath against the root as given, so a root reached
through a symlink, junction or Windows 8.3 short name (C:\Users\RUNNER~1 in TEMP) rejected every
entry as escaped and the pinned runtime upload never started.
… own keys file

The cells script read $LASTEXITCODE under the workflow's GetNewClosure callback, which sees a
stale captured copy, so failed cells reported exit 0 and the job passed. Read the global value.
Inbox sshd 8.1 checks authorized_keys with read_ok=0, refusing a file other accounts can read;
use one keys file per account via %u.
…launch gap

The inbox binary-verification loop reused $name, so later SSH and SFTP probes logged in as
'sftp-server.exe'. Before the cells run, probe whether a standard SSH user can call WMI
Win32_Process.Create (the Windows relay launch path); when refused, warn and grant the cell
accounts Remote Enable on root\cimv2 for the run so the remaining assertions execute.
…gh GC

The hostile-host driver disposed the first session's multiplexer before the GC and reconnect
steps, so a slow Windows GC let the relay reap the silent owner as 'local' and the reconnect then
waited out the full owner grace. Keep the session live until the connection closes, as the app
does, and resend the terminal probe until the shell evaluates it: ConPTY PowerShell can drop
typeahead sent before its first prompt.
…oying it

The listener destroyed a socket on 'end' but detached its client only on 'close'. A relay write
in that window failed with 'Relay socket is closed', and the dispatcher closed the client as
'local', so its PTY owner kept the full 30s grace instead of the peer-closed floor and a quick
reconnect was refused. The Windows host lanes logged this race on the named-pipe endpoint.
…instead of a cast stub

The stub was an unchecked 'as unknown as RelayDispatcher' that failed the changed-code casting gate.
@OrcaWin
OrcaWin force-pushed the OrcaWin/node-rt-p2-winhost branch from 859eb85 to c2ecb2c Compare October 1, 2026 10:27
@OrcaWin
OrcaWin requested a review from Jinwoo-H as a code owner October 1, 2026 10:27
@OrcaWin
OrcaWin changed the base branch from OrcaWin/node-rt-p2-winhard to main October 1, 2026 10:29
@OrcaWin OrcaWin closed this Oct 1, 2026
@OrcaWin OrcaWin reopened this Oct 1, 2026
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 18f94193-2ff0-47be-8509-90612302a081

📥 Commits

Reviewing files that changed from the base of the PR and between 14d4bb2 and c2ecb2c.

📒 Files selected for processing (23)
  • .github/workflows/ssh-windows-hosts.yml
  • config/ci/windows-ssh-provider/invoke-pinned-relay-cells.ps1
  • config/ci/windows-ssh-provider/preview-ssh/preview-native-inputs-arm64.json
  • config/ci/windows-ssh-provider/preview-ssh/preview-native-inputs-x64.json
  • config/ci/windows-ssh-provider/preview-ssh/prove-preview-openssh.ps1
  • config/ci/windows-ssh-provider/preview-ssh/test-preview-diagnostics.ps1
  • config/scripts/ssh-windows-hosts-workflow.test.mjs
  • src/main/ssh/sftp-upload.test.ts
  • src/main/ssh/sftp-upload.ts
  • src/main/ssh/ssh-hostile-host-cells.test.ts
  • src/main/ssh/ssh-hostile-host-cells.ts
  • src/main/ssh/ssh-hostile-host-observer.test.ts
  • src/main/ssh/ssh-hostile-host-observer.ts
  • src/main/ssh/ssh-hostile-host-test-fixture.ts
  • src/main/ssh/ssh-hostile-host-test-harness.ts
  • src/main/ssh/ssh-relay-hostile-hosts.docker.test.ts
  • src/main/ssh/ssh-relay-windows-host-lane.test.ts
  • src/main/ssh/ssh-session-command-audit.test.ts
  • src/main/ssh/ssh-session-command-audit.ts
  • src/main/ssh/ssh-windows-host-cells.test.ts
  • src/main/ssh/ssh-windows-host-cells.ts
  • src/relay/relay-reconnect-listener-peer-end.test.ts
  • src/relay/relay-reconnect-listener.ts

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


📝 Walkthrough

Walkthrough

The changes add Windows SSH host CI for x64 and ARM64 with inbox and preview OpenSSH, plus scripts and tests for provisioning and relay host cells. They add shared helpers and observer support for hostile-host tests. They also preserve resolved roots during recursive SFTP uploads and detach relay clients when sockets end.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to c2ecb

This change adds Windows SSH host CI and makes two small runtime adjustments that appear correct. The remaining concern is a process decision: the Windows lane grants standard users WMI launch access when they lack it. A passing run therefore may not prove the relay works on an unmodified Windows host. Owners should accept or document this before relying on the lane as a release gate.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c2ecb

The new tests create privileged machine state, but connections are local and key-authenticated, and repository permissions are read-only. No introduced authentication bypass was identified. Interrupted cleanup still depends on disposable test machines, and Windows-specific disconnect ordering remains incompletely validated.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new PR-code execution authority reaches administrator-owned state within each Windows qualification machine, including services, local identities, registry settings, ACLs and temporary WMI grants. The inspected workflow does not add repository write permission or a persistent shared-host target.

Security Findings and Attack Paths

  • observed — The sensitive execution candidate runs observer commands as root inside the test-owned Docker container. Variable path arguments are POSIX-escaped before sh execution; the inspected caller is the opt-in Docker qualification test. This evidence does not establish a new production command-execution path.

Trust Boundaries and Controls

  • observed — The private Windows SSH listener restricts users, requires public-key authentication, disables password and interactive authentication, forwarding and tunnels, pins the host key, and checks loopback listener process ownership. Service host keys are restricted to SYSTEM and administrators.
  • observed — Relay attachment remains behind credential publication and handshake validation; authenticated session-owner authority is assigned during accepted attachment, not detachment. SFTP traversal retains realpath containment checks and exclusion of symlinks and special files.

Resilience and Maintainability Implications

  • inferred — Deleting the socket mapping before dispatcher detachment prevents duplicate detach effects across end and close. Accepted reconnects cancel grace, and last-client handling remains conditional on an empty socket map. The implementation supports consistent ownership recovery, although the focused peer-end regression skips Windows and does not directly exercise all competing event sequences.

Hardening Proposals

  • proposed — Keep this provisioning path on single-use machines. Any future reusable-runner support should require independently verified restoration or reimaging after success, failure and interruption rather than treating finally blocks as the containment boundary.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 17 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: CI coverage for Windows SSH-host lanes using inbox and preview OpenSSH with the pinned relay.
Description check ✅ Passed The description is mostly complete. It includes the ELI5 summary, changes, rationale, linked issue reference, visual-proof explanation, testing details, and test status. It omits several template sect…
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: Docstring Coverage

Explanation

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

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@OrcaWin
OrcaWin merged commit 0ad77ea into main Oct 1, 2026
81 of 108 checks passed
OrcaWin pushed a commit that referenced this pull request Oct 1, 2026
The upload-root realpath fix landed with #24180; this keeps macoshost's case
where the root is passed explicitly beneath a symlinked parent.
OrcaWin added a commit that referenced this pull request Oct 1, 2026
…a symlinked root (#24179)

* test(ssh): upload a root reached through a symlinked parent

The upload-root realpath fix landed with #24180; this keeps macoshost's case
where the root is passed explicitly beneath a symlinked parent.

* ci(ssh): macOS hostile-host lane on a loopback user-level sshd

Adds local-sshd cells for darwin-arm64 (macos-14) and darwin-x64
(macos-15-intel): a non-root sshd on 127.0.0.1 logs in as the runner user
with SetEnv PATH=<shims>:/usr/bin:/bin:/usr/sbin:/sbin and an empty HOME, so
no rc file restores Homebrew. The driver asserts rung A, terminal echo,
cached runtime reuse, GC keeping the in-use runtime, no toolchain or xattr
calls, and that the SFTP-uploaded Node carries no quarantine and runs as
uploaded. Docker cells are unchanged; each machine runs only cells it can host.

* test(ssh): fail a hostile-host run that would skip every named or hostable cell

A cell named for the wrong OS or arch was silently skipped, so a macOS job on a
mismatched runner went green having deployed nothing. Named cells must now be
hostable here, and a gated run must select at least one cell.

---------

Co-authored-by: m4air <[email protected]>
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