Plan: Remote execution phase 6 — the cookbook, the last limitation, and the release

Closes: #494 (phase 6), #488 (the program), #505 (the Windows client’s write and edit). Relates to: #501 (5a), #493 (5), #492 (4), #491 (3), #498 (2c). Branches: fix/windows-client-write-edit, then docs/remote-phase-6, then the release branch chore/release-<version>. Status: Done (2026-10-27) — shipped as 0.128.3, published and verified; the LAN and WAN figures are #512

Why

Phases 1 through 5 are merged, and nothing since 0.127.1 is released: == Unreleased holds 2b, 2c, #500, 3, 4, 5a, 5b and 5c. The meta plan’s last row (remote-execution.adoc:97) names what remains: the cookbook entries, the limitations verbatim, and the release that turns it on. ssh.adoc exists and is in the nav (nav.adoc:6); the cookbook (tuning.adoc) has no section for pi over SSH; and of the meta plan’s limitations (remote-execution.adoc:68-78) one is not on the page yet. The operator has said they will test live once the whole program is released.

Then pi-win ran pi-ssh’s suite on Windows against 5a (b8e48bf46): 21 failures (pi-dev-win messages 7Atc2NSuWtL6, 6VOjhs7hEiTl). Three are the product’s, on a Windows client, and the release waits on them, because the operator’s live test is from Windows.

Design

6a. The Windows client, second pass (packages/pi-ssh/ops.ts, extension.ts, remote-tools.ts, the tests)

What pi-win found that is the product’s.

  1. write and edit fail on every Windows client. pi’s two mutating tools key their mutation queue by a local realpath of the resolved path before calling any operation (file-mutation-queue.js:11-22, installed pi 1.4.0), tolerating only ENOENT and ENOTDIR. 5a’s base is a UNC path on a server that does not exist, \\pi-ssh\<share>\…, and Windows answers its realpath with another code (UNKNOWN), which the queue rethrows. read and ls take no queue, which is why they passed.

  2. extractWithTar on a Windows client (remote-tools.ts) hands tar an absolute C:\… archive path, which GNU tar reads as host:path. Provisioning rg or fd to a remote that lacks them fails from Windows.

  3. A TypeError in hostPath when a workspace has no anchor: a test fake’s gap (every real workspace has one), fixed in the fake, with hostPath left strict.

