Skip to content

fix(desktop): resolve agent command path for DMG builds#372

Merged
wesbillman merged 3 commits into
mainfrom
fix-acp-release-build
Apr 20, 2026
Merged

fix(desktop): resolve agent command path for DMG builds#372
wesbillman merged 3 commits into
mainfrom
fix-acp-release-build

Conversation

@wesbillman
Copy link
Copy Markdown
Collaborator

Summary

  • Resolve the agent command (e.g. claude-agent-acp) to a full path via resolve_command() before passing it to sprout-acp, matching how we already handle the harness and MCP server commands
  • Fixes both agent startup (runtime.rs) and model discovery (agent_models.rs)
  • Uses soft fallback so custom/unknown agent paths still pass through

Context

When the desktop app is launched from a DMG via Finder, the inherited PATH is minimal (/usr/bin:/bin:/usr/sbin:/sbin). npm-installed binaries like claude-agent-acp aren't on this PATH. The desktop already resolves sprout-acp and sprout-mcp-server using resolve_command() (which does login-shell PATH lookup), but was passing the agent command as a raw string.

Test plan

  • Build a release DMG
  • Launch from Finder (not terminal)
  • Add a Claude Code agent and start it — should find claude-agent-acp
  • Open model picker — model discovery should work
  • Verify just staging still works (no regression)

wesbillman and others added 3 commits April 20, 2026 12:12
The desktop now resolves the agent command (e.g. claude-agent-acp) to a
full path via resolve_command() before passing it to sprout-acp via
SPROUT_ACP_AGENT_COMMAND. This matches how we already handle the harness
(sprout-acp) and MCP server (sprout-mcp-server) commands.

Fixes ACP agent startup when launched from Finder where PATH is minimal
(/usr/bin:/bin:/usr/sbin:/sbin) and npm-installed binaries aren't found.
Uses soft fallback (unwrap_or_else) so custom/unknown agent paths still
pass through to sprout-acp for its own error handling.
Same fix as the runtime path: resolve the agent command to a full path
via resolve_command() before passing it to sprout-acp via
SPROUT_ACP_AGENT_COMMAND in get_agent_models(). Without this, model
discovery fails on DMG builds launched from Finder where PATH is minimal.
When Sprout.app launches from a DMG via Finder, the inherited PATH is
minimal (/usr/bin:/bin:/usr/sbin:/sbin). PR #372 resolved agent binaries
to full paths, but spawned processes (sprout-acp) still inherited the
anemic PATH. This meant #!/usr/bin/env node scripts like claude-agent-acp
couldn't find their runtime.

Adds login_shell_path() which probes the user's login shell for the full
PATH (cached via OnceLock for the app lifetime, noise-filtered to handle
chatty shell profiles). Injects this PATH into both agent startup
(runtime.rs) and model discovery (agent_models.rs).

Also refactors find_via_login_shell() and login_shell_path() to share a
common run_in_login_shell() helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wesbillman wesbillman merged commit c6c2748 into main Apr 20, 2026
13 checks passed
@wesbillman wesbillman deleted the fix-acp-release-build branch April 20, 2026 20:16
fsola-sq added a commit that referenced this pull request Apr 20, 2026
…-binding

* origin/main:
  fix(desktop): eliminate agent startup beachball (#374)
  fix(desktop): resolve agent command path for DMG builds (#372)
  fix(desktop): remove stale sprout-admin prereq, add sidecar tooling (#371)
  Add server cross-compile and macOS desktop build CI jobs (#369)
  Fix forum post card bugs on desktop and mobile (#370)
  fix(desktop): kill WebSocket flood and fix Markdown <p><div> nesting (#368)
  perf: caching, batched DM resolution, bounded audit, global kind index (#367)
  fix: staging to generate stubs as needed (#366)
  chore(deps): update rust crate axum to v0.8.9 (#365)
  chore(deps): update dependency @tanstack/react-router to v1.168.22 (#364)
  feat(desktop): autoscroll thread sidebar for new replies (#363)
  fix(desktop): eliminate 10+ second UI freeze on startup (#361)
  feat(desktop): bundle sprout-acp and sprout-mcp-server as Tauri sidecars (#362)
  Remove release pipeline from public repo (#360)

Amp-Thread-ID: https://ampcode.com/threads/T-019dab7a-5979-7401-83a1-509b9adfe4a0
Co-authored-by: Amp <amp@ampcode.com>

# Conflicts:
#	crates/sprout-relay/src/state.rs
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