Skip to content

guide users on unsupported node instead of crashing on launch - #273

Merged
kevinjosethomas merged 7 commits into
mainfrom
eng-4260
Jul 16, 2026
Merged

guide users on unsupported node instead of crashing on launch#273
kevinjosethomas merged 7 commits into
mainfrom
eng-4260

Conversation

@kevinjosethomas

@kevinjosethomas kevinjosethomas commented Jun 26, 2026

Copy link
Copy Markdown
Member
  • installing under node 20 let the cli download but crash on first launch with an opaque stack trace, since the bundle links node 22+ apis before any code runs.
  • the bin entry is now a tiny dependency-free preflight that checks the node version and prints clear upgrade guidance, loading the real startup only once the check passes.
  • also bumps the declared engines floor to node 22 so npm warns at install time.

Note

Low Risk
Startup-path refactor with isolated, tested version guard; no auth, data, or runtime behavior changes on supported Node.

Overview
On Node 20 (and other versions below 22.8.0), the CLI could install but crash at launch with an opaque error because the bundle links Node 22+ APIs before any user-facing code ran.

cli.ts is now a thin entry that runs a dependency-free assertNodeVersion check first, prints upgrade/reinstall steps, and exits with code 1 when unsupported. Only after the check passes does it dynamically import cli-main.ts, which holds the previous startup path (runCli: compile cache, daemon early launch, owned-session worker, undici dispatcher, main).

engines.node is raised from >=20.x to >=22.8.0 on the root and coding-agent packages so npm can warn at install time. Bun skips the guard; prereleases of exactly 22.8.0 are rejected. Vitest coverage was added for the version guard.

Reviewed by Cursor Bugbot for commit 0508a36. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Guide users on unsupported Node versions instead of crashing on launch

  • Adds a dependency-free version guard in node-version-check.ts that runs before the module graph loads, logging actionable upgrade instructions and exiting with code 1 when Node is below 22.8.0.
  • Refactors cli.ts to check the Node version first, then dynamically import and invoke runCli() from the new cli-main.ts only on supported versions.
  • Raises the minimum Node requirement from >=20.0.0 to >=22.8.0 in engines.node for both the root and coding-agent packages.
  • Behavioral Change: Bun runtimes bypass the version check; prerelease builds of the exact minimum version (22.8.0-rc.x) are rejected.

Macroscope summarized 0508a36.

@linear

linear Bot commented Jun 26, 2026

Copy link
Copy Markdown
ENG-4260 Incorrect node version breaks first launch

Having an outdated Node version (I think 20) leads to a state where we can download prime-agent but it completely breaks on first launch. This is a horrible user experience— we should detect it and guide the user through.

Here is Claude's diagnoses:
Let me look at what got installed in this directory.

Listed 1 directory (ctrl+o to expand)

⏺️ prime-agent is installed. Let me check what it is and its help.

⏺️ Bash(ls -la /Users/eligottlieb/.nvm/versions/node/v20.18.1/bin/prime-agent; echo "---"; readlink -f /Users/eligottlieb/.nvm/versions/node/v20.18.1/bin/prime-agent;

e…)

⎿  lrwxr-xr-x 1 eligottlieb 50 Jun 25 13:41 /Users/eligottlieb/.nvm/versions/node/v20.18.1/bin/prime-agent -> ../lib/node_modules/prime-agent/dist/bundle/cli.

js


… +12 lines (ctrl+o to expand)

⏺️ The install worked but there's a Node version problem. enableCompileCache requires Node 22+, and your active Node is v20.18.1. Let me confirm requirements and

what's available.

⏺️ Bash(echo "---PKG engines/bin---"; cat /Users/eligottlieb/.nvm/versions/node/v20.18.1/lib/node_modules/prime-agent/package.json 2>/dev/null | python3 -c "import

sys,…)

⎿  ---PKG engines/bin---

name prime-agent

version 0.2.2

… +12 lines (ctrl+o to expand)

⏺️ The issue is clear: prime-agent v0.2.2 was installed under your Node v20.18.1 (currently active via nvm), but its bundle uses enableCompileCache, which only exists

in Node 22+. Let me confirm it runs on Node 22:

⏺️ Bash(~/.nvm/versions/node/v22.21.1/bin/node /Users/eligottlieb/.nvm/versions/node/v20.18.1/lib/node_modules/prime-agent/dist/bundle/cli.js --help 2>&1 | head -40)

