cli: start the web runtime this CLI was published with - #893
Conversation
`pascal editor` (and start/restart/open/resume) launched whatever runtime the active pointer in ~/.pascal/run/current-runtime.json named, and only provisioned a runtime when none had ever been installed or --runtime was passed. A CLI upgrade therefore kept running the previous runtime for good: `npx @pascal-app/cli@1.0.1 editor` reported "Editor runtime 1.0.0 ready" and `doctor` "Installed web runtime 1.0.0", so the GLB export fix in the 1.0.1 runtime never reached that user. README already promised the runtime "for this CLI version". Now the version pinned in dist/runtime-source.json wins unless the caller pins a runtime explicitly (--runtime or PASCAL_BUNDLED_RUNTIME_DIR): a mismatched active runtime is re-provisioned on start (download once, health-checked as before). When the editor is already running on an older runtime the CLI says so and points at `pascal restart`; `pascal doctor` reports both versions. Running from source, where the package manifest is absent, keeps the active runtime. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: d101028e-d8a5-4328-b95f-4415af8224a2 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 01fdc53. Configure here.
| paths: options.paths, | ||
| runtimeSource: options.runtimeSource, | ||
| sourceFile: options.runtimeSourceFile, | ||
| environment: options.environment, |
There was a problem hiding this comment.
Pin check overwrites explicit activations
High Severity
The new pin check in startEditorUnlocked also runs after activateEditorRuntime and restartEditor, which do not pass a runtime override. An explicit pascal update --version or --runtime install is replaced by the pinned runtime, while update still reports the candidate as active.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 01fdc53. Configure here.


What does this PR do?
Fixes the CLI keeping an old web runtime after an upgrade.
startEditorUnlockedlaunched whatever~/.pascal/run/current-runtime.jsonpointed at and only calledensureWebRuntimewhen nothing had ever been installed or--runtimewas given. Sonpx @pascal-app/cli@1.0.1 editorprinted "Editor runtime 1.0.0 ready",pascal doctorsaid "Installed web runtime 1.0.0", and the 1.0.1 runtime with the GLB export fix (#888) was never downloaded. The README already documented resolution as "the runtime installed for this CLI version".editor-process.ts: newpinnedRuntimeVersion()reads the version indist/runtime-source.json(null with--runtime,PASCAL_BUNDLED_RUNTIME_DIR, or when the manifest is unreadable, e.g. running from source). Start provisions the runtime when the active one differs;ensureWebRuntimealready reuses an installed copy or downloads and health-checks. When the editor is already running on another runtime, a newruntime-outdatedprogress event is emitted instead of restarting under the user.bin/pascal.ts+terminal-progress.ts: prints! Editor runtime 1.0.0 is running; this CLI ships 1.0.1. Run "pascal restart" to switch.diagnostics.ts:doctorwarns with both versions when they differ.Reported by a user who upgraded to
@pascal-app/cli@1.0.1and still could not export GLB. Their immediate workaround ispascal update(orpascal update --version 1.0.1), which already installs and activates the CLI's runtime.How to test
cd packages/cli && bun test src— 107 pass (4 new).bun run check-typesinpackages/cli.~/.pascal/run/current-runtime.json), run the built CLI'spascal start; expect a runtime download and "Editor runtime installed". Start it again while running with a different pinned version: expect the!notice andalreadyRunning.Screenshots / screen recording
N/A — CLI behaviour.
Checklist
bun dev(unit tests exercise the real start/stop path with a fake runtime server)bun checkto verify)mainbranch🤖 Generated with Claude Code
Note
Medium Risk
Changes core editor startup and runtime selection after CLI upgrades; wrong pinning logic could break starts or surprise users with runtime switches, though behavior is covered by new tests and explicit overrides remain via
--runtime/ env.Overview
Fixes a bug where upgrading the CLI could still launch an older web runtime left active in
~/.pascal, so users never got the runtime bundled with the new package.The CLI now reads a pinned runtime version from the package’s
runtime-source.json(via newpinnedRuntimeVersion()). On editor start it provisions/switches when the active runtime differs; if the editor is already healthy on an older version it does not restart and instead emits aruntime-outdatedprogress event. The terminal shows a!warning suggestingpascal restart, andpascal doctorwarns when installed vs pinned versions mismatch. README documents per-CLI-version pinning. Tests cover switch-on-start, already-running notice, unreadable manifest fallback, and doctor output.Reviewed by Cursor Bugbot for commit 01fdc53. Bugbot is set up for automated code reviews on this repo. Configure here.