Skip to content

fix: skip error-tracking capture for expected matched aborts#742

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/skip-exception-capture-on-matched-abort
Draft

fix: skip error-tracking capture for expected matched aborts#742
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/skip-exception-capture-on-matched-abort

Conversation

@posthog

@posthog posthog Bot commented Jun 26, 2026

Copy link
Copy Markdown

Problem

When a user declines the required GitHub connection during the new self-driving program, the wizard ships WizardError: Agent aborted: github connection declined to error tracking as an exception. This is a deliberate, well-handled exit — a matched AbortCase that already renders a friendly "GitHub connection required" outro, not a crash.

The root cause is in wizardAbort (src/utils/wizard-abort.ts): it unconditionally calls analytics.captureException whenever an error is passed, and every matched abort in the linear runner funnels through it. The same path already emits a distinct wizardCapture('agent aborted') product event, so the exception is redundant — it mints a fresh spurious error-tracking issue for the wizard team on every real declined connection as self-driving rolls out.

Changes

  • Add a captureError flag (default true) to wizardAbort's options. When false, the exception is suppressed but everything else (cleanup, shutdown, outro, exit) is unchanged.
  • In the linear runner's ABORT branch, pass captureError: !matched. Expected, matched AbortCases (declined GitHub, requires-interactive-mode, not-available-for-project) skip exception capture and keep only the wizardCapture('agent aborted') analytics event; the generic/unmatched abort branch and genuine faults still report to error tracking.

Test plan

  • Added unit tests covering captureError: false (suppresses capture, still shuts down) and captureError: true (captures).
  • pnpm build && pnpm test — 1013 tests pass.
  • pnpm fix — clean.

Created with PostHog Code from an inbox report.

A matched AbortCase (e.g. declining the GitHub connection in self-driving)
is a deliberate, well-handled exit that already emits a distinct
`agent aborted` product event. wizardAbort still reported it to error
tracking via analytics.captureException, minting a spurious issue for
every real declined connection.

Add a `captureError` flag (default true) to wizardAbort and set it to
`!matched` in the linear runner's ABORT branch, so matched aborts skip
exception capture while the generic/unmatched abort and genuine faults
still report.

Generated-By: PostHog Code
Task-Id: 7a9e916e-33bf-4ed3-968b-91d67e471235
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants