Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(cli): report installed release channel
Kshitij Jhunjhunwala committed
Jul 29, 2026 at 15:43 UTC
6d90bb3a1c2451894ece664a76d4e39b3d177161
3 files changed
+38
-4
ts/packages/cli/src/analytics/events.ts
+10
-2
@@ -101,7 +101,15 @@ export const CLI_EVENT_JOURNEY_STAGES = {
101
CLI_TOOL_INVOCATION_FAILED: 'execute',
102
} as const satisfies Record<CliAnalyticsEventName, CliJourneyStage>;
103
104
-const CLI_CHANNEL = inferSkillReleaseChannel(APP_VERSION);
104
+let cliChannel = inferSkillReleaseChannel(APP_VERSION);
105
+
106
+/**
107
+ * Event builders are synchronous, so the CLI bootstrap injects the version
108
+ * resolved from release-tag.txt before any command can emit telemetry.
109
+ */
110
+export const configureCliAnalyticsReleaseVersion = (version: string): void => {
111
+ cliChannel = inferSkillReleaseChannel(version);
112
+};
113
114
const buildEvent = (
115
name: CliAnalyticsEventName,
@@ -111,7 +119,7 @@ const buildEvent = (
119
properties: {
120
...properties,
121
journey_stage: CLI_EVENT_JOURNEY_STAGES[name],
114
- cli_channel: CLI_CHANNEL,
122
+ cli_channel: cliChannel,
123
},
124
});
125
ts/packages/cli/src/commands/index.ts
+2
@@ -58,6 +58,7 @@ import { CLI_EXPERIMENTAL_FEATURES } from 'src/constants';
58
import { installSkill, type SkillInstallTarget } from 'src/effects/install-skill';
59
import { experimental, type CommandVisibility, tagged, visibleValues } from './feature-tags';
60
import { withBackgroundUpdateCheck } from './background-update-check';
61
+import { configureCliAnalyticsReleaseVersion } from 'src/analytics/events';
62
63
const ROOT_COMMANDS = [
64
tagged(versionCmd),
@@ -453,6 +454,7 @@ export const runWithConfig = Effect.gen(function* () {
454
isExperimentalFeatureEnabled: feature => cliUserConfig.isExperimentalFeatureEnabled(feature),
455
};
456
const version = yield* getVersion;
457
+ configureCliAnalyticsReleaseVersion(version);
458
const rootCommand = withBackgroundUpdateCheck(buildRootCommand(visibility));
459
const run = Command.run(rootCommand, {
460
name: 'composio',
ts/packages/cli/test/src/analytics.events.test.ts
+26
-2
@@ -1,10 +1,16 @@
1
-import { readFileSync } from 'node:fs';
2
-import { afterEach, describe, expect, it, vi } from 'vitest';
1
+import { readFileSync, writeFileSync } from 'node:fs';
2
+import path from 'node:path';
3
+import * as tempy from 'tempy';
4
+import { it } from '@effect/vitest';
5
+import { afterEach, describe, expect, vi } from 'vitest';
6
+import { BunFileSystem, BunPath } from '@effect/platform-bun';
7
+import { Effect, Layer } from 'effect';
8
import { createCliCodactFailureBody } from 'src/analytics/dispatch';
9
import {
10
CLI_ANALYTICS_EVENTS,
11
CLI_EVENT_JOURNEY_STAGES,
12
CLI_JOURNEY_STAGES,
13
+ configureCliAnalyticsReleaseVersion,
14
createCliCommandTelemetryContext,
15
getPluginLifecycleFailedEvent,
16
getPluginLifecycleSucceededEvent,
@@ -24,6 +30,7 @@ import { APP_VERSION } from 'src/constants';
30
import { inferSkillReleaseChannel } from 'src/effects/install-skill';
31
import { CLI_RELEASE_CHANNELS } from 'src/experimental-features';
32
import { ToolInputValidationError } from 'src/services/tool-input-validation';
33
+import { resolveInstalledCliVersion } from 'src/services/run-companion-modules';
34
35
describe('CLI analytics execute failure events', () => {
36
it('records terminal capabilities supplied by the terminal service', () => {
@@ -361,6 +368,7 @@ describe('CLI analytics setup runtime-context events', () => {
368
369
describe('CLI analytics journey taxonomy', () => {
370
afterEach(() => {
371
+ configureCliAnalyticsReleaseVersion(APP_VERSION);
372
vi.unstubAllEnvs();
373
});
374
@@ -436,6 +444,22 @@ describe('CLI analytics journey taxonomy', () => {
444
expect(CLI_RELEASE_CHANNELS).toContain(properties?.cli_channel);
445
});
446
447
+ it.effect('uses beta release metadata even when the package version is stable', () => {
448
+ const installDir = tempy.temporaryDirectory();
449
+ const execPath = path.join(installDir, 'composio');
450
+ writeFileSync(execPath, 'fake binary');
451
+ writeFileSync(path.join(installDir, 'release-tag.txt'), '@composio/cli@0.3.1-beta.7\n');
452
+
453
+ return Effect.gen(function* () {
454
+ const resolvedVersion = yield* resolveInstalledCliVersion(execPath, APP_VERSION);
455
+ configureCliAnalyticsReleaseVersion(resolvedVersion);
456
+
457
+ const properties = getPrimaryLifecycleInvokedEvent(contextFor(['login']))?.properties;
458
+ expect(inferSkillReleaseChannel(APP_VERSION)).toBe('stable');
459
+ expect(properties?.cli_channel).toBe('beta');
460
+ }).pipe(Effect.provide(Layer.merge(BunFileSystem.layer, BunPath.layer)));
461
+ });
462
+
463
it('propagates the installer invocation origin from the environment', () => {
464
vi.stubEnv('COMPOSIO_CLI_INVOCATION_ORIGIN', 'installer');
465