Skip to content

fix(telemetry): name the orchestrator's blocked-drain guard, fingerprint aborts - #1013

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/abort-telemetry-fingerprint
Draft

fix(telemetry): name the orchestrator's blocked-drain guard, fingerprint aborts#1013
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/abort-telemetry-fingerprint

Conversation

@posthog

@posthog posthog Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Problem

The wizard's abort telemetry is misreporting itself in two ways, both on the core onboarding path where a failure matters most.

The orchestrator's post-drain guard raises WizardError('orchestrator drain ended with failed tasks') whenever tasks failed or tasks stayed blocked. On the blocked-only branch nothing actually failed — the user is correctly told "N steps never ran", but the exception name sends triage looking for a failure the queue state doesn't contain.

Separately, aborts are fingerprinted server-side from the stack trace, which carries the install path (pnpm dlx content hashes, .npm/_npx dirs, CI checkouts, local clones). One cause therefore shatters into an issue per install, each reading "1 occurrence, 1 user, 1 session" and looking like a harmless one-off. This isn't limited to the orchestrator: Authentication failed alone is spread across hundreds of separate issues, and the orchestrator drain abort across more than a dozen.

Neither change fixes the underlying agent failure — that's the point. They make the real recurrence rate visible so we can judge whether the agent is genuinely failing to finish work or a guard is simply too aggressive.

Changes

  • Split the drain guard. A small pure drainFailure() (mirroring the pi harness's existing completionFailure()) decides which cause ended the drain: orchestrator drain ended with failed tasks when retries were exhausted, orchestrator drain ended with tasks that never ran when only Pending tasks remain. The properties that tell them apart were already being captured, so this is naming and branching, not new instrumentation. Also fixes the "1 steps never ran" pluralisation on the same line.
  • Stable abort fingerprint. wizardAbort now supplies a message-derived $exception_fingerprint, following the pattern already proven on the OAuth flow. Truncation is deliberate — it folds together messages that share a cause but differ in their tail. A callsite that wants different grouping still wins by setting the property in its WizardError context.

Test plan

  • pnpm build && pnpm test && pnpm lint — 1640 tests pass, 0 lint errors.
  • New unit coverage: drain-failure.test.ts asserts the blocked-only branch no longer calls itself a failure; wizard-abort.test.ts asserts the same cause raised from an _npx path and a pnpm dlx path fingerprints identically, the two guard branches stay apart, and a context-supplied fingerprint overrides the default.
  • Ran the derivation against the real message corpus observed in error tracking to confirm it collapses the fragmented groups while leaving distinct API error codes distinguished (the code appears well before the truncation point).

Created with PostHog Desktop from this inbox report.

…int aborts

The orchestrator's post-drain guard raised `orchestrator drain ended with
failed tasks` on a drain where nothing failed but tasks stayed blocked behind
a dependency that never completed. The user-facing copy already said "N steps
never ran", so only the exception misnamed itself — and it sent triage looking
for a failure the queue state does not contain. Split the decision into a
small pure `drainFailure()` (mirroring the pi harness's `completionFailure()`)
so each cause carries its own message, and fix the "1 steps" pluralisation
while we're on the line.

Separately, every abort's captured exception was fingerprinted server-side
from its stack trace, which carries the install path — pnpm dlx content
hashes, `.npm/_npx` dirs, CI checkouts, local clones. One cause therefore
shattered into an issue per install, each reading "1 occurrence, 1 user,
1 session". Aborts are raised from a fixed set of guard sites, so
`wizardAbort` now supplies a stable message-derived `$exception_fingerprint`,
following the pattern already proven on the OAuth flow. A callsite that wants
different grouping can still set the property in its `WizardError` context.

Verified the derivation against the real message corpus: it collapses the
fragmented groups, keeps the two orchestrator branches apart, and leaves
distinct API error codes distinguished.

Generated-By: PostHog Code
Task-Id: 86e6e098-a5ce-4173-8ba6-a04e9c62813a
@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 mcp-analytics
  • /wizard-ci revenue
  • /wizard-ci self-driving

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 mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit

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