Skip to content

feat(integration): add tracing to default runs behind wizard-default-tracing - #1614

Open
jonmcwest wants to merge 2 commits into
mainfrom
jon/wizard-default-tracing
Open

jonmcwest wants to merge 2 commits into
mainfrom
jon/wizard-default-tracing

Conversation

@jonmcwest

Copy link
Copy Markdown

Problem

  • A default wizard run sets up Logs but not tracing, so teams set up OpenTelemetry by hand.
  • Tracing sends a span per request, so it needs a gated launch.

Changes

  • A default run adds an optional tracing task after logs, only when wizard-default-tracing reads 'true'.
  • A missing flag or a failed fetch leaves tracing out, like wizard-default-mcp-analytics.
  • The task skips apps that already send traces elsewhere and never changes how the app starts.
  • It reuses the tracer provider from AIO or Logs, and leaves installs to review.
flowchart LR
  subgraph Before
    a1[capture] --> b1[ai-observability] --> c1[logs] --> r1[review]
  end
  subgraph After
    a2[capture] --> b2[ai-observability] --> c2[logs] --> t2[tracing] --> r2[review]
  end
  class t2 phRed;
  classDef phRed fill:#f54e00,stroke:#f54e00,color:#fff;
Loading

Test plan

  • A new gate test fails if a missing flag turns tracing on.
  • Not run: a live wizard run against a real app.

LLM context

  • Claude Code (claude-opus-5-5), with the writing-pr-descriptions skill.
  • Driver checked: approved the flag-gated approach. Has not read the diff yet.

🤖 Generated with Claude Code

@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 ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci feature-flags
  • /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/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /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 feature-flags/django
  • /wizard-ci feature-flags/next-js
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/go-sdk
  • /wizard-ci mcp-analytics/python-sdk
  • /wizard-ci mcp-analytics/ruby-sdk
  • /wizard-ci mcp-analytics/rust-sdk
  • /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 Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@jonmcwest

Copy link
Copy Markdown
Author

🤖 Jon's PR agent

  • Tracked

@jonmcwest
jonmcwest marked this pull request as ready for review November 27, 2026 15:33
@jonmcwest
jonmcwest requested a review from a team as a code owner November 27, 2026 15:33
@veria-ai

veria-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR overview

No security issues were found in this pull request.

Reviews

@posthog-security-review-bot posthog-security-review-bot Bot added the security-review Request a security review label Nov 27, 2026
@posthog-security-review-bot

posthog-security-review-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

✅ Security review complete — 7977c2e75c84

1 finding posted as a review, in 6 min.

Add the security-review label to run again on the latest commit.

…acing

# Conflicts:
#	src/programs/posthog-integration/index.ts

@posthog-security-review-bot posthog-security-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent-driven security review - findings inline.

Preserve any tracer provider AIO or Logs configured in earlier steps. Reuse it and
add a separate span processor with its own exporter to `/i/v1/traces`; never repoint
an exporter another step set up, and never send spans to `/i/v0/ai/otel`. Set a
service name. Do not put secrets, tokens, request bodies, or user data in span

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new tracing task turns on OTel auto instrumentation with no scrubbing, so query-string tokens and outbound API keys get exported to PostHog as span attributes, despite the prompt's own no-secrets rule

medium secrets (confidence 3/5)

Details

Latent: this goes live once the wizard-default-tracing flag returns 'true' (excludedTaskTypes in src/programs/posthog-integration/index.ts).

src/programs/posthog-integration/agent/tracing.md tells the task to use the skill's capture path (line 20) and to add manual spans only where auto instrumentation has no coverage (lines 47-48). So the default result is OpenTelemetry auto instrumentation on the shared tracer provider, exporting to /i/v1/traces.

The rule on line 46, "Do not put secrets, tokens, request bodies, or user data in span names or attributes", only covers what the agent writes itself. Auto instrumentation fills attributes on its own:

  • By default, the OTel HTTP server and client instrumentations record the inbound path with its query string (http.target, or url.path plus url.query). They also record the full outbound URL (http.url / url.full). Recent versions redact only a few signature parameters.
  • DB instrumentations record the statement text (db.statement / db.query.text).

Nothing in the prompt asks the agent to strip any of this.

The new task also drops the guard its sibling logs.md keeps for the same situation: "the app's existing logs are data this run has no mandate to export, and every line that leaves must be visible in this run's diff". Here the data that leaves never shows up in the diff the wizard writes.

Impact — Take an app with a route that carries a credential in the query string, such as GET /reset-password?token=..., /auth/callback?code=... or a magic link. Or take an app that calls a third-party API with ?key= / ?api_key=. After a default wizard run with the flag on, every such request exports that value as a span attribute to the customer's PostHog project. Anyone who can read that project can read it: every project member, and anyone holding a leaked PostHog personal API key with read scope. For example, an analyst who has PostHog access but no production access can query traces for token= and use an unexpired reset token to take over that user's account in the app. The limits: only secrets that the app puts in URLs or SQL text are exposed, and the app's own token expiry still applies.

Fix — Make the prompt require scrubbing of auto-instrumented attributes, and make the handoff disclose what leaves. For example, replace lines 46-48 with:

Auto instrumentation records URLs and queries on its own. Configure it so no
query string leaves the app: strip `url.query`, and the query part of
`url.full`, `http.url` and `http.target`, through the instrumentation's
request/response hooks or a processor or exporter wrapper on the PostHog
exporter only. Do not turn on header capture or DB parameter or enhanced
statement reporting. Do not put secrets, tokens, request bodies, or user data
in span names or attributes you add. List the auto-instrumented attributes
that are exported in your handoff, so the report shows the user what leaves.

Agent-driven security review. The tracing skill lives outside this repo (context-mill) and may already scrub these attributes. OTel defaults also vary by runtime and instrumentation version. No OTel package was available in this environment to probe them, so the confidence is capped.

@posthog-security-review-bot posthog-security-review-bot Bot removed the security-review Request a security review label Nov 27, 2026
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