发布

  • feat(cli): stamp telemetry with journey_stage + cli_channel; tag installer origin (#3928)

    frostbyte_neo 发布于 2026-07-30 18:37:53 +00:00

    Stacked on #3927 (A1 — direct-to-PostHog + install→Apollo identity).
    Targets that branch; will auto-retarget to next when #3927 merges.
    Review only this diff.

    What

    Makes every CLI event self-describe its funnel stage, so the adoption
    funnel can be queried without string-matching event names — which is how
    it silently broke in the first place.

    • journey_stage on every event: install | setup | login | connect | execute | other. Declared as an exported typed const plus a single
      exhaustive map, as const satisfies Record<CliAnalyticsEventName, CliJourneyStage> — so the compiler refuses to build if a future event
      has no stage
      . No per-event literals; stamped in one shared builder.
    • cli_channel alongside cli_version, reusing the existing
      inferSkillReleaseChannel() / CLI_RELEASE_CHANNELS. Makes "did this
      fix reach stable users?" answerable — the question that went unanswered
      in the 0.2.30 assetless-release incident.
    • Installer origin fix: install.sh ran "$exe" install without
      COMPOSIO_CLI_INVOCATION_ORIGIN=installer (the setup call on line 410
      had it), so a genuine install was indistinguishable from a user running
      composio install by hand. Now tagged, with a regression test that
      reads install.sh and asserts it.

    Stage mapping (reviewed against 30d volume)

    install = CLI_INSTALL_* · setup = CLI_SETUP_* + CLI_PLUGIN_* ·
    login = CLI_LOGIN_* · connect = CLI_LINK_* · execute =
    CLI_EXECUTE_* + CLI_TOOL_INVOCATION_* · other = CLI_COMMAND_*,
    CLI_SEARCH_*, CLI_PROXY_*, CLI_RUN_*, CLI_LOGOUT_*

    Judgment calls, made with data rather than by default:

    • proxyother. 2,060 of 2,140 proxy users (96%) already
      execute; only 80 are proxy-only. Reclassifying would move the activated
      cohort ~1%, so execute stays precisely "tool execution".
    • runother. run children emit their own execute events
      carrying parent_run_id; staging the parent as execute would
      double-count.
    • searchother. Not a required funnel stage. Candidate for a
      "discovery" step later if the flow page wants one.

    Note for whoever builds the flow page

    CLI_TOOL_INVOCATION_* and CLI_EXECUTE_FAILED can both fire for a
    single failure, so the execute stage double-counts at the event
    level
    . Count distinct users per stage, not events.

    Known coverage limit

    npm and Homebrew installs don't run install.sh, so they emit no
    CLI_INSTALL_*. The install stage means "installed via install.sh",
    not all installs.

    Verification

    pnpm typecheck clean · validate:boundaries OK (46 disables, zero
    added
    ) · CLI suite 107 files / 971 passed (+15 tests) ·
    dispatch.ts identity/transport untouched.

    🤖 Generated with Claude Code

    下载附件