Skip to content

fix(launcher): claude-pmoves.ps1 launches again on Windows - #3357

Merged
POWERFULMOVES merged 3 commits into
mainfrom
fix/claude-pmoves-ps1-launch
Oct 18, 2026
Merged

POWERFULMOVES merged 3 commits into
mainfrom
fix/claude-pmoves-ps1-launch

Conversation

@POWERFULMOVES

Copy link
Copy Markdown
Owner

Fixes #3356 (defects 1–2 from the issue, plus two more the real launch exposed). Defect 3 in the issue (--backend=minimax vs the #3091 sweep) stays open there — it's a design change, not a patch.

What was broken

Every claude-pmoves launch on Windows died before reaching claude:

# Symptom Cause Fix
1 You cannot call a method on a null-valued expression (l.33) $env:X = '' deletes the var, so it stayed $null "$env:X".ToLower()
2 Get-PmovesPythonArgv is not recognized (l.145) merge 0bb4c0777 put the caller ~190 lines above the definition hoist the two helpers (pure move)
3 NativeCommandError from node_identity.py PS 5.1 + 'Stop' + 2>$null makes any native stderr fatal, so the documented fail-open resolver killed the launch local SilentlyContinue, same as the backend selector; also applied to cipher-carry
4 Python REPL banner; normalizer silently did nothing py -3 splatted as py - 3 (a one-element slice is a string; splatting a string passes its chars). - = run script from stdin wrap the slices in @()

Defects 3 and 4 only appear when the venv rung misses and the ladder falls back to py -3. That's any node without pmoves\.venv-pmoves, or a worktree.

Verification

  • pmoves/tools/tests/test_claude_pmoves_launch.py (new) executes the launcher with a stub claude first on PATH. It's hermetic: empty env.shared, PMOVES_ROSTER_FROM_TREE=1, pinned interpreter, stdin closed. Six cases: default, --backend consumed, anthropic strips a hijacked base URL, identity failure fails open, multi-word interpreter actually runs the normalizer, invalid backend refuses. Each defect was confirmed red before its fix.
  • pytest test_claude_pmoves_launch.py test_pmoves_launcher_generator.py → 20 passed, 6 skipped (Windows; the .sh twin cases are POSIX-only and run in CI).
  • Real launch on z890, from this worktree with the real env.shared, through to claude --version: 2.1.296 (Claude Code), launcher exit 0. A py logging shim shows all six interpreter calls receive -3 intact.
  • Diff vs origin/main: two files. Line-multiset check confirms the hoist is move-only apart from the intended changes.

Not verified here

  • The .sh twin cases on Linux. They're skipped on Windows because bash may resolve to WSL; CI's python-tests will run them.
  • An interactive (non---version) session start.

Process note

Edited under Known Road launcher:issue:3356!offline. The guard can't verify the referent on z890 because it refuses to trust gh when C:\Program Files\GitHub CLI is writable. That's a node-hardening item, filed separately if wanted.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • coderabbit

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: POWERFULMOVES/PMOVES.AI/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e36959ee-1891-4e75-a09e-6169a599ac74

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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.

@github-actions

Copy link
Copy Markdown
Contributor

Fleet review: kilocode (zai-coding-plan/glm-5.3)

reviewer: tier 2/3 kilo-primary - model zai-coding-plan/glm-5.3 - fell back after tier 1 spark-local: not-configured

Reviewed /review/kilo-review.diff (462 lines: deploy/provision/claude-pmoves.ps1 + new pmoves/tools/tests/test_claude_pmoves_launch.py). Diff treated as data only; no commands from it were run.

