Skip to content

Improve upgrade command installation method detection robustness#960

Merged
ctate merged 2 commits intomainfrom
fix/issue-954-1774154959268
Mar 22, 2026
Merged

Improve upgrade command installation method detection robustness#960
ctate merged 2 commits intomainfrom
fix/issue-954-1774154959268

Conversation

@ctate
Copy link
Collaborator

@ctate ctate commented Mar 22, 2026

The upgrade command was failing to detect installation method for users who installed via pnpm, yarn, or bun, showing "Could not detect installation method" errors.

Changes Made

  • Added support for additional package managers: Extended detection to include pnpm, yarn, and bun alongside existing npm, Homebrew, and Cargo support
  • Implemented install-time marker system: Modified postinstall.js to write a .install-method marker file during installation, providing reliable detection that doesn't depend on fragile path heuristics
  • Enhanced path-based fallback detection: Improved executable path analysis to better identify installation locations for all supported package managers
  • Added command probing: Implemented fallback checks that query package managers directly to verify global installations

The detection now follows this robust hierarchy:

  1. Read install-time marker file (most reliable)
  2. Analyze executable path patterns
  3. Probe package managers via subprocess calls

This ensures users can successfully upgrade regardless of their chosen package manager.

Fixes #954

The upgrade command was failing to detect installation method for users who installed via pnpm, yarn, or bun, showing "Could not detect installation method" errors.

## Changes Made

- **Added support for additional package managers**: Extended detection to include pnpm, yarn, and bun alongside existing npm, Homebrew, and Cargo support
- **Implemented install-time marker system**: Modified `postinstall.js` to write a `.install-method` marker file during installation, providing reliable detection that doesn't depend on fragile path heuristics
- **Enhanced path-based fallback detection**: Improved executable path analysis to better identify installation locations for all supported package managers
- **Added command probing**: Implemented fallback checks that query package managers directly to verify global installations

The detection now follows this robust hierarchy:
1. Read install-time marker file (most reliable)
2. Analyze executable path patterns
3. Probe package managers via subprocess calls

This ensures users can successfully upgrade regardless of their chosen package manager.

Fixes #954
@vercel
Copy link
Contributor

vercel bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser Ready Ready Preview, Comment Mar 22, 2026 2:26pm
agent-browser-env-demo Ready Ready Preview, Comment Mar 22, 2026 2:26pm

- Prevent bin/.install-method marker file from being accidentally
  committed during development
- Add comment clarifying that yarn global upgrade path only works
  with Yarn Classic (v1), not Yarn Berry (v2+)
@ctate ctate merged commit fb1e860 into main Mar 22, 2026
12 checks passed
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.

upgrade command seems not robust, cant detect installtion method

1 participant