feat(wizard): Add User-Agent header to wizard HTTP requests#291
Merged
feat(wizard): Add User-Agent header to wizard HTTP requests#291
Conversation
Add User-Agent identification so PostHog can distinguish wizard-originated requests. Direct API calls send 'posthog/wizard' and the MCP server receives the same header so it can construct 'posthog/mcp posthog/wizard'. https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K
🧙 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
Results will be posted here when complete. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a consistent User-Agent header ('posthog/wizard') to all HTTP requests made by the wizard, enabling better request identification and tracking across the PostHog API and MCP server.
Changes:
- Introduced
WIZARD_USER_AGENTconstant insrc/lib/constants.ts - Added User-Agent header to PostHog API calls in
src/lib/api.ts - Added User-Agent header to OAuth token exchange in
src/utils/oauth.ts - Configured User-Agent header for MCP server requests in
src/lib/agent-interface.ts
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/lib/constants.ts | Defines the new WIZARD_USER_AGENT constant with documentation |
| src/lib/api.ts | Applies User-Agent header to fetchUserData() and fetchProjectData() API calls |
| src/utils/oauth.ts | Applies User-Agent header to OAuth token exchange request |
| src/lib/agent-interface.ts | Configures User-Agent header for MCP server initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes format from 'posthog/wizard' to 'posthog/wizard; version: 1.34.0' to match the convention used by other PostHog tools like the MCP server. https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K
Replace the try/catch require approach with a clean import from package.json, enabled by adding resolveJsonModule to tsconfig. TypeScript handles emitting the JSON into dist/ automatically. https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K
vdekrijger
approved these changes
Feb 26, 2026
Collaborator
|
/wizard-ci next-js |
Collaborator
|
/wizard-ci next-js |
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.
Summary
This PR adds a consistent User-Agent header to all HTTP requests made by the wizard, enabling better request identification and tracking across the PostHog API and MCP server.
Key Changes
WIZARD_USER_AGENTconstant ('posthog/wizard') tosrc/lib/constants.tswith documentationsrc/lib/api.tsto include the User-Agent header in:fetchUserData()- PostHog API call to fetch user informationfetchProjectData()- PostHog API call to fetch project informationsrc/utils/oauth.tsto include the User-Agent header in:exchangeCodeForToken()- OAuth token exchange requestsrc/lib/agent-interface.tsto include the User-Agent header in:Implementation Details
The User-Agent header is now consistently applied across all wizard HTTP requests, allowing the PostHog API and MCP server to identify and track requests originating from the wizard. This improves observability and enables better request routing/handling on the server side.
https://claude.ai/code/session_01UtRaBE3tQHdDxtnskKjT8K