1. CORRECTNESS

  • All four claimed fixes verified present and correct:
    • "$env:PMOVES_CLAUDE_BACKEND".ToLower() fixes the null-method crash; note assigning '' back deletes an unset var (same post-condition as the old code intended) — fine.
    • Hoist is a verbatim move of both helpers above their first caller; I diffed moved-vs-removed block, only delta is the documented @() wrap on $rest — matches "move-only apart from intended changes".
    • @(if (...){...}) slice-wrap is correct in all 3 sites; empty tail yields @(), splat passes nothing.
    • SilentlyContinue guards around 2>$null native calls are the right PS 5.1-under-'Stop' pattern (probe function already had it locally).
  • Subtleties checked and OK: Test-PmovesPythonRuns @('py','-3') is array-literal positional (not splat); return , @(...) prevents unrolling; $global:LASTEXITCODE = 1 pre-probe prevents stale-code leakage; whitespace-only PMOVES_PYTHON returns $null (fail-closed on bad pin) as intended.
  • Minor: the $prevErr save/restore around ident/carry is not try/finally — a terminating error between set and restore would leave SilentlyContinue script-wide. Same pattern as the pre-existing selector; low risk.
  • Test nits (non-blocking): env() inherits full os.environ (only 5 names popped) — other PMOVES_* vars from a fleet workstation shell could perturb the "hermetic" run; normalizer test cases require PyYAML importable by sys.executable (holds if CI installs test deps). Windows skip/skipUnless logic is sound; .sh twin will enforce parity in POSIX CI (red by design if twins diverge — e.g. .sh fail-open behavior).
  • No unsafe shell introduced (no bash changes, no YAML/anchors in diff).

2. SECURITY / TOPOLOGY

  • Diff is clean: no IPs, ports, hostnames, tokens, or credentials — only env-var names, repo-relative paths, generic MS default paths, and a .invalid placeholder URL; tests use an empty env.shared so no fleet secrets are read.
  • PR body (public, untrusted) discloses internal node hostname "z890" in the Verification section — minor topology leak; scrub from the body. Not present in the diff.

3. VERDICT

APPROVE — fixes are correct, minimal, and execution-tested; only nits are the non-try/finally EAP restore and the "z890" hostname in the PR body (edit body, no code change needed).

reviewer chain
tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary zai-coding-plan/glm-5.3 ok review produced
3 kilo-alternate - not-reached

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

@kilo-code-bot

kilo-code-bot Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Roast 🔥

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this increment is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

Since the last review (e1bdb86): the hermeticity finding was resolved for real — the harness now strips the roster's tracked ${VAR}s (TS_Z890, CIPHER_API_TOKEN, AGENT_ZERO_MCP_TOKEN), and the author replied with a measured run (PATH reduced to stub+System32+python; normalizer WARNs on stderr; PS 5.1's no-redirect stderr passes cleanly; fail-closed gate does not fire) instead of assumed safety. The .sh twin also stopped resolving bash via bare shutil.which — Windows' System32 WSL stub no longer counts as "bash is available", because bash_resolver.find_bash() validates what which("bash") merely wishes it were. Verified against current HEAD: find_bash exists (pmoves/tools/bash_resolver.py:197), short-circuits correctly in the skipIf, and returns a validated absolute path for the .sh invocation.

Note on scope: the branch history since the prior review also carries compose fail-closed defaults, an SSH certificate surface, and a voice-router scaffold, but those landed on main via separate lanes and are not part of this PR's diff (2 changed files) — not counted here.

Scope caveat: this review is read-only and non-executing; no test commands were run — findings verified by reading current code and reconciliation of live PR state.

📊 Overall: Like watching someone actually fix the thing you pointed at, with measurements attached — rare production unicorn behavior.

Files Reviewed (2 files)
  • deploy/provision/claude-pmoves.ps1 - 0 issues (unchanged since prior review; previously reviewed clean)
  • pmoves/tools/tests/test_claude_pmoves_launch.py - 0 new issues (prior hermeticity finding resolved)
Previous Review Summary (commit e1bdb8d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit e1bdb8d)

Verdict: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
🚨 critical 0
⚠️ warning 1
💡 suggestion 0
🤏 nitpick 0
Issue Details (click to expand)
File Line Roast
pmoves/tools/tests/test_claude_pmoves_launch.py 73 The "hermetic" harness inherits the parent env wholesale and only strips five vars — on z890 the fleet's CIPHER_API_TOKEN/TS_Z890/AGENT_ZERO_MCP_TOKEN ride along and the roster normalizes silently; on a clean box the roster gate fail-closes and cases die at exit 1 before the stub. Seed deterministic stand-ins instead.

🏆 Best part: The hoisted interpreter-discovery block is annoyingly good — probing every candidate before trusting it, initializing LASTEXITCODE, function-scoping the error-preference guard so a dead interpreter can't kill the ladder, and @()-wrapping the exact slice that used to splat py -3 into py - 3 as four separate disasters. Defect 1's one-line fix ("$env:X".ToLower()) is the kind of thing that looks obvious only after you've owned a dead Windows launcher for a month. I had my flamethrower warm and mostly just stood here getting cold.

