Skip to content

cli: start the web runtime this CLI was published with - #893

Merged
Aymericr merged 1 commit into
mainfrom
fix/cli-runtime-follows-package-version
Sep 18, 2026
Merged

Aymericr merged 1 commit into
mainfrom
fix/cli-runtime-follows-package-version

Conversation

@Aymericr

@Aymericr Aymericr commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the CLI keeping an old web runtime after an upgrade. startEditorUnlocked launched whatever ~/.pascal/run/current-runtime.json pointed at and only called ensureWebRuntime when nothing had ever been installed or --runtime was given. So npx @pascal-app/cli@1.0.1 editor printed "Editor runtime 1.0.0 ready", pascal doctor said "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: new pinnedRuntimeVersion() reads the version in dist/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; ensureWebRuntime already reuses an installed copy or downloads and health-checks. When the editor is already running on another runtime, a new runtime-outdated progress 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: doctor warns with both versions when they differ.
  • README: documents the upgrade behaviour.
  • Tests: start switches to the pinned runtime (installed but inactive copy, no download), already-running older runtime is reported not restarted, unreadable manifest keeps the active runtime, doctor mismatch warning.

Reported by a user who upgraded to @pascal-app/cli@1.0.1 and still could not export GLB. Their immediate workaround is pascal update (or pascal update --version 1.0.1), which already installs and activates the CLI's runtime.

How to test

  1. cd packages/cli && bun test src — 107 pass (4 new).
  2. bun run check-types in packages/cli.
  3. Manual: with a 1.0.0 runtime active (~/.pascal/run/current-runtime.json), run the built CLI's pascal start; expect a runtime download and "Editor runtime installed". Start it again while running with a different pinned version: expect the ! notice and alreadyRunning.

Screenshots / screen recording

N/A — CLI behaviour.

Checklist

  • I've tested this locally with bun dev (unit tests exercise the real start/stop path with a fake runtime server)
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

🤖 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 new pinnedRuntimeVersion()). 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 a runtime-outdated progress event. The terminal shows a ! warning suggesting pascal restart, and pascal doctor warns 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.

`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>
@pascal

pascal Bot commented Sep 18, 2026

Copy link
Copy Markdown

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

@Aymericr
Aymericr merged commit 37e2239 into main Sep 18, 2026
3 checks passed
@Aymericr
Aymericr deleted the fix/cli-runtime-follows-package-version branch September 18, 2026 15:20

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 01fdc53. Configure here.

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.

1 participant