You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): pnpm patchy refresh fails across a release change #460
After the instance's release digest changes, pnpm patchy refresh in an existing repo fails with Could not inspect the repo's installed toolchain.
Cause
Refresh moves node_modules aside to preserve the previous installation, installs the new pin, then runs the toolchain inspector, which it looks for next to the running CLI (…/node_modules/patchy/dist/toolchainChild.js). The running CLI is the old pinned copy, and its folder was just moved, so the child script isn't there (Cannot find module …/toolchainChild.js).
Repro: change the instance's packed release (restarting pnpm dev after any change bundled into the package is enough), then run pnpm patchy refresh in any repo pinned to the previous release.
Running the same refresh with the global patchy works, because that CLI doesn't live inside the repo's node_modules.
Both demo-prep build agents hit this independently on 2026-10-01. Related: #459 (pnpm lockfile integrity), which hits the same refresh path.
Category: bug Summary: After the release changes, refresh (and add/remove) run from a repo's own pnpm patchy must check the toolchain with the newly installed release.
Current behavior:
Reproduced on a local pnpm dev up instance. Make a repo with patchy init, change the instance's packed release (its digest moved from 464c6b… to e428e4…), then run pnpm patchy refresh in the repo. It exits 1 with Could not inspect the repo's installed toolchain. Rollback is clean: the old pin and old node_modules come back. The global patchy refresh succeeds on the same repo.
Cause: the repo-local CLI runs from the pnpm package folder named after the old release digest. Refresh moves node_modules aside, installs the new pin, then starts the toolchain inspector subprocess (runToolchain with { inspect }). It finds toolchainChild.js next to the running CLI, and that folder no longer exists. The generate step does not break because runInstalledGenerate already runs the newly installed node_modules/patchy/dist/index.js.
This blocks #416. Every deploy changes the release digest. The repo's AGENTS.md and the global patchy skill both tell agents to run pnpm patchy refresh inside a patch repo. add and remove go through the same refresh path, so after a deploy all three commands fail in every existing repo.
Desired behavior:
After refresh has installed the release, the toolchain check runs with the installed release's toolchainChild, not the running CLI's. This follows the existing rule that the installed release owns config execution and chooses the engine pin. The check gives the same result and warnings no matter which CLI started the refresh: the global patchy, the repo's pnpm patchy, or the workspace CLI the tests use.
After an install, refresh must not load any file from the running CLI's package folder. Today the toolchain inspector is the only such file.
Key interfaces:
runToolchain in the CLI's toolchain process module: today it always finds the child next to import.meta.url. Refresh needs to point it at the installed release's dist/toolchainChild.js under the repo's node_modules/patchy, the same way runInstalledGenerate finds the installed dist/index.js. Builds and publishes keep finding the child next to the running CLI.
The inspect <toolchain json> argv and the stdout JSON reply are a private protocol between two CLI versions, just like __generate. Keep it unchanged.
Acceptance criteria:
A test runs refresh with the repo's installed CLI (node <repo>/node_modules/patchy/dist/index.js refresh --json) across a change in release digest. It exits 0, reports changed.pin: true and leaves the new pin in package.json. The existing refresh tests only run the workspace CLI, which lives outside the repo, so they never hit this.
The same refresh with the workspace CLI still passes, and its toolchain warnings are unchanged.
pnpm patchy refresh in a pnpm dev up workspace repo succeeds after a restart that changes the packed release.
A failed refresh still rolls back the pin, lockfile and node_modules as before.
Out of scope:
How builds and publishes find the toolchain child.
The wording of the Could not inspect… error or how the child's cause is shown.
Delegating whole commands from the global CLI to the repo-local one, or the reverse.
Activity
allisonmahmood commentedon Oct 2, 2026
Agent Brief
Category: bug
Summary: After the release changes, refresh (and
add/remove) run from a repo's ownpnpm patchymust check the toolchain with the newly installed release.Current behavior:
Reproduced on a local
pnpm dev upinstance. Make a repo withpatchy init, change the instance's packed release (its digest moved from464c6b…toe428e4…), then runpnpm patchy refreshin the repo. It exits 1 withCould not inspect the repo's installed toolchain.Rollback is clean: the old pin and oldnode_modulescome back. The globalpatchy refreshsucceeds on the same repo.Cause: the repo-local CLI runs from the pnpm package folder named after the old release digest. Refresh moves
node_modulesaside, installs the new pin, then starts the toolchain inspector subprocess (runToolchainwith{ inspect }). It findstoolchainChild.jsnext to the running CLI, and that folder no longer exists. The generate step does not break becauserunInstalledGeneratealready runs the newly installednode_modules/patchy/dist/index.js.This blocks #416. Every deploy changes the release digest. The repo's
AGENTS.mdand the globalpatchyskill both tell agents to runpnpm patchy refreshinside a patch repo.addandremovego through the same refresh path, so after a deploy all three commands fail in every existing repo.Desired behavior:
After refresh has installed the release, the toolchain check runs with the installed release's
toolchainChild, not the running CLI's. This follows the existing rule that the installed release owns config execution and chooses the engine pin. The check gives the same result and warnings no matter which CLI started the refresh: the globalpatchy, the repo'spnpm patchy, or the workspace CLI the tests use.After an install, refresh must not load any file from the running CLI's package folder. Today the toolchain inspector is the only such file.
Key interfaces:
runToolchainin the CLI's toolchain process module: today it always finds the child next toimport.meta.url. Refresh needs to point it at the installed release'sdist/toolchainChild.jsunder the repo'snode_modules/patchy, the same wayrunInstalledGeneratefinds the installeddist/index.js. Builds and publishes keep finding the child next to the running CLI.inspect <toolchain json>argv and the stdout JSON reply are a private protocol between two CLI versions, just like__generate. Keep it unchanged.Acceptance criteria:
node <repo>/node_modules/patchy/dist/index.js refresh --json) across a change in release digest. It exits 0, reportschanged.pin: trueand leaves the new pin inpackage.json. The existing refresh tests only run the workspace CLI, which lives outside the repo, so they never hit this.pnpm patchy refreshin apnpm dev upworkspace repo succeeds after a restart that changes the packed release.node_modulesas before.Out of scope:
Could not inspect…error or how the child's cause is shown.fix(patchy): pnpm patchy refresh no longer fails after a release change
fix(patchy): pnpm patchy refresh no longer fails after a release change
fix(patchy): pnpm patchy refresh no longer fails after a release chan…