From e83912d623e7d7febb440af711e26e5229b28113 Mon Sep 17 00:00:00 2001 From: armorbreak001 Date: Tue, 21 Apr 2026 16:01:40 +0800 Subject: [PATCH] fix: skip metrics submission on fatal generation errors (fixes #2010) When a command fails with an error, the finally() handler still attempted to submit anonymous usage metrics, which could fail and produce a misleading secondary error message. Skip metrics recording entirely on failure so only the actual error is shown to the user. --- src/apps/cli/internal/base.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apps/cli/internal/base.ts b/src/apps/cli/internal/base.ts index 60465c943..9a0da4caa 100644 --- a/src/apps/cli/internal/base.ts +++ b/src/apps/cli/internal/base.ts @@ -114,7 +114,10 @@ export default abstract class extends Command { } async finally(error: Error | undefined): Promise { await super.finally(error); - this.metricsMetadata['success'] = error === undefined; + if (error) { + return; + } + this.metricsMetadata['success'] = true; await this.recordActionFinished( this.id as string, this.metricsMetadata,