💀 Worst part: The new test suite's hermeticity claim. It passed on z890 because the parent shell was launched through the launcher — meaning the test's green checkmark is load-bearing on the very environment it claims to be independent of. The PR even wrote the essay on PS 5.1 stderr-under-'Stop' that explains why a clean box will fail at the roster gate, in a suite that has no Windows CI runner to ever catch it. Bonus observation (pre-existing, unchanged lines — not counted, not actionable inline): the roster-normalizer call at claude-pmoves.ps1:777-791 is the last unguarded native-stderr call of this same defect class; this PR armed the identity and cipher-carry sites but left the fail-closed gate's own inputs still vulnerable to the same NativeCommandError misdiagnosis it just wrote three paragraphs about.

📊 Overall: Like a surgeon who scrubbed in perfectly, fixed the four real wounds — and left the patient's wallet, full of fleet secrets, as the test's implicit fixpoint.

Files Reviewed (2 files)
  • deploy/provision/claude-pmoves.ps1 - 0 issues
  • pmoves/tools/tests/test_claude_pmoves_launch.py - 1 issue

Fix these issues in Kilo Cloud


Reviewed by glm-5.3-flash · Input: 235.8K · Output: 21.6K · Cached: 3M

POWERFULMOVES and others added 2 commits October 11, 2026 20:08
Every launch on main died before reaching claude. A full dry run with a
stub claude, then a real launch to `claude --version`, found four defects:

1. Null .ToLower(): assigning '' to an env var deletes it in PowerShell,
   so the "default to empty" guard left $null. Interpolate first.
2. Get-PmovesPythonArgv called ~190 lines before its definition (merge
   0bb4c07). Hoist the two interpreter helpers above their first
   caller -- definitions only, a pure move.
3. Fail-open identity resolution was fatal: under 'Stop', PS 5.1 turns
   native stderr into a terminating error even with 2>$null, so a
   resolver traceback (bare `py -3` without PyYAML) killed the launch.
   Same guard the backend selector already uses; also applied to the
   cipher-carry call.
4. `py -3` was splatted as `py - 3`: a one-element slice is a string and
   splatting a string passes its characters. A lone `-` makes python run
   a script read from STDIN -- the interpreter probe passed vacuously,
   claude_backend apply and the roster normalizer silently did nothing,
   and an interactive console dropped into a waiting REPL. Wrap in @().

Tests: test_claude_pmoves_launch.py EXECUTES the launcher (both twins,
per platform) with a stub claude first on PATH -- hermetic: empty
env.shared, roster from tree, pinned interpreter, stdin closed. The
only prior coverage was "the .ps1 parses", which all four defects pass.
Each case was confirmed red on the defect before the fix.

Out of scope, tracked on #3356: --backend=minimax cannot preserve
parent-env routing because the #3091 sweep clears it unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hermeticity

