From d1709b3abe169a2ba9bdbe3e1419835410d58bbf Mon Sep 17 00:00:00 2001 From: "posthog[bot]" <206114724+posthog[bot]@users.noreply.github.com> Date: Thu, 20 Aug 2026 23:01:28 +0000 Subject: [PATCH 1/2] fix(runner): stop reporting headless prerequisite aborts as crashes A non-interactive run that hits a `detectError` (no package.json, no PostHog SDK) aborted with a WizardError, which wizardAbort hands to captureException. That turned an expected user-state check into an error tracking issue. Capture a structured `wizard: non-interactive prerequisites not met` event with the program id and detect error kind instead, and drop the error argument on the abort. The user-facing message and exit code stay the same. Generated-By: PostHog Desktop Task-Id: b3611c76-b58f-4f39-b76f-4351426e1d21 --- src/lib/runners/run-non-interactive.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/runners/run-non-interactive.ts b/src/lib/runners/run-non-interactive.ts index 221e68d5e..10d5cfef2 100644 --- a/src/lib/runners/run-non-interactive.ts +++ b/src/lib/runners/run-non-interactive.ts @@ -91,7 +91,7 @@ export function runNonInteractive( const { configureLogFileFromEnvironment, logToFile } = await import( '@utils/debug' ); - const { wizardAbort, WizardError } = await import('@utils/wizard-abort'); + const { wizardAbort } = await import('@utils/wizard-abort'); configureLogFileFromEnvironment(); @@ -213,14 +213,17 @@ export function runNonInteractive( kind: OutroKind.Error, message: `Prerequisites not met: ${detectError.kind}`, }); + // A failed prerequisite is an expected user-state check (no + // package.json, no PostHog SDK), not a wizard defect. Record it as a + // structured event so it does not reach error tracking as a crash. + analytics.wizardCapture('non-interactive prerequisites not met', { + integration: config.id, + detect_error_kind: detectError.kind, + }); await wizardAbort({ message: `Prerequisites not met: ${detectError.kind}\n\nSee ${ runDef?.docsUrl ?? POSTHOG_DOCS_URL }`, - error: new WizardError(`${config.id} prerequisites failed`, { - integration: config.id, - detect_error_kind: detectError.kind, - }), }); } } From b072b8d92b35893c4eece6a5fd253701475c3378 Mon Sep 17 00:00:00 2001 From: "posthog[bot]" <206114724+posthog[bot]@users.noreply.github.com> Date: Thu, 20 Aug 2026 23:12:22 +0000 Subject: [PATCH 2/2] fix(runner): add program_id to non-interactive prerequisite event The `non-interactive prerequisites not met` event only carried the program id under `integration` (the documented no-framework fallback). Queries that group all wizard events by `program_id` therefore placed these aborts in the unattributed bucket. Add `program_id: config.id` alongside the existing `integration: config.id`, matching the `agent started` event which sends both keys. Keeping `integration` preserves the event's presence in the integration-axis breakdown used by the other run events; adding `program_id` closes the group-by-program_id gap. Generated-By: PostHog Desktop Task-Id: b44b881b-f823-487c-9574-fee79c315734 --- src/lib/runners/run-non-interactive.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/runners/run-non-interactive.ts b/src/lib/runners/run-non-interactive.ts index 10d5cfef2..219b82a05 100644 --- a/src/lib/runners/run-non-interactive.ts +++ b/src/lib/runners/run-non-interactive.ts @@ -218,6 +218,7 @@ export function runNonInteractive( // structured event so it does not reach error tracking as a crash. analytics.wizardCapture('non-interactive prerequisites not met', { integration: config.id, + program_id: config.id, detect_error_kind: detectError.kind, }); await wizardAbort({