Skip to content

fix(setup): prefer newest local CLI and find Windows npm cache - #878

Merged
samjulien merged 1 commit into
mainfrom
codex/openbot-cli-discovery
Oct 28, 2026
Merged

samjulien merged 1 commit into
mainfrom
codex/openbot-cli-discovery

Conversation

@samjulien

Copy link
Copy Markdown
Collaborator

Follow-up to #811 for Dusty's two non-blocking review notes.

Local Intelligence discovery previously chose the first installed CopilotKit CLI before looking at the npx cache. An older global install could therefore hide a newer cached CLI and fail on local list. Discovery now selects the newest valid version across installed copies and complete npx cache installations, preferring installed copies on equal versions and using a deterministic path tie-breaker.

On Windows, the default npx cache now resolves under %LOCALAPPDATA%/npm-cache, with a home-directory fallback. Explicit npm_config_cache and NPM_CONFIG_CACHE overrides retain their precedence. Discovery remains offline, and genuine CLI failures still fail rather than silently falling back.

Validation:

  • 72 tests passed (521 assertions), including stale global/local installations, newer cached and installed versions, equal-version ties, Windows cache defaults and overrides, and existing authentication discovery regressions.
  • Changed-file formatting and lint, explicit TypeScript checking of the setup scripts and tests, and the server build passed.
  • Windows tests simulate platform path selection; native Windows sign-in was not exercised.

@dustywusty dustywusty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, both notes from #811 are covered.

  • Installed and cached copies are now ranked together, newest version first. On equal versions the installed copy wins, then path order. A stale global install can no longer hide a newer cached CLI.
  • On Windows, the npx cache defaults to %LOCALAPPDATA%\npm-cache, and explicit npm_config_cache / NPM_CONFIG_CACHE overrides keep priority.

Checked locally: the 40 tests across local-intelligence-cli.test.ts and self-hosted-learning.test.ts pass. A real lookup with a Finder-style PATH still picks the cached CLI and resolves http://localhost:56323 to http://cpk.localhost:56324. As you noted, Windows is only simulated here, which is fine while the CLI refuses Windows.

@samjulien
samjulien merged commit dc3cab2 into main Oct 28, 2026
19 checks passed
@samjulien
samjulien deleted the codex/openbot-cli-discovery branch October 28, 2026 21:58
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.

2 participants