The fix for the base: a drive letter that does not exist here, not a UNC path. toolBase spells the root under a free drive letter, Q:\home\me\app, where the letter is the highest from Z down whose root (Z:\) does not exist on this machine, probed once per process (fs.existsSync, cached). win32 resolution keeps a base’s drive as it keeps a device: src/x.ts is Q:\home\me\app\src\x.ts, /etc/hosts is Q:\etc\hosts, and .. stays on Q:. A realpath of a path on a drive that does not exist is ENOENT on Windows, which the queue tolerates; pi-win confirms that code with one probe before the fix merges (fs.promises.realpath("Q:\\x") for the chosen letter), and the acceptance is the read/write/edit/ls parity block green on pi-win. hostPath’s table changes in one row: "under the device" becomes "on the session’s letter", the rest with `/. A path on any other drive, or any UNC path, is still a local path named by mistake, refused as missing with the reason. The letter cannot collide with a real local path, since no such drive exists here. The share hash per anchor is no longer needed: one letter serves every workspace, since the root follows the letter. With no free letter (all 26 mapped) the tools refuse with that reason: closed, loud, never a silent fallback to a base that breaks writes.

tar: extractWithTar runs tar with cwd set to the archive’s directory and the archive’s bare name, on every platform, so no path with a colon reaches it; the test that failed on Windows is the pin.

The suite’s Windows stand-in. On Windows the stand-in remote is the Windows box, and a remote is POSIX (ADR-006). The suites that drive the helper as a POSIX remote (the contract suite over pipes, tools.test.ts’s helper cases, the session’s home case, the port watch) skip on win32 visibly, with that reason, as the bash, find and grep parity already do. What is the Windows client’s own stays and runs there: `windows-client.test.ts (its stand-in root spelled as the parity test spells it, posixLike, which 5a’s version missed), the read/write/edit/ls parity block, hostPath and toolBase’s tables, `anchorFor (its test accepts either separator), config parsing (its "cannot be read" fixture becomes a directory named pi-ssh.json, EISDIR on both platforms, where a file-as-parent is ENOTDIR on POSIX and ENOENT on Windows). The pipe transport sets USERPROFILE beside HOME, since os.homedir() reads the former on Windows.

Verification: pi-win runs pnpm exec vitest run --root packages/pi-ssh on the fix branch and reports: no failures, the skips named, the realpath code for the chosen letter. Then the operator’s live test, after the release.

The cookbook (docs/modules/ROOT/pages/tuning.adoc)

A new section, == pi over SSH, after "The pivot client" and before "The workflow guards", in the page’s shape: a short lead, then === recipes, each a thing someone wants to do, with the exact command or file and what happens. Six recipes, all of behaviour that exists:

Recipe Content

Start working on a remote checkout

/ssh dev@box:/srv/app, or pi "/ssh dev@box:/srv/app" from a shell; what pi does first (the probe, the anchor, the switch); the requirements (POSIX remote, Node 22, key or agent auth); /ssh status, /ssh reconnect, /resume.

Open a remote dev server here

/ssh forward 3000, /ssh forward 3000:8080, /ssh forwards, /ssh unforward 3000; the notice when a port starts listening; what the agent is told.

Forward new ports without asking

~/.pi/agent/pi-ssh.json with "autoForward": true; which ports are only ever named (below 1024, the sshd port); why a repository cannot set it.

A remote whose node is not on the PATH

The same file’s "node": "/opt/node/bin/node"; the error that points here, as connection.ts:120-124 words it: "node is not on <destination>'s PATH; set nodePath." ssh.adoc gains that sentence beside its Requirements, so the recipe restates the page.

Check whether a drop can hurt you

/ssh status and its link: resilient or link: not resilient line; what each means for a running command; the goodbye at exit.

Turn it off

GADHS_PI_SSH=off; what is gone (/ssh, the switched tools), as ssh.adoc’s "Turning it off" says. One sentence is added to that section first, since it is true of the code (`extension.ts, piSsh returns before registering anything) and the page does not say it: with it off, a session opened in an anchor is an ordinary local session in that directory, so leave such a session before turning it off.

Each recipe’s claim is one ssh.adoc makes, after the two additions named in the table; the recipes link there with xref:ssh.adoc#...[] anchors (#ports, #dropped-link, #windows-client, #costs), and ssh.adoc gets anchors for its "Start a remote session" and "Turning it off" sections so the links resolve.

The last limitation (ssh.adoc)

The meta plan lists seven honest limitations. Six are on the page. The seventh is not: pi-subagents' own environment probe (detectEnv, node_modules/@gotgenes/pi-subagents/src/session/env.ts:14-39) runs local git rev-parse --is-inside-work-tree and git branch --show-current in the helper’s cwd. In a remote session that is the anchor, which is no repository, so a helper’s system prompt says it is not in a git repository and names no branch (remote-execution.adoc:75). It joins the Limitations list: cosmetic, since the helper’s tools and the commit guard read the remote checkout and see the branch there.

The meta plan closes

remote-execution.adoc’s status becomes `Done (date) — implemented as planned, with the errata below, and its nav entry moves from Active to Archive. #488 closes with this MR (Closes #488).

Two pages are behind the code and are corrected here. README.adoc’s layout table (`README.adoc:31-38) lists eight packages and neither packages/pi-workspace nor packages/pi-ssh; both get a line in the table’s form ("`@gadhs/pi-workspace` — the workspace seam (a library)", "`@gadhs/pi-ssh` — pi over SSH: the helper, the SSH workspace, the tools on the remote"). packages.adoc says the meta package ships "nine loader shims" (packages.adoc:13) where packages/pi/loaders/ holds ten since 11-ssh.ts, and that the mirror copies "the language markers" (packages.adoc:145), which phase 4 stopped; both sentences are corrected. The pi-ssh and pi-workspace entries there (packages.adoc:106-134) are current.

