refactor(telemetry): drop run lifecycle events and captureException from runner

This commit is contained in:
YeonGyu-Kim
2026-05-02 00:10:57 +09:00
parent be2eee6306
commit 14568db278
2 changed files with 0 additions and 67 deletions
-2
View File
@@ -64,8 +64,6 @@ describe("run telemetry isolation", () => {
trackActive: () => {
throw new Error("telemetry failed")
},
capture: mock(() => {}),
captureException: mock(() => {}),
shutdown: mock(async () => {
throw new Error("shutdown failed")
}),
-65
View File
@@ -58,20 +58,6 @@ export async function run(options: RunOptions): Promise<number> {
} catch {
// telemetry failure is non-fatal, silently ignore
}
try {
posthog.capture({
distinctId,
event: "run_started",
properties: {
command: "run",
agent: resolvedAgent,
has_model: !!options.model,
has_session_id: !!options.sessionId,
},
})
} catch {
// telemetry failure is non-fatal, silently ignore
}
try {
const resolvedModel = resolveRunModel(options.model)
@@ -164,38 +150,6 @@ export async function run(options: RunOptions): Promise<number> {
})
}
if (exitCode === 0) {
try {
posthog.capture({
distinctId,
event: "run_completed",
properties: {
command: "run",
agent: resolvedAgent,
duration_ms: durationMs,
message_count: eventState.messageCount,
},
})
} catch {
// telemetry failure is non-fatal, silently ignore
}
} else if (exitCode === 1) {
try {
posthog.capture({
distinctId,
event: "run_failed",
properties: {
command: "run",
agent: resolvedAgent,
exit_code: exitCode,
duration_ms: durationMs,
},
})
} catch {
// telemetry failure is non-fatal, silently ignore
}
}
return exitCode
} catch (err) {
cleanup()
@@ -210,25 +164,6 @@ export async function run(options: RunOptions): Promise<number> {
if (err instanceof Error && err.name === "AbortError") {
return 130
}
try {
posthog.captureException(err, distinctId)
} catch {
// telemetry failure is non-fatal, silently ignore
}
try {
posthog.capture({
distinctId,
event: "run_failed",
properties: {
command: "run",
agent: resolvedAgent,
error: serializeError(err),
duration_ms: Date.now() - startTime,
},
})
} catch {
// telemetry failure is non-fatal, silently ignore
}
console.error(pc.red(`Error: ${serializeError(err)}`))
return 1
} finally {