From 1c27000c37da4b08124ec9d6ef5e7dc50cef0639 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 11 Apr 2026 14:14:32 +0900 Subject: [PATCH] feat(telemetry): instrument CLI run command with lifecycle events --- src/cli/run/runner.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cli/run/runner.ts b/src/cli/run/runner.ts index 2bea2cdec..5f407d7b2 100644 --- a/src/cli/run/runner.ts +++ b/src/cli/run/runner.ts @@ -53,10 +53,12 @@ export async function run(options: RunOptions): Promise { const posthog = createCliPostHog() const distinctId = getPostHogDistinctId() + posthog.trackActive(distinctId, "run_started") posthog.capture({ distinctId, event: "run_started", properties: { + command: "run", agent: resolvedAgent, has_model: !!options.model, has_session_id: !!options.sessionId, @@ -159,6 +161,7 @@ export async function run(options: RunOptions): Promise { distinctId, event: "run_completed", properties: { + command: "run", agent: resolvedAgent, duration_ms: durationMs, message_count: eventState.messageCount, @@ -169,6 +172,7 @@ export async function run(options: RunOptions): Promise { distinctId, event: "run_failed", properties: { + command: "run", agent: resolvedAgent, exit_code: exitCode, duration_ms: durationMs, @@ -195,6 +199,7 @@ export async function run(options: RunOptions): Promise { distinctId, event: "run_failed", properties: { + command: "run", agent: resolvedAgent, error: serializeError(err), duration_ms: Date.now() - startTime,