The release

One version for the program, as the meta plan intended ("the release that flips it on"). The release verb refuses to move a package without its dependents (tools/lib/ship-run.mjs:90-100), and the graph is: pi-workspace moves (new since 0.127.1: at, the slot per anchor, sessionMarkers), so pi-modes, pi-ssh and pi-workflow move, so pi-remote (depends on pi-modes) and the meta package move. pi-guidance and pi-bash are unchanged and ship as they are.

Package From To Why that bump

@gadhs/pi

0.127.1

0.128.0

New feature: pi over SSH.

@gadhs/pi-workspace

0.1.1

0.2.0

New API: at, publishedWorkspaces, sessionMarkers; currentWorkspace removed. Pre-1.0, minor.

@gadhs/pi-ssh

0.1.0

0.2.0

First publish is 0.2.0, not 0.1.0: the 0.1.0 in its manifest never shipped, and the protocol is at 2.

@gadhs/pi-modes

0.84.0

0.85.0

The seam, remote monitors, helper worktrees, count and images on the remote.

@gadhs/pi-workflow

0.44.0

0.45.0

The commit path on the seam.

@gadhs/pi-remote

0.14.2

0.14.3

Moves with pi-modes; no change of its own.

The steps are the repository’s (release prepare, land, release tag, push the tag, confirm the tag pipeline exists and watch it, release verify), with the two checks this release adds: pi-ssh’s first publish lands in the GitLab registry with helper.mjs in the tarball (npm view @gadhs/pi-ssh@0.2.0 files once it is there, or npm pack --dry-run before), and the installed meta package loads 11-ssh.ts (the pi.extensions list, packages/pi/package.json:44). CHANGELOG.adoc’s `== Unreleased becomes == 0.128.0 - <date>, as release prepare does it.

The announcement, after release verify passes: on pi-feedback, with the install line (pi install npm:@gadhs/pi@0.128.0, then a full quit and restart), what is new in one paragraph, and the operator’s rundown: how to start a session from their machine against this box (pi "/ssh <user>@<this box>:/home/bitskrieg/code/pi" or any checkout), what to expect first (the anchor, the mirror notice, the status line), and what to try (a read and an edit, a forward, pulling the network for a few seconds mid-command, a helper with a worktree). The LAN and WAN costs the meta plan asked for come from those sessions, into `ssh.adoc’s cost table, as a follow-up issue filed with the release, not a gate on it.

Fail modes

Each named with its class: closed (nothing ships or changes, and it is said), open (the work goes on with the gap named), loud (always).

  • 6a: no free drive letter on the client: closed, loud; the switched tools refuse with the reason, nothing is read or written anywhere.

  • 6a: Windows answers the letter’s realpath with a code other than ENOENT (pi-win’s probe says so): closed; the fix does not merge on that base, and the design is revisited (the one remaining option is a base under the anchor, which the plan rejected for its .. escape).

  • 6a: pi-win’s run still fails: closed; each failure is read, the product’s fixed, the harness’s fixed, and the run repeated; the release waits.

  • A recipe claims something the page does not establish: closed, loud; the cold review of the commit reads the page beside the recipe, and the recipe is cut or the page extended before it merges.

  • release prepare refuses a dependent left out: closed, loud; nothing is written, the refusal names the package, and it is added to the command.

  • The tag pipeline is not created (seen before): open, loud; the tag exists and the pipeline is created by hand (glab api -X POST projects/…​/pipeline?ref=v0.128.0), then watched as usual.

  • pi-ssh’s publish fails (first publish, restricted registry): closed, loud; release verify fails, nothing is announced, the cause is fixed on a branch, and a new patch version is cut rather than the tag moved.

  • The operator’s live test finds a bug: open, loud; a fix: issue each, after the release, as agreed; the release stands.

