fix(open): detect VS Code/Cursor via .app bundle, not just PATH#171
Merged
Conversation
The tray's Open In... menu hides VS Code on a clean Mac because detectOpenTargets() probed PATH only for 'code'/'cursor'. A freshly dragged-in VS Code or Cursor has no PATH shim until the user runs "Shell Command: Install 'code' command in PATH", and the tray spawns the CLI via a login shell that doesn't source ~/.zshrc, so PATH-only detection misses common installs. Add a macOS .app-bundle fallback (Visual Studio Code.app / Cursor.app in /Applications or ~/Applications) to both detection and the launch path: resolveVscodeCli() prefers the PATH shim, then the bundled code/cursor binary, so 'agentbox code' / 'open --in vscode' launch via the real CLI (avoiding the open scheme:// %2B-encoding bug) even with no shim. Codex stays app-only + Hetzner-only by design (needs Codex.app for the codex:// deep link and a persistent per-box SSH identity).
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The tray's Open In… menu was hiding VS Code on otherwise-ready Macs (e.g. a clean Mac mini), and the "some boxes show Codex, others don't" confusion.
Root causes, from
apps/cli/src/commands/_open-in.ts:VS Code — a real bug.
detectOpenTargets()probed PATH only (pathHasBinary('code') || pathHasBinary('cursor')) with no.app-bundle fallback. A freshly dragged-in VS Code / Cursor has nocode/cursorshim on PATH until the user runs "Shell Command: Install 'code' command in PATH." Worse, the tray spawns the CLI through/bin/zsh -lc(a login shell that sources~/.zprofilebut not~/.zshrc), so PATH additions made only in.zshrcare invisible to the probe too. Net effect: a perfectly usable VS Code install is undetectable → the menu item disappears.Codex — by design, not a bug.
codex.providers = ['hetzner'], so the Codex row only ever appears for Hetzner boxes (Codex attaches later over its own persistent SSH identity, which only Hetzner has). It also requires the desktop appCodex.appfor thecodex://deep link — thecodexCLI alone isn't enough. So "shows for some boxes, not others" = a mix of providers, and "not on a clean Mac" =Codex.appnot installed. Both are expected; documented here, not changed.Fix
Add a macOS
.app-bundle fallback for the VS Code family, to both detection and launch:detectOpenTargets().vscode.availablenow also checksVisual Studio Code.app/Cursor.appin/Applicationsand~/Applications.resolveVscodeCli()prefers the PATH shim, then the bundledcode/cursorbinary (…/Contents/Resources/app/bin/…).agentbox code/agentbox open --in vscodenow launch via the real CLI even with no PATH shim — which also avoids theopen <scheme>://…protocol-handler path whose%2BURL-encoding can break the Remote attach./Applicationsthere).Verification
apps/cli/test/open-in.test.ts— added cases for bundle detection (macOS-only) andresolveVscodeCli(PATH → bundle → undefined). 21 tests pass.pnpm typecheck+eslintclean.code/cursorstripped from PATH butCursor.apppresent,agentbox open --targets --jsonnow reportsvscode.available: true(wasfalsebefore this change).No public-doc changes — the detection specifics aren't documented on the site.
Note
Low Risk
Localized CLI open-target detection and IDE spawn paths with seam-injected fs checks; behavior on Linux unchanged and coverage added in unit tests.
Overview
Fixes Open In… and
agentbox codetreating VS Code/Cursor as missing when only the macOS.appis installed (nocode/cursorPATH shim).Adds
resolveVscodeCli: prefer the PATH binary, then the bundled CLI underVisual Studio Code.app/Cursor.appin/Applicationsand~/Applications.detectOpenTargets().vscode.availablenow uses the same idea (PATH or bundle).agentbox codelaunch paths use the resolved binary so attach goes through--folder-uriinstead of theopen vscode://…fallback when possible. Bundle fallback is macOS-only; Linux still requires PATH.Tests cover bundle-based availability and
resolveVscodeCliresolution order.Reviewed by Cursor Bugbot for commit 1aa5983. Configure here.