Skip to content

feat(agents): add the error-tracking orchestrator flow - #377

Draft
ablaszkiewicz wants to merge 11 commits into
mainfrom
error-tracking-flow
Draft

feat(agents): add the error-tracking orchestrator flow#377
ablaszkiewicz wants to merge 11 commits into
mainfrom
error-tracking-flow

Conversation

@ablaszkiewicz

Copy link
Copy Markdown
Contributor

Problem

The wizard is gaining a one-command error-tracking setup (wizard error-tracking, PostHog/wizard#1185) that installs PostHog first when the repo doesn't have it — the replay-vision pattern. The orchestrator flow backing it needs to live here.

Changes

New flow context/agents/error-tracking/ — nine prompts:

  • setup-error-tracking.md (seed) establishes two facts: is PostHog integrated, and which source-map uploader variant applies (or none, on readable-stack-trace platforms). It then queues one graph: install + init (only when PostHog is missing) → capture-exceptions → the upload subgraph (credentials as a root so the API-key ask reaches the user early, configure after the code edits, wire-ci, test-setup) → report.
  • install / init reuse the integration-v2 step-skills, near-verbatim from replay-vision's.
  • capture-exceptions uses the existing integration-v2-error-tracking-step bundle, adapted from integration-v2's task (verification is the user-driven test-setup step here, not a build task).
  • configure / credentials / wire-ci / test-setup are adapted from the error-tracking-upload-source-maps flow, secret-vault handling included; the seed passes { skillId, displayName } inputs so no task re-detects.
  • report merges the handoffs, enables the Error Tracking product via posthog_exec (non-fatal on failure), and writes posthog-error-tracking-report.md.

Companion PRs: PostHog/wizard#1185 (program + wiring), wizard-workbench (picker registration).

Test plan

  • node scripts/build.js — the flow validates and all nine prompts land in dist/agents/ + agent-menu.json.
  • pnpm test — 173/173.
  • End-to-end against a live app still pending (needs the wizard PR + local stack).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY

Nine prompts under context/agents/error-tracking/ backing the wizard's
new `error-tracking` command. The seed establishes whether PostHog is
integrated and which uploader variant applies, then queues install/init
(integration-v2 step-skills, like replay-vision) on uninstrumented
repos, exception capture via integration-v2-error-tracking-step, the
source-map subgraph (adapted from the error-tracking-upload-source-maps
flow) where the platform ships minified bundles or stripped binaries,
and a report that merges it all.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
@github-actions

github-actions Bot commented Sep 1, 2026

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 ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/groq
  • /wizard-ci ai-observability/manual-capture
Show more apps
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /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 replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /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
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a wizard branch:

  • /wizard-ci all wizard:my-branch

Add wizard:<branch> to any command above to pin the wizard branch. It defaults to main.

Results will be posted here when complete.

ablaszkiewicz and others added 10 commits September 1, 2026 18:21
…ness

install/init move terra→sol low, capture-exceptions terra low→sol
medium. Pairs with the wizard binding change routing the program to the
orchestrator on pi; seed stays terra and report stays luna, matching
the metrics flow's pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
…nager

A configure run in a pnpm workspace copied the docs' npm install and
npm hard-fails on workspace:* deps (EUNSUPPORTEDPROTOCOL); the agent
retried npm three ways and never switched. New skill bullet: detect the
manager from the lockfile, translate the docs' npm commands, and read
EUNSUPPORTEDPROTOCOL as wrong-manager, never a flag to retry. The
error-tracking flow's configure task now also mandates
detect_package_manager before the first install. Verified: the pnpm
monorepo fixture run that failed now completes 4/4, recovering to
`pnpm add -D` on first contact with the error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
…anning

A seed run saw "PostHog already integrated" and enqueued only
capture+report, never applying the uploader precedence to a tsc-built
Node service — while an identical sibling fixture planned the full
graph. The two facts are now declared independent, a compiled/bundled
JS project is explicitly never "none", and the success criteria demand
the plan state the uploader decision (or the readable-stack reason)
explicitly. Verified: the fixture that under-planned now queues the
full node-uploader graph and completes 5/5.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
The integration init skill documents its public keys in .env.example;
the credentials task wrote its upload variables only to the real env
file, so the names never reached the committed template. New step 4:
append the names with placeholders (never values) — for the next
developer, and so a later run's check_env_keys reports the expectation.
Scoped to the error-tracking flow's task prompt; the shared uploader
skill is untouched, so the standalone upload-source-maps program keeps
its current behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
Astro inlines scripts below its asset limit into the HTML, so a build can
emit a .map with no .js beside it. posthog-cli then finds zero pairs, exits
non-zero, and takes the whole build down with it. Treat Astro as a no-variant
platform: install and exception capture still run, the build script is left
untouched, and the report says why upload was skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
…Node

The shared integration-v2-init skill assumes the framework auto-loads .env,
which is true for Next/Nuxt/Astro/SvelteKit/Vite but not for plain Node
backends. On Express, Fastify, Hono, Koa and raw node:http the run wrote
process.env reads and a .env file with nothing to bridge them, so every app
died at module load on its own missing-variable guard.

Teach the init task to wire the loading (dotenv, or --env-file) and to start
the app once to confirm it boots. Also have configure check that some script
actually runs a newly emitted bundle, since two apps built to dist/ while
start still ran the source.

Scoped to this flow's task prompts; the shared skill is untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
…n Angular

On the stock @angular/build builder nothing defines process.env or
import.meta.env in the browser bundle, but the run wrote
import.meta.env['NG_APP_POSTHOG_PROJECT_TOKEN'] into src/environments/*.
Reading a property off undefined throws while the module evaluates, so
<app-root> stayed empty and the app rendered a blank page.

Name the mechanism's real source (@ngx-env/builder supplies import.meta.env
and the NG_APP_ prefix) and require it to be an existing dependency before
use. Otherwise fall back to the skill's existing "no valid environment to read
from" case: embed the public project token in the committed environment files,
which is where it ends up in the bundle anyway.

Scoped to this flow's task prompt; the shared skill is untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVXmLWB31CBujD2FJ2ogvY
The earlier rule stopped the run reaching for import.meta.env, but it then read
env['NG_APP_POSTHOG_PROJECT_TOKEN'] from the project's generated
src/environments/.env.ts, which only defines npm_package_version. The key came
back undefined, and because a production build takes the guard's quiet return
path the app rendered normally while PostHog never initialised — no requests at
all.

Name that second empty container, require the lookup's source to be opened and
the key seen before wiring it, and make the task prove initialisation by
serving the build and confirming a request reaches the PostHog host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5Kw3YahYz9RiFeJ8r2hxY
Pointing `start` at dist/index.js is only safe if that bundle can execute.
On koa-notes the esbuild command had no --format=esm while package.json sets
"type": "module", so the emitted CommonJS died at boot with
`ReferenceError: module is not defined in ES module scope` — a breakage that
only appeared once `start` stopped running the source.

Require the task to run the build and start the script once, and name the
module-format mismatch as the usual cause.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5Kw3YahYz9RiFeJ8r2hxY
…uild rule

The new "run the build and start that script once" instruction sat directly
above "Do not run the build", leaving the task with contradictory orders.
Carve the single verification out of the prohibition.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5Kw3YahYz9RiFeJ8r2hxY
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.

1 participant