Limitations

  • The LAN and WAN figures are not in this release’s docs; the operator’s sessions produce them.

  • No cookbook recipe for a Windows client beyond the page’s section; 6a’s pi-win run is the Windows check.

  • 6a: a Windows client with every drive letter mapped cannot use pi over SSH’s file tools, and is told so.

Scope

  • docs/modules/ROOT/pages/tuning.adoc (the section), ssh.adoc (two anchors, the nodePath sentence, the off-switch sentence, one limitation), packages.adoc (two corrections), README.adoc (two lines), plans/remote-execution.adoc (status, archive), nav.adoc; then the release’s mechanical files (package.json versions, `CHANGELOG.adoc’s heading).

  • CHANGELOG.adoc == Unreleased, Added, one entry for phase 6 as the meta plan’s Delivery asks (remote-execution.adoc:121): the cookbook section and the corrected package pages, in two lines. The release then cuts Unreleased to == 0.128.0.

  • 6a: packages/pi-ssh/ops.ts (toolBase on a letter, freeDriveLetter, hostPath’s row), `extension.ts (the refusal with no letter), remote-tools.ts (tar’s cwd), test/windows-client.test.ts, test/parity.test.ts, test/transports.ts, test/anchor.test.ts, test/ports.test.ts, test/tools.test.ts, test/session.test.ts, test/ssh-workspace.contract.test.ts (the skips); ssh.adoc’s Windows section (the letter instead of the network prefix); `CHANGELOG.adoc Fixed (a second line under #501’s). Regression: each of pi-win’s three product failures as a case. Mutation check: the letter probe’s "exists" test, the no-letter refusal, and tar’s cwd. 6a’s Review-Context names `file-mutation-queue.js’s lines in the body, since the reason lives in pi’s own code.

  • Tests beyond 6a: none new; the docs build (`validate’s docs step) and the release verb’s own gates.

  • Delivery: MR 1 fix/windows-client-write-edit, Closes #505, after pi-win’s green run. MR 2 docs/remote-phase-6, Closes #494, Closes #488. Then the release branch and tag; the announcement; a follow-up issue for the measured LAN and WAN costs, which the operator’s sessions fill.

Out

New behaviour beyond 6a’s fixes. Posting the upstream pi-subagents issue (#504, needs a GitHub account). The pre-existing #502 and #503. A Windows remote host.

Named but not supplied to the cold reviewer: docs/modules/ROOT/pages/packages.adoc, packages/pi-ssh/{extension,connection,remote-tools}.ts, packages/pi-ssh/test/{parity,transports,anchor,ports,tools,session}.test.ts, packages/pi-{modes,workflow,remote}/package.json, tools/lib/release.mjs, pi’s dist/core/tools/file-mutation-queue.js (installed under ~/.local/share/pi-node).

Erratum (2026-10-27): 6a’s "no free letter" is null, not undefined. A caller passing an explicit undefined gets the parameter’s default, the real probe, so a test of the refusal could not reach it. inHostTerms, resultInHostTerms and errorInHostTerms take the platform and the letter; the workspace parameter went with the per-anchor share. pi-win’s probe (pi-dev-win JOTOfuBhDQUb) confirmed ENOENT for a free letter: for a path, the bare root, / separators, realpathSync and .native.

Erratum (2026-10-27): of the tools.test.ts cases pi-win saw fail, the one titled "with no remote workspace published" also publishes a remote in its last step, so it takes the POSIX-remote skip on win32 with the others. It was not a product bug.

Erratum (2026-10-27): the release needed two fixes before it could publish. The rehearsal packed eight of the ten packages and never pi-workspace or pi-ssh (#510). Once it did, it found pi refusing pi-workflow beside pi-ssh, because both register bash. pi-ssh now owns a bash that is sequential and built with pi’s shell settings, and pi-workflow registers its own only when unclaimed (#511, ADR-006 amendment). 0.128.0 to 0.128.2 were never published.

Erratum (2026-10-27): the release shipped as 0.128.3, and release verify passed with ten packages published and pins exact. The announcement’s install line names 0.128.3, not 0.128.0. The LAN and WAN figures are #512.

Edit this page · latest