Skip to content

fix: default generated POSTHOG_HOST to the detected region#802

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/eu-region-config-host
Draft

fix: default generated POSTHOG_HOST to the detected region#802
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/eu-region-config-host

Conversation

@posthog

@posthog posthog Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Problem

An EU customer who explicitly selected the EU region in the CLI got a Django config that pointed at the US cloud: POSTHOG_HOST = os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com'). Their events would silently land in the wrong region — a data-residency correctness bug.

The wizard already knows the region (detected post-token) and threads the correct host into the agent prompt as PostHog Host. But when the agent generated config code, it copied the https://us.i.posthog.com fallback literal from example code (context-mill skill docs for Django; an inline snippet for Ruby) instead of using the detected host as the default.

Changes

  • Shared integration prompt (posthog-integration/index.ts): added an explicit instruction that any hardcoded fallback/default host in generated code must use the detected PostHog Host, and never emit a fallback for a different region than the detected one. This covers Django and every skill-driven framework.
  • Ruby inline example (ruby-wizard-agent.ts): stopped hardcoding https://us.i.posthog.com, which directly contradicted the new guidance.

Test plan

  • New regression test asserts the integration prompt threads the EU host into the fallback guidance and never tells the agent to use the US literal as the default.
  • pnpm build && pnpm test (1157 passing) and pnpm lint (0 errors).

Created with PostHog Code from an inbox report.

The integration agent was copying the `https://us.i.posthog.com` fallback
literal from example code (skill docs / inline snippets) even when the user
selected the EU region, producing configs like
`POSTHOG_HOST = os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')`
for EU projects. The detected host was already in the prompt but the agent
wasn't using it as the fallback default.

Add an explicit instruction to the shared integration prompt to use the
detected PostHog Host as any hardcoded fallback/default, and stop the inline
Ruby example from hardcoding the US host (which contradicted that guidance).

Generated-By: PostHog Code
Task-Id: 72a06317-16be-4f06-8590-d001dd2d3dc3
@github-actions

github-actions Bot commented Jul 6, 2026

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 basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /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 error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

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.

0 participants