Repository navigation
feat(error-tracking): capture in existing boundaries, version-aware server hooks, server identity - #446
Draft
ablaszkiewicz wants to merge 1 commit into
Draft
feat(error-tracking): capture in existing boundaries, version-aware server hooks, server identity#446ablaszkiewicz wants to merge 1 commit into
ablaszkiewicz wants to merge 1 commit into
Conversation
…erver hooks, server identity The capture task now adds capture to every error boundary the app already has (each Next.js error.tsx, a custom global-error.tsx, a Pages Router _error or _app boundary), checks the installed framework version before wiring a hook that version may not have (Next.js 14 has no onRequestError), starts the server client at boot, and links server errors to the browser user through tracing headers and the PostHog cookie. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkuJAD3n8f6Ra7L9p2UmPw
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a wizard branch:
Add Results will be posted here when complete. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull requests: 1. PostHog/posthog-js#5472 2. PostHog/posthog-js#5473 3. 👉 this PR 4. PostHog/wizard-workbench#4805 5. PostHog/posthog#125314
Problem
wizard error-trackingon four Next.js workbench apps (16 App Router, the same app with PostHog already present, 14 App Router, 15 Pages Router):error.tsxwithout capture in 3 of 4 App Router runs, so every render error under it was lost. The step skill told the agent not to wrap individual routes, and the agent read that as leaving existing boundaries alone.onRequestErrorthat Next.js 14 never calls, and the report told the user server errors were covered. All 10 server error scenarios were lost.tracing_headers.Changes
context/agents/error-tracking/capture-exceptions.md:error.tsx, a customglobal-error.tsx, a Pages Router_erroror_appboundary) are framework hooks: add capture to every one. Creating new per-route boundaries is still the hand-wrapping to avoid.onRequestErrorand runsinstrumentation.tsonly withexperimental.instrumentationHook. Where the version has no hook, name the uncaptured errors and the upgrade in the handoff.register()in Next.js).tracing_headersin the browser init, and on the server theX-POSTHOG-*headers first, then the PostHog cookie with a fresh session, never used for authentication.context/skills/integration-v2/error-tracking-step/description.md: existing boundaries swallow what they catch, so capture goes in each of them.Test plan
npm test(220 passing)wizard error-trackingwith this branch (--local-context-mill) on the four workbench apps, with the onboarding docs change seeded into the docs cache. Every run completed. Each production build was then exercised in a browser and over HTTP, and every event was checked in PostHog:error.tsxwas captured in all three App Router appsonRequestError, and its report names the server gap and the upgradePassing scenarios, before → after (flow and docs together): 16 App 6 → 13 of 15, 16 App with PostHog 5 → 13 of 15, 14 App 4 → 5 of 14, 15 Pages 5 → 10 of 11. The rest wait on the SDK PRs, a Next.js proxy bug, or edge source maps on Turbopack.
Still open: on Next.js 14 the agent leaves
experimental.instrumentationHookas a follow-up for the user. The capture task may not touch build config while the configure task ownsnext.config.🤖 Generated with Claude Code
https://claude.ai/code/session_01FkuJAD3n8f6Ra7L9p2UmPw