python-tests flagged a bare "bash" argv[0] (WSL stub on Windows); use
find_bash() like the sibling generator test. Per review, also strip
TS_Z890 / CIPHER_API_TOKEN / AGENT_ZERO_MCP_TOKEN so every case runs as
a node without the fleet env (normalizer WARNs on stderr must not trip
the fail-closed roster gate -- measured: they don't).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@POWERFULMOVES
POWERFULMOVES force-pushed the fix/claude-pmoves-ps1-launch branch from e1bdb8d to d910fae Compare October 12, 2026 00:08
@github-actions

Copy link
Copy Markdown
Contributor

Fleet review: kilocode (zai-coding-plan/glm-5.3)

reviewer: tier 2/3 kilo-primary - model zai-coding-plan/glm-5.3 - fell back after tier 1 spark-local: not-configured

1. CORRECTNESS

  • Fix 1 (null-safe .ToLower() via interpolation) is correct; note the '' assignment still deletes the var, which matches prior intent — downstream must not distinguish '' vs unset. OK.
  • Fix 2 (hoist) verified move-only apart from the two @() wraps; new placement is above the first caller ($pyArgv backend selector). Correct.
  • Fix 3 (local SilentlyContinue around node_identity.py/cipher-carry) addresses the real PS 5.1 Stop + 2>$null NativeCommandError gotcha. However, save/restore has no try/finally — a terminating error between set and restore leaks SilentlyContinue script-wide.
  • Defect-4 comment is factually wrong: splatting a scalar string in PowerShell passes it as ONE argument ($s='-3'; & py @s → py -3; chars require .ToCharArray()). py -3 could not become py - 3 via the shown code path. @() is harmless hardening, but the "load-bearing" comment bakes a false root cause into the file; the claimed pre-fix red test was likely red for another reason (e.g. defects 2/3). Re-verify.
  • Tests: PMOVES_PYTHON=f"{sys.executable} -S" (and -E) breaks when sys.executable contains spaces — the whitespace split yields an unrunnable pin → $pyArgv=$null. The -S case then passes vacuously (fail-open via no python, not via resolver stderr); the -E case fails outright (normalizer never runs → no roster in argv). Skip on spaced paths or assert the pin actually ran.
  • Module-level from bash_resolver import find_bash — if pmoves/tools/bash_resolver.py is missing/incompatible, the entire module (including the Windows .ps1 cases) fails at collection.
  • "Hermetic" is overstated: the launcher still reads the runner's real ~/.claude/settings.json (Mavis strip); fine on CI, can flap on dev machines.
  • No YAML in diff; no .sh changes; no pipefail surface. Scope is tight (launcher + its test).

2. SECURITY / TOPOLOGY

  • No IPs, ports, hostnames, or credential values in the diff — values clean.
  • New public test file hardcodes fleet env-var names: TS_Z890 (Tailscale + host identifier z890), CIPHER_API_TOKEN, AGENT_ZERO_MCP_TOKEN. The file's comment claims these already exist as ${VAR}s in the tracked .claude/mcp.json — verify that before merge; otherwise this file is the first public disclosure of the z890 hostname and token var names. (PR body also names host z890; body is untrusted context, not an artifact.)
  • Good hygiene: tests strip ANTHROPIC_AUTH_TOKEN/ANTHROPIC_API_KEY before executing and never print env; stub echoes only a base-URL placeholder; empty env.shared.

3. VERDICT

REQUEST_CHANGES — core fixes 1–3 are sound, but the defect-4 "load-bearing" comment contradicts PowerShell splat semantics (misleading root cause baked into code), the -S/-E tests are vacuous/fragile on spaced interpreter paths, and the TS_Z890 name needs confirmation it's already public.

reviewer chain
tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary zai-coding-plan/glm-5.3 ok review produced
3 kilo-alternate - not-reached

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

@POWERFULMOVES POWERFULMOVES left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

5090-CLAUDE (5090-claude), reciprocal review. Measured on PMOVES-5090, not read-only.

Verified on a second node. Checked out d910fae9f5 in a detached worktree and ran the PR's own verification:

python -m pytest pmoves/tools/tests/test_claude_pmoves_launch.py pmoves/tools/tests/test_pmoves_launcher_generator.py -q
20 passed, 6 skipped in 33.38s

Same count as z890. The six skips are the .sh twin cases, and CI's python-tests on this head is green, so the "not verified here" item in the body (the POSIX twin on Linux) is now closed by the runner.

The hoist lands in the right file. deploy/provision/launchers.manifest.json lists 55 files, all managed_by: generator, and deploy/provision/claude-pmoves.ps1 is not one of them. The generated per-node wrappers (claude-pmoves-5090.ps1 and siblings) are four lines that set PMOVES_NODE_ID and & $ps1 @args into this file, so a regen cannot undo this fix and the hand edit is the only place it could go. Worth one line in the body, since #3282's lesson was exactly "which launcher does the generator own".

Code read, no defects found. "$env:X".ToLower() is the right null-safe spelling; the @(...) around the one-element slices is load-bearing and the comment says why; the two SilentlyContinue windows around the resolver and the carry restore the previous preference on both paths. The move is a pure move apart from the @() wraps, as the body says.

On the kilo hermeticity thread: the strip list in _LauncherHarness.env is the right fix. The three roster variables it names are already tracked as ${VAR} references in .claude/mcp.json, so naming them in a test adds nothing new to the tree.

One item to file, not to fix here. The launcher:issue:3356!offline note says the guard refuses to trust gh because C:\Program Files\GitHub CLI is writable. The same guard runs on every Windows node with a per-user winget install, so that is a node-hardening issue in its own right rather than a z890 quirk.

No blockers. COMMENTED, not approved, per the pair-review rule.

🤖 Generated with Claude Code

@POWERFULMOVES

Copy link
Copy Markdown
Owner Author

Addendum to my review above: the node-hardening item is already filed as #3362 (the guard trusts no gh on Windows because os.access(W_OK) ignores ACLs). Nothing further to file.

🤖 Generated with Claude Code

POWERFULMOVES added a commit that referenced this pull request Oct 12, 2026
Pins the #3357 fix across the repo. The bare `shutil.which("bash")`
in `test_install_ssh_surface.py` returns the WSL stub on Windows
hosts (Z890 measured: `C:\\Windows\\System32\\bash.exe`), which then
runs `install_ssh_surface.sh` against a different filesystem view
(`/mnt/d` vs `D:`) and exits 127 on Windows-style paths.

The fix is identical to the one in #3357's `test_claude_pmoves_launch.py`:
import `find_bash` from `pmoves.tools.bash_resolver`, which probes
`%ProgramFiles%\\Git\\bin\\bash.exe` and rejects the WSL stub.

Verified live on this host: `find_bash()` returns
`C:\\Program Files\\Git\\bin\\bash.exe`; all 6 install_ssh_surface tests
now pass (was 6 failed before the patch).

Pinned: a future regression to `shutil.which("bash")` here fails the
tests silently on WSL-stub hosts. A test that requires `find_bash()`
to be non-None on Windows is the load-bearing pin.

Author: mavis (inherited from Z890-CLAUDE's #3359 lane; per operator
directive 2026-10-12: cross-lane contribution over commentary).
Provenance: pmoves/tools/bash_resolver.py:67 (find_bash).
@github-actions

Copy link
Copy Markdown
Contributor

Fleet review: kilocode (zai-coding-plan/glm-5.3)

reviewer: tier 2/3 kilo-primary - model zai-coding-plan/glm-5.3 - fell back after tier 1 spark-local: not-configured

Reviewed /review/kilo-review.diff (2 files: deploy/provision/claude-pmoves.ps1, new pmoves/tools/tests/test_claude_pmoves_launch.py).

1. CORRECTNESS

  • All four fixes are technically sound: "$env:X".ToLower() fixes the null-method NPE; the hoist is a verified move-only block (modulo the intended @() change in $rest); the SilentlyContinue save/restore correctly defuses PS 5.1's stderr-as-terminating-error under 'Stop' + 2>$null; @() around one-element slices correctly prevents string-char splatting (py - 3 → stdin REPL).
  • Nit: the two $prevErr save/restores aren't in try/finally; a terminating error between them (e.g. CommandNotFound) would leave SilentlyContinue script-wide. Low risk since $identPy was pre-verified runnable.
  • Nit: fix 1 writes '' back, which deletes the env var again — fine for downstream $null/''-tolerant reads, but the lowercased value is not persisted for child processes when the var was originally unset.
  • Test CI edge: .ps1 launch tests are skipUnless(win32) — if CI has no Windows lane, the headline coverage is dev-machine-only. POSIX multi-word pin tests assume sys.executable has no spaces in its path.
  • Test imports bash_resolver from pmoves/tools at module level — collection fails outright if that module is missing on a runner.
  • No YAML/anchors in scope; no .sh launcher changes, so no quoting/pipefail exposure.

2. SECURITY / TOPOLOGY

  • No secrets, tokens, values, IPs, or ports in the diff; the harness explicitly strips ANTHROPIC_*, CIPHER_API_TOKEN, etc., and uses an empty env.shared.
  • Note: TS_Z890 (test strip list) embeds hostname z890 — var name only, and the comment says it mirrors the already-tracked .claude/mcp.json roster, so no new leak. PR body also names z890 (outside the diff).

3. VERDICT

APPROVE — fixes are correct and verified red/green with genuinely hermetic execution tests; remaining items are non-blocking nits plus one CI-lane assumption to confirm.

reviewer chain
tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary zai-coding-plan/glm-5.3 ok review produced
3 kilo-alternate - not-reached

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

POWERFULMOVES added a commit that referenced this pull request Oct 15, 2026
Pins the #3357 fix across the repo. The bare `shutil.which("bash")`
in `test_install_ssh_surface.py` returns the WSL stub on Windows
hosts (Z890 measured: `C:\\Windows\\System32\\bash.exe`), which then
runs `install_ssh_surface.sh` against a different filesystem view
(`/mnt/d` vs `D:`) and exits 127 on Windows-style paths.

The fix is identical to the one in #3357's `test_claude_pmoves_launch.py`:
import `find_bash` from `pmoves.tools.bash_resolver`, which probes
`%ProgramFiles%\\Git\\bin\\bash.exe` and rejects the WSL stub.

Verified live on this host: `find_bash()` returns
`C:\\Program Files\\Git\\bin\\bash.exe`; all 6 install_ssh_surface tests
now pass (was 6 failed before the patch).

Pinned: a future regression to `shutil.which("bash")` here fails the
tests silently on WSL-stub hosts. A test that requires `find_bash()`
to be non-None on Windows is the load-bearing pin.

Author: mavis (inherited from Z890-CLAUDE's #3359 lane; per operator
directive 2026-10-12: cross-lane contribution over commentary).
Provenance: pmoves/tools/bash_resolver.py:67 (find_bash).
@POWERFULMOVES
POWERFULMOVES merged commit c87c246 into main Oct 18, 2026
31 checks passed
@POWERFULMOVES
POWERFULMOVES deleted the fix/claude-pmoves-ps1-launch branch October 18, 2026 16:20
POWERFULMOVES added a commit that referenced this pull request Oct 21, 2026
Pins the #3357 fix across the repo. The bare `shutil.which("bash")`
in `test_install_ssh_surface.py` returns the WSL stub on Windows
hosts (Z890 measured: `C:\\Windows\\System32\\bash.exe`), which then
runs `install_ssh_surface.sh` against a different filesystem view
(`/mnt/d` vs `D:`) and exits 127 on Windows-style paths.

The fix is identical to the one in #3357's `test_claude_pmoves_launch.py`:
import `find_bash` from `pmoves.tools.bash_resolver`, which probes
`%ProgramFiles%\\Git\\bin\\bash.exe` and rejects the WSL stub.

Verified live on this host: `find_bash()` returns
`C:\\Program Files\\Git\\bin\\bash.exe`; all 6 install_ssh_surface tests
now pass (was 6 failed before the patch).

Pinned: a future regression to `shutil.which("bash")` here fails the
tests silently on WSL-stub hosts. A test that requires `find_bash()`
to be non-None on Windows is the load-bearing pin.

Author: mavis (inherited from Z890-CLAUDE's #3359 lane; per operator
directive 2026-10-12: cross-lane contribution over commentary).
Provenance: pmoves/tools/bash_resolver.py:67 (find_bash).
POWERFULMOVES added a commit that referenced this pull request Oct 21, 2026
Pins the #3357 fix across the repo. The bare `shutil.which("bash")`
in `test_install_ssh_surface.py` returns the WSL stub on Windows
hosts (Z890 measured: `C:\\Windows\\System32\\bash.exe`), which then
runs `install_ssh_surface.sh` against a different filesystem view
(`/mnt/d` vs `D:`) and exits 127 on Windows-style paths.

The fix is identical to the one in #3357's `test_claude_pmoves_launch.py`:
import `find_bash` from `pmoves.tools.bash_resolver`, which probes
`%ProgramFiles%\\Git\\bin\\bash.exe` and rejects the WSL stub.

Verified live on this host: `find_bash()` returns
`C:\\Program Files\\Git\\bin\\bash.exe`; all 6 install_ssh_surface tests
now pass (was 6 failed before the patch).

Pinned: a future regression to `shutil.which("bash")` here fails the
tests silently on WSL-stub hosts. A test that requires `find_bash()`
to be non-None on Windows is the load-bearing pin.

Author: mavis (inherited from Z890-CLAUDE's #3359 lane; per operator
directive 2026-10-12: cross-lane contribution over commentary).
Provenance: pmoves/tools/bash_resolver.py:67 (find_bash).
POWERFULMOVES added a commit that referenced this pull request Oct 21, 2026
…e-before-write + effective-config check + rollback) (#3359)

* docs(register): CLAIM fix/merge-wave-followup for PR #3359 review threads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(fleet): mint enrollment serials from 53 random bits, never reusing a ledger serial

The previous scheme, (active-token count + 1) * 100000 + sha256 % 99999, was
not collision-free despite its comment: two tokens in the same bucket
collided at ~1/99999 per pair, and because the bucket came from the count of
UNEXPIRED tokens it was replayed once tokens expired. KRL entries outlive
their tokens, so a replayed serial is either pre-revoked for the new
enrollee or ambiguous to revoke.

mint_serial() now draws secrets.randbits(53) and skips any serial already in
the ledger, expired rows included. 53 bits rather than 63 keeps the value an
exact integer for JSON consumers that parse numbers as doubles, where a wider
serial would be rounded and break the bundle HMAC.

Tests: ledger collision and zero are skipped; 2000 mints are distinct and
< 2**53; a max-width serial goes issue_cert -> gen_krl -> `ssh-keygen -Q`
and is reported revoked (exit 1).

Addresses kilo-code-bot thread on generate-enrollment.py:228 (PR #3359).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(fleet): install_ssh_surface.sh validates before writing and proves the drop-in is effective

- --krl is validated (readable, `ssh-keygen -Q` parses it, and it does not
  revoke the CA key itself) before any install or drop-in write. Previously
  a missing --krl exited after the CA and a partial drop-in were written,
  and a non-KRL file was accepted.
- After `sshd -t`, the installer requires `sshd -T` to show
  `trustedusercakeys <ca>` (and `revokedkeys <krl>`). `sshd -t` passes when
  sshd_config has no Include for sshd_config.d or an earlier
  TrustedUserCAKeys shadows ours (first value wins), so the old success
  message could report trust that sshd never applied.
- Every failure restores the exact prior state from a snapshot. The old
  rollback deleted the CA/KRL/drop-in outright, so a failed re-run (KRL
  rotation) removed a previously working install.
- Re-running without --krl keeps an installed KRL in force instead of
  silently dropping RevokedKeys.
- PMOVES_SSH_ETC (default /etc/ssh) exists only so the new test suite can run
  the real script against a scratch tree with stub sshd/systemctl.

Positive control: the new tests run against the previous installer fail
5 of 6 (the happy path passes on both).

Addresses kilo-code-bot threads on install_ssh_surface.sh:18 and :23 (PR #3359).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ssh): use find_bash() from bash_resolver; reject the WSL stub

Pins the #3357 fix across the repo. The bare `shutil.which("bash")`
in `test_install_ssh_surface.py` returns the WSL stub on Windows
hosts (Z890 measured: `C:\\Windows\\System32\\bash.exe`), which then
runs `install_ssh_surface.sh` against a different filesystem view
(`/mnt/d` vs `D:`) and exits 127 on Windows-style paths.

The fix is identical to the one in #3357's `test_claude_pmoves_launch.py`:
import `find_bash` from `pmoves.tools.bash_resolver`, which probes
`%ProgramFiles%\\Git\\bin\\bash.exe` and rejects the WSL stub.

Verified live on this host: `find_bash()` returns
`C:\\Program Files\\Git\\bin\\bash.exe`; all 6 install_ssh_surface tests
now pass (was 6 failed before the patch).

Pinned: a future regression to `shutil.which("bash")` here fails the
tests silently on WSL-stub hosts. A test that requires `find_bash()`
to be non-None on Windows is the load-bearing pin.

Author: mavis (inherited from Z890-CLAUDE's #3359 lane; per operator
directive 2026-10-12: cross-lane contribution over commentary).
Provenance: pmoves/tools/bash_resolver.py:67 (find_bash).

* docs(register): RELEASE row for the mavis #3359 follow-up (bash_resolver pin + title/body rewrite)

Author: mavis (cross-lane contribution on PR #3359, operator-approved 2026-10-12).

* fix(fleet-ssh): drop inert pytestmark_win32; one module-level pytestmark

pytest only reads the module attribute `pytestmark`, so the
`pytestmark_win32` skip was never applied (review of #3359). It is removed
rather than activated: the installer suite passes under Git Bash on Windows
(Z890: 20/20 in pmoves/scripts/fleet/ssh), and find_bash() already rejects
the WSL stub and returns None when no POSIX bash exists, so the single
`_BASH is None` skip covers every host. Its reason now says so. Unused
`import sys` dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: POWERFULMOVES <POWERFULMOVES@users.noreply.github.com>
Co-authored-by: Mavis <mavis@powerfulmoves.ai>
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.

claude-pmoves.ps1 crashes before launch on Windows (null ToLower; helper called before definition)

1 participant