Repository navigation
feat(integration): add tracing to default runs behind wizard-default-tracing #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jonmcwest
wants to merge
2
commits into
main
Choose a base branch
from
jon/wizard-default-tracing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+119
−12
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| type: tracing | ||
| flow: integration-v2 | ||
| label: Add distributed tracing | ||
| model_pi: openai/gpt-5.6-terra | ||
| effort_pi: medium | ||
| model_sdk: claude-sonnet-5 | ||
| effort_sdk: high | ||
| skills: [] | ||
| allowedTools: [Read, Write, Edit, Glob, Grep, load_skill_menu, install_skill] | ||
| disallowedTools: [enqueue_task] | ||
| dependsOn: [logs] | ||
| optional: true | ||
| --- | ||
|
|
||
| ## Goal | ||
|
|
||
| Configure PostHog distributed tracing for this project's server runtimes. Load the | ||
| `tracing` skill menu, install its matching skill, and read the platform reference | ||
| before editing. Choose the capture path the skill describes for this runtime. If | ||
| the app already uses OpenTelemetry, write against its existing OTel version and | ||
| name exporter packages compatible with it — never require, or write code that | ||
| assumes, an upgrade of a package this integration did not introduce. A | ||
| browser-only app gets no tracing. If no documented setup applies, complete as | ||
| `not needed` and explain why. | ||
|
|
||
| Where a web app or other application sits beside an MCP server (the detected facts | ||
| name any MCP server), the app is your target, and MCP analytics owns the MCP server. | ||
| Workers, queues and shared packages belong to the app. Leave a separately run MCP | ||
| server's files alone. If the MCP server is the whole project, it is your target. | ||
|
|
||
| This run cannot ask questions, so where the skill says to ask, decide as follows: | ||
|
|
||
| - If the app already exports traces to another tracing backend, do not add PostHog | ||
| as a second destination. Complete as `not needed`, name the backend, and give the | ||
| user the exporter change that would add PostHog beside it. | ||
| - If the app already exports OpenTelemetry traces to PostHog, report that without | ||
| adding a second exporter. | ||
| - If the setup needs a new launch command (such as `opentelemetry-instrument` or a | ||
| Java agent flag), do not change how the app starts. Use a code-based setup the | ||
| platform reference documents, or skip with that reason. | ||
|
|
||
| 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 | ||
| names or attributes, and add manual spans only where the skill says auto | ||
| instrumentation has no coverage. | ||
|
|
||
| Never wait on span export before the app starts serving, because a slow PostHog | ||
| host would hold up its boot. Let the batch processor export on its interval, and | ||
| flush only at shutdown, or at the end of each invocation where the skill says a | ||
| short-lived or serverless handler needs it. | ||
|
|
||
| This is the instrumentation part of a larger integration. Instead of the | ||
| standalone skill's install command, name the required packages in your handoff, | ||
| list each one in the handoff's `packages` field, | ||
| and leave installation, manifest and lockfile updates, builds, and lint to | ||
| review. Do not run `opentelemetry-bootstrap` or any other installer. Do not edit | ||
| dependency manifests or write a version number you invented — the package manager | ||
| resolves real versions when review installs by name. Use `detect_package_manager` | ||
| if needed. Use the wizard's supplied project and region and the env names from | ||
| upstream handoffs; inspect and write environment files only through | ||
| `check_env_keys` and `set_env_values`. Do not request credentials or select a | ||
| different project. If required configuration is unavailable, report what is | ||
| missing instead of guessing a region. | ||
|
|
||
| ## How you know you succeeded | ||
|
|
||
| Tracing is configured once for the supported runtime, was already present, or has | ||
| a clear skip reason. The handoff names the changed files, packages, env variable | ||
| names (never values), the service name, and any dependency work for review. Give a | ||
| specific request the user can send to produce a trace and where to find it in | ||
| PostHog Tracing, filtered by that service name; delivery remains unverified until | ||
| observed. Do not publish a separate report. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
Details
Latent: this goes live once the
wizard-default-tracingflag returns'true'(excludedTaskTypesinsrc/programs/posthog-integration/index.ts).src/programs/posthog-integration/agent/tracing.mdtells 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:
http.target, orurl.pathplusurl.query). They also record the full outbound URL (http.url/url.full). Recent versions redact only a few signature parameters.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.mdkeeps 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 fortoken=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:
Agent-driven security review. The
tracingskill 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.