Repository navigation
[CI] (69eeefc) vercel-ai/nextjs-support-chat - #4082
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
|
Now I have everything I need to produce the evaluation. PR Evaluation ReportSummaryThis PR instruments a Next.js + Vercel AI SDK support chat app for PostHog AI observability. It uses the
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | Report confirms npm run typecheck and npm run build pass. |
| Preserves existing env vars & configs | Yes | Existing app behavior, response shape, and tool implementation are preserved. |
| No syntax or type errors | Yes | TypeScript compiles successfully. |
| Correct imports/exports | Yes | @posthog/ai/vercel withTracing and posthog-node PostHog are real exports. @/instrumentation resolves via path alias. |
| Minimal, focused changes | No | tsconfig.json reformatting is unnecessary scope creep. |
| Pre-existing issues | None | Base app is clean. |
Issues
- No
.env.example:POSTHOG_API_KEYandPOSTHOG_HOSTare required but not documented in an.env.examplefile. The.envexists locally but is gitignored. New developers would not know which variables are needed. [MEDIUM] - Unnecessary tsconfig formatting:
tsconfig.jsonchanges are purely cosmetic reformatting with zero functional impact. [LOW]
Other completed criteria
- No credentials are hardcoded in source code;
.envis properly gitignored - Dependency versions (
@posthog/ai^8.13.1,posthog-node^5.52.5) are plausible - PostHog client is flushed before handler returns via
finallyblock - Tool definition and
lib/orders.tsare untouched
PostHog implementation ❌
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | @posthog/ai and posthog-node added to dependencies. |
| PostHog client initialized | Yes | posthog-node client created at module scope in instrumentation.ts with flushAt: 1, flushInterval: 0. |
| capture() | Yes | withTracing implicitly captures `` events on each model call. |
| identify() | N/A | Server-side; identity via posthogDistinctId per call. |
| Error tracking | Yes | enableExceptionAutocapture: true on the PostHog Node client. |
| Reverse proxy | N/A | Server-only app. |
Issues
- Wrong instrumentation path: The README requires
instrumentation.tsto start the OTel SDK withPostHogSpanProcessorandexperimental_telemetry: { isEnabled: true }on thegenerateTextcall. The PR instead useswithTracingmodel wrapper, which is a fundamentally different approach that cannot capture Vercel AI SDK's built-in telemetry spans (tool calls, step metadata). [CRITICAL] - Missing tool call spans:
withTracingwraps only the model'sdoGenerate/doStreamcalls. ThelookupOrdertool execution is a Vercel AI SDK-level step that only emits OTel spans whenexperimental_telemetryis enabled. Without it, the tool call span is silently absent from the trace tree. [CRITICAL]
Other completed criteria
- PostHog client initialized once at module scope, not per-request
posthogDistinctIduses the request'suserId(per-request, not process-global)- `` uses the correct property key
- Session ID derived from
threadId— same thread yields same session across requests posthogTraceIdshared UUID per request groups all generations into one trace- No hand-authored spans around helper functions
- No pre-existing PostHog code was modified
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
app/api/chat/route.ts |
`` | Each model call (initial tool_use + final answer) produces a generation event via withTracing. Tool span (lookupOrder) is NOT captured. |
instrumentation.ts |
Client initialization | PostHog Node client created; no OTel TracerProvider or SpanProcessor configured. |
Issues
- Incomplete trace tree: The README expects
generation → span(lookupOrder) → generationper request. The PR only producesgeneration → generation— the tool call span is missing becausewithTracingdoes not hook into Vercel AI SDK's step-level telemetry. [CRITICAL] - Session and trace grouping is correct: Despite the wrong path, the identity wiring (distinct ID, trace ID, session ID per request) is correct and would produce proper grouping for the events that ARE emitted. [LOW]
Other completed criteria
- Person attribution uses the request's
userId, not a hardcoded value - Session ID derives from the app's natural
threadIdconcept - No fabricated structure — session and trace map to real app concepts
- No credentials or secrets placed in event properties
Reviewed by wizard workbench PR evaluator
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.
Automated wizard CI run
Source: wizard-pr
Trigger ID:
69eeefcApp:
vercel-ai/nextjs-support-chatApp directory:
apps/vercel-ai/nextjs-support-chatWorkbench branch:
wizard-ci-69eeefc-vercel-ai-nextjs-support-chatWizard branch:
posthog/functional-a1-minContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-09-22T16:02:22.966Z
Duration: 356.7s
YARA Scanner