fix: repair npm global install — walk-up dep resolution, spawn-helper chmod, platform-aware messages#638
Conversation
… chmod, platform-aware messages - Replace hardcoded single-level checkBuilt() with findPackageUp() walk-up resolver that handles npm hoisting (fixes ComposioHQ#619) - Add postinstall script to chmod node-pty spawn-helper for global installs (fixes ComposioHQ#624) - Platform-aware tmux install messages (brew/apt/dnf/WSL instead of hardcoded brew) - Auto-restart crashed terminal servers in start-all.ts (up to 3 retries) - ESLint config for packages/ao/bin scripts - Expanded preflight tests (3 → 5 checkBuilt cases) Closes ComposioHQ#619, closes ComposioHQ#624 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rt bookkeeping - checkTmux() now attempts auto-install (brew/apt/dnf) before erroring - Config generation uses runtime: "process" when tmux unavailable - start.ts tries auto-install during config creation, falls back gracefully - Fix restart bookkeeping in start-all.ts: slot-based tracking prevents duplicate children entries that broke cleanup countdown - Updated design doc reflecting all fixes and review feedback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…llback A degraded runtime gives a bad first impression. Instead of silently falling back to runtime: "process", ao start now: 1. Tries auto-install (brew/apt/dnf) 2. On failure, exits with clear platform-specific install command 3. User runs one command, then re-runs ao start Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Refactor ensureTmux() to use askYesNo() + tryInstallWithAttempts() matching the existing ensureGit() pattern — no silent sudo - Add log line before each auto-install attempt in preflight.checkTmux() - Update config warning: "will prompt to install at startup" - Update design doc to reflect interactive consent flow - Include prior uncommitted changes: interactive install prompts for git/gh/agent-runtime, ensureGit(), canPromptForInstall(), askYesNo() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ASCII art flow diagrams with styled HTML/CSS flowcharts using color-coded nodes (blue=command, yellow=decision, green=success, red=failure) and proper branching layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Expand the Interactive Prerequisite Prompts section with: - Full prerequisite matrix table (tmux, git, agent runtime, gh, docker) showing required status, prompts, install methods per platform, and failure behavior - Key behaviors list (consent-first, logging, blocking, non-TTY fallback) - Example terminal output for fresh machine install flow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The skip option number was hardcoded as 5 in the display, prompt, bounds check, and skip check. If a fifth agent were added, selecting it would trigger Skip instead of installing. Now derived dynamically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I had also raised a pr regarding tmux fix, whether in the installation we can indicate the user about tmux not present in the error, https://github.com/ComposioHQ/agent-orchestrator/pull/250/changes, not sure we should be directly installing as a forceful install can cause problems in existing projects |
|
@fireddd thank you for mentioning the issue. I have fixed the auto install without interactive mode and now for any install we have interactive mode in our cli. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Summary
Fixes P0 blockers preventing
npm install -g @composio/ao && ao startfrom working. Addresses 4 issues: npm dependency hoisting resolution, node-pty spawn-helper permissions, interactive tmux/git install with user consent, and terminal server crash recovery.ao startfails with 'Dependencies not installed' on npm global installs #619):checkBuiltuses a hardcoded single-level path that doesn't account for npm's dependency hoisting — always fails with "Dependencies not installed"ao startfails with posix_spawnp: Operation not permitted afternpm install -g @composio/ao#624): node-pty'sspawn-helperbinary ships without the execute bit —posix_spawnpfails withOperation not permittedwhen opening a terminal panelbrew install tmux— unhelpful on Linux/WindowsChanges
packages/cli/src/lib/preflight.tsReplace the single-level
existsSynccheck withfindPackageUp()— a walk-up resolver that checksnode_modules/@composio/ao-coreat every ancestor directory, mirroring Node's own module resolution. Error messages now distinguish between npm (npm install -g @composio/ao@latest) and pnpm (pnpm install && pnpm build) users.checkTmux()now attempts auto-install (brew/apt/dnf) with a log line before each attempt, then falls back to platform-specific error messages.packages/cli/src/commands/start.tsensureTmux()inrunStartup()— centralized tmux enforcement covering ALLao startpaths (normal, URL quick-start, retry with existing config). No silentsudo— usesaskYesNo()to get user consent before attempting install, matching the existingensureGit()pattern.tryInstallWithAttempts()+tmuxInstallAttempts()for consistent install flow with progress logging.runtime: "process"fallback).packages/ao/bin/postinstall.js(new)Runs after
npm install -g @composio/ao. Locatesnode-ptyvia the same walk-up pattern, findsspawn-helperinprebuilds/<platform>-<arch>/, andchmod 0o755. Skips silently on Windows and when no prebuild exists. Non-fatal on failure.packages/web/server/start-all.tsTerminal WebSocket servers now auto-restart on crash (up to 3 attempts) with slot-based bookkeeping — restarts replace the existing child process slot in-place, preventing duplicate entries that would break the cleanup countdown.
eslint.config.jsAdded
packages/ao/binoverride for Node.js globals (process,console) — matches existingscripts/**pattern.packages/cli/__tests__/lib/preflight.test.tsExpanded
checkBuilttests from 3 to 5, covering pnpm layout, npm hoisted layout (walk-up), npm/pnpm error hints, and missing dist. Updated tmux tests for auto-install and platform-aware messages.Test plan
pnpm typecheckpassescheckBuilt)doctor-script.test.ts)pnpm lint— no new errors on changed filestsc -p tsconfig.server.json --noEmit)Closes #619, closes #624
🤖 Generated with Claude Code