Desktop runtime pin goes stale on every release, silently falling back to a live npm install
Found while cutting v0.12.266.
CLAWROUTER_PACKAGE_VERSION (apps/desktop/electron/core/runtime.ts) is asserted equal to the root package.json version, so a release bump moves it. findPinnedPackage() then looks for that exact version inside the staged runtime — but the staged runtime comes from apps/desktop/runtime/pnpm-lock.yaml, which reaches @blockrun/clawrouter transitively through @blockrun/clawrouter-codex, and stage:runtime runs pnpm install --frozen-lockfile.
So on every release the constant is one version ahead of what the lockfile can stage. findPinnedPackage() misses, and ensureNpmPackage() falls through to npm install @blockrun/clawrouter@<version> at Connect time. It still works — the install is version-pinned, runs --ignore-scripts, and the resulting version is verified — but it needs the network and it is not the frozen runtime the pin exists to provide.
The ordering is genuinely circular: the lockfile cannot resolve a version that is not yet on npm, and the version is published from the release commit. So relocking is a post-publish step, and there is currently nothing that makes it happen or notices when it did not.
tests/manager.test.ts demonstrated the fallback rather than describing it — its fixture hardcoded 0.12.265, and the v0.12.266 bump dropped it into the npm-install path with a misleading error. Fixed by importing the constant, but that only fixes the test.
Worth considering:
- A post-publish step that relocks
apps/desktop/runtimeand commits it, so a packaged build always stages the version it asks for. - Or depend on
@blockrun/clawrouterdirectly inruntime/package.jsonso the pin is explicit rather than a transitive accident. - Either way, have
ensureNpmPackage()say out loud when it falls back, so a packaged build that lost its frozen runtime is visible instead of merely slower.
apps/desktop/tests/runtime-version.test.ts currently asserts only that the lockfile stages exactly one copy — the equality assertion is deliberately absent, with the reason in a comment pointing here.
🤖 Generated with Claude Code
https://claude.ai/code/session_017wMqBG57KZjH7TKybHN8BS