⎿  prime-agent - AI coding assistant with an ipython tool

Usage:

… +37 lines (ctrl+o to expand)

⏺️ It works fine under Node 22 — the only problem is your active Node is v20.18.1, and prime-agent's bundle needs Node 22+ (it uses enableCompileCache). The

prime-agent command on your PATH points into the v20 install, so running it bare fails.

Quick way to run it right now

~/.nvm/versions/node/v22.21.1/bin/node \

~/.nvm/versions/node/v20.18.1/lib/node_modules/prime-agent/dist/bundle/cli.js

That launches the interactive chat TUI. You can append a message or files, e.g.:

~/.nvm/versions/node/v22.21.1/bin/node \

~/.nvm/versions/node/v20.18.1/lib/node_modules/prime-agent/dist/bundle/cli.js \

"explain this repo" README.md

Proper fix (recommended) — reinstall under Node 22

So that the plain prime-agent command just works:

nvm use 22.21.1

npm i -g prime-agent

prime-agent --help

Then prime-agent will resolve to the Node 22 install and you can run it directly.

A couple of usage notes from its --help:

  • Default provider is google. To use a different model: prime-agent --provider anthropic --model claude-opus-4-8. It reads API keys from env vars (or pass

--api-key).

  • prime-agent -p "..." for non-interactive one-shot output; -c to continue the last session.

Want me to go ahead and reinstall it under Node 22 for you so the bare prime-agent command works?

Review in Linear

Comment thread packages/coding-agent/src/cli/node-version-check.ts Outdated
@kevinjosethomas
kevinjosethomas merged commit 10ef94a into main Jul 16, 2026
11 checks passed
@kevinjosethomas
kevinjosethomas deleted the eng-4260 branch July 16, 2026 23:50
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
…ntellect-ai#273)

* guide users on unsupported node instead of crashing on launch

* point node-version guidance at the releases page instead of a wrong npm name

* fix node version preflight
thomaswillner pushed a commit to thomaswillner/prime-agent that referenced this pull request Aug 29, 2026
…rimeIntellect-ai#271 remains

Closes the record for this session.

