@devries-cameron20 / composio-1 / commits / 89b0ad24c
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(cli): track plugin setup lifecycle + runtime setup telemetry (#3902)

## What Instruments the CLI's plugin auto-install (`composio setup`) and shell integration (`composio install`) so the install → setup → activation funnel is observable in PostHog. Re-lands the previously-deferred setup lifecycle telemetry (`4e68e652`, reverted by `333d2296`) and extends it with runtime detection/failure/abandonment signal. ### Part 1 — re-land deferred lifecycle telemetry - New events: `CLI_INSTALL_*`, `CLI_SETUP_*` lifecycle families, per-host `CLI_PLUGIN_SETUP_SUCCEEDED` / `CLI_PLUGIN_UNINSTALL_SUCCEEDED`. - Adds `'setup'` to `KNOWN_COMMAND_TOKENS` — fixes the current misattribution where every `composio setup` logged as generic `CLI_COMMAND_*` with `command_path='composio'`. - `install.sh` tags the auto-setup call with `COMPOSIO_CLI_INVOCATION_ORIGIN=installer` so installer-driven setups are attributable. ### Part 2 — runtime extensions (fired from `setup.ts` / `setup.cmd.ts`, which the argv-only central dispatch can't see) - **`CLI_SETUP_HOST_DETECTED`** (per host) — `agent_host`, `available`, `supported`, `host_version`, `unsupported_reason_code`. Sizes the plugin channel (Claude vs Codex vs neither). - **Normalized `unsupported_reason_code`** threaded through `SetupTargetDetection` (`codex_too_old` / `no_json_inspection` / `host_command_failed` / `unknown`) instead of string-matching messages. - **`CLI_PLUGIN_SETUP_FAILED`** (per host) — previously only success was emitted; failures were lost into the argv-only `CLI_SETUP_FAILED` with no host/phase. - **`CLI_SETUP_CANCELLED`** (declined confirm) / **`CLI_SETUP_SKIPPED`** (`--if-present` with no host) — previously indistinguishable from success. - `stdout_is_tty` added to `CLI_SETUP_INVOKED`. ## Why `composio setup` (plugin auto-install for Claude Code / Codex) and the curl installer were firing **zero** dedicated telemetry, and `setup` was misattributed on top of that — the entire plugin-driven acquisition path was dark. These events make the install → setup → per-host plugin install → first `composio execute` funnel joinable by `install_id` / `distinct_id`. ## Layering note The central `CLI_SETUP_SUCCEEDED`/`FAILED` mean "the command ran / threw"; the in-command events describe **what actually happened**. A user-cancelled run emits both `CLI_SETUP_CANCELLED` and `CLI_SETUP_SUCCEEDED` by design — analyze outcomes off the specific events (mirrors how `CLI_EXECUTE_SUCCEEDED` coexists with `CLI_TOOL_INVOCATION_FAILED`). ## Verification - Typecheck (`tsgo`, src + test): clean. - Full CLI vitest suite: **85 files, 796 passed, 1 skipped** — includes new cases in `analytics.events.test.ts` and a new `setup.telemetry.cmd.test.ts` (stubbed `CommandRunner` covering detection, install, per-host failure, cancel/skip). - `test/install-sh-release-resolution.test.sh`: passes (installer-origin assertion re-added). - Confirmed the Apollo `/api/v3/cli/analytics` ingest has no event-name allowlist (validates `event` as a ≤200-char string, forwards arbitrary names) and traced the live pipe (`enqueue → delivery_succeeded`), so the new event names flow through unchanged once shipped. No backend changes required. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/ComposioHQ/codesmith/composio/pr/3902"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v2.svg"><img alt="View with Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1787252592&installation_model_id=428187&pr_number=3902&repository=ComposioHQ%2Fcomposio&return_to=https%3A%2F%2Fgithub.com%2FComposioHQ%2Fcomposio%2Fpull%2F3902&signature=bef1dc2a149a6b593ff6bb391c1e7a204240cc7686ffa5e061ae889589fed72a"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a> <sup>Need help on this PR? Tag <code>/codesmith</code> with what you need. Autofix is disabled.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer -->

Kshitij Jhunjhunwala committed Jul 21, 2026 at 15:31 UTC 89b0ad24cdcaeeb2fa5638d56d00cbdd5d677217

No changes.