- All five briefed PRs merged (PrimeIntellect-ai#268, PrimeIntellect-ai#263, PrimeIntellect-ai#270, PrimeIntellect-ai#269, PrimeIntellect-ai#273); main is c84855d.
  Issues PrimeIntellect-ai#266 and PrimeIntellect-ai#272 closed by their PRs. PrimeIntellect-ai#271 is the only open brief and
  was never authorised, so never started. Runtime testing is unblocked.
- The CI outage (13:51Z-15:47Z) was account-level and hit main identically;
  recovery was visible as `changes` taking 9s with real steps instead of 2s
  with none. Nothing in the diff ever needed changing.
- Records the scope misjudgement worth carrying forward: a Codex P1 mapped
  directly to an acceptance checkbox I had deferred as out of scope. When a
  finding maps to an acceptance criterion it is in scope by definition.
- Records the auto-merge hazard: squash composes the commit message from the
  PR body, so a body left stale after a review round writes false claims into
  main permanently. Rewrite the body before merge; keep corrections visible.
- Records a published test claim that had not been executed, and the rule
  that follows from it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6
thomaswillner added a commit to thomaswillner/prime-agent that referenced this pull request Aug 29, 2026
…e-notes lesson (#13)

* docs(spx-v2): verification pass, queue state, and self-refinement record

No code written this session — a verification pass over already-delivered
work plus the queue-state answer.

Records, so future sessions do not repeat them:

- The audit-challenge / V1-coverage / rag-tot-cot-challenge / corrected-input
  deliverable ALREADY EXISTS (AUDIT_CHALLENGE sections A-D and
  PRIME_AGENT_INPUT_SPX_V2). An operator prompt has now asked for it in at
  least two sessions; redoing it is inventing work.
- Verified queue state from GitHub: PrimeIntellect-ai#266/PR PrimeIntellect-ai#268 merged (and PrimeIntellect-ai#263 with it,
  now main f64029a); PrimeIntellect-ai#265/PR PrimeIntellect-ai#269 and PrimeIntellect-ai#264/PR PrimeIntellect-ai#270 open with CI in flight;
  PrimeIntellect-ai#272 and PrimeIntellect-ai#271 filed, unstarted, no lane.
- Errors and corrections: settle elapsed time from GitHub workflow-run
  timestamps, never the container clock; add_repo push access was
  classifier-denied so a remote session may hold read-only and cannot push;
  register_repo_root denial falls back to reading CLAUDE.md directly.
- MATS/superpowers/routing settled empirically with the exact commands used,
  so the search is not repeated: they are Mac-harness resident, and PrimeIntellect-ai#272/PrimeIntellect-ai#271
  already carry auto-dispatch, which is what routes them to the maker fleet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

* docs(spx-v2): implementation-session addendum — access, setup, CI outage, self-review

Appends the second half of the session to the notes: implementing PrimeIntellect-ai#272 after
the operator corrected two access assumptions.

The corrections matter more than the code:
- push DOES work; "I cannot push" was inferred from add_repo's access label
  rather than tested. A dry-run push proved it. Also: the refspec push form is
  classifier-denied while `git push -u origin <branch>` succeeds.
- this host is not the MacBook (uname, no /Users, no ~/.prime).

Also records the environment setup the Makefile assumes (venv before
v2-install, ruff 0.15.22 via python -m, seeding the gitignored account.yaml,
and proving PYTHONPATH beats editable installs in a worktree), the method that
diagnosed the repo-wide CI outage in two calls (zero recorded steps, then the
same workflow red on main), and two test defects self-review caught before
pushing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

* docs(spx-v2): final queue state — PrimeIntellect-ai#273 merged, only PrimeIntellect-ai#271 remains

Closes the record for this session.

- All five briefed PRs merged (PrimeIntellect-ai#268, PrimeIntellect-ai#263, PrimeIntellect-ai#270, PrimeIntellect-ai#269, PrimeIntellect-ai#273); main is c84855d.
  Issues PrimeIntellect-ai#266 and PrimeIntellect-ai#272 closed by their PRs. PrimeIntellect-ai#271 is the only open brief and
  was never authorised, so never started. Runtime testing is unblocked.
- The CI outage (13:51Z-15:47Z) was account-level and hit main identically;
  recovery was visible as `changes` taking 9s with real steps instead of 2s
  with none. Nothing in the diff ever needed changing.
- Records the scope misjudgement worth carrying forward: a Codex P1 mapped
  directly to an acceptance checkbox I had deferred as out of scope. When a
  finding maps to an acceptance criterion it is in scope by definition.
- Records the auto-merge hazard: squash composes the commit message from the
  PR body, so a body left stale after a review round writes false claims into
  main permanently. Rewrite the body before merge; keep corrections visible.
- Records a published test claim that had not been executed, and the rule
  that follows from it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

* docs(spx-v2): correct the queue state — the last brief landed while idle

Records, without editing the now-false text away, that sections 9 and 4 went
stale five hours after they were written. The correction matters more than the
content: this file exists to stop sessions trusting notes over GitHub, and it
caught its own author.

- main is 8d2139c. Between 16:12Z and 21:54Z the fleet merged PrimeIntellect-ai#279 (the PrimeIntellect-ai#58
  alert-bridge race, FIXED — stop carrying it as a standing exception), PrimeIntellect-ai#278
  (AGENTS.md invariants), PrimeIntellect-ai#283 (repo cleanup), and PrimeIntellect-ai#284, which delivered the
  last brief and closed PrimeIntellect-ai#165 with a keyword.
- Section 3's routing conclusion was confirmed by events: PrimeIntellect-ai#271 was delivered
  by the Mac maker fleet via auto-dispatch, exactly as argued, and the remote
  session correctly declined to open a second lane.
- Flags issue-state drift: PrimeIntellect-ai#271, PrimeIntellect-ai#276 and PrimeIntellect-ai#274 are delivered and merged yet
  still open, because a title reference is not a closing keyword. That is the
  mirror image of the hazard the V2 CLAUDE.md documents, and it leaves
  open-work disagreeing with main. Operator action, named as such.
- Records the residual PrimeIntellect-ai#284 deferred on stated grounds (PrimeIntellect-ai#286), which is a
  known open edge on the LIVE path.
- States the next slice: S4 / PrimeIntellect-ai#236, the first whose exit criteria need a real
  broker order. Certification stays 0/12; the system has never placed a trade.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

---------

Co-authored-by: Claude <noreply@anthropic.com>
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