Repository navigation
feat(self-driving): integrate first when the project has no PostHog - #760
Merged
Merged
Conversation
🧙 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. |
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
gewenyu99
force-pushed
the
vincent/wizard-self-driving-handoff
branch
2 times, most recently
from
June 29, 2026 18:11
d881b04 to
c13117a
Compare
gewenyu99
force-pushed
the
vincent/wizard-self-driving-handoff
branch
from
June 29, 2026 23:25
a259d79 to
0d5a549
Compare
gewenyu99
force-pushed
the
vincent/wizard-self-driving-handoff
branch
3 times, most recently
from
June 30, 2026 01:37
adb713c to
48dccdb
Compare
gewenyu99
marked this pull request as ready for review
June 30, 2026 01:53
gewenyu99
force-pushed
the
vincent/wizard-self-driving-handoff
branch
from
June 30, 2026 02:15
48dccdb to
3967468
Compare
5 tasks
When the project has no PostHog, self-driving sets it up first, then runs Self-driving — composed as steps in one program: - After auth, the detect screen scans the repo and the user picks which project to set PostHog up in (a monorepo can have several). - posthog-integration exports a self-contained run step; self-driving imports it and runs it in the picked project's dir, then a handoff screen, then its own run step. - The runner walks the step list and runs each run step's own agent. One login: the bootstrap calls an idempotent authenticate() the second run reuses. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gewenyu99
force-pushed
the
vincent/wizard-self-driving-handoff
branch
from
June 30, 2026 02:37
3967468 to
e8f3054
Compare
sortafreel
approved these changes
Jun 30, 2026
sortafreel
left a comment
Contributor
There was a problem hiding this comment.
Great job, kudos! Added a couple of concerns, approving on a trust-me-bro basis :)
sortafreel
enabled auto-merge (squash)
June 30, 2026 13:30
rafaeelaudibert
added a commit
that referenced
this pull request
Jul 14, 2026
## What Builds on the [#760](#760) self-driving "integrate first" flow. When self-driving falls back to **"no PostHog found"**, we now ask the user whether they already have a PostHog account, and route auth accordingly — instead of always assuming OAuth. The merged integration-check screen now offers two answers (both still integrate the SDK first): - **Yes — log me in** → authenticate via OAuth (unchanged default). - **No — create one for me** → collect **email** + **cloud region**, flip `session.signup`, and let `authenticate()` take the **existing provisioning path** (`askForProvisioningSignup` → `provisionNewAccount`: create the account, email a login link). No `--signup` / `--email` flags needed — it's all interactive now. ## Why A project with no PostHog SDK is often a project whose owner has no PostHog account yet. Previously that user hit OAuth and had to go create an account out-of-band first. Now the wizard provisions one for them in place. ## Notable detail — AI opt-in gate A provisioning access token deliberately omits the `organization:read` scope (`WIZARD_PROVISIONING_SCOPES`), so `apiUser` stays `null` and `organization.is_ai_data_processing_approved` can never be read back. The AI opt-in gate (`session.ci || aiApproved`) would therefore **never clear** for a provisioned account and the run would hang. This treats `signup` as auto-consent alongside `ci` (they're already grouped as one non-interactive mode in `shouldDisableAsk`) — which also fixes the same latent hang in the base `wizard --signup` flow. ## Changes - `SelfDrivingIntegrationCheckScreen.tsx` — rewritten to a 3-stage screen: ask → email input → region picker. - `store.ts` — `chooseProvisionAccount(email, region)` sets `signup`/`email`/`region`/`integrate` in one atomic emit. - `ai-opt-in-gate.ts` — `signup` auto-consents like `ci`. - `self-driving.ts` — refreshed `--integrate` help text and the `--signup`-rejection message (points users at the interactive flow). - `wizard-session.ts` — corrected the stale `integrate` doc comment. - Tests in `store.test.ts` and `programs.test.ts`. ## Testing `pnpm build` ✅ · `pnpm lint` ✅ (0 errors) · targeted unit tests ✅. The only failing tests in the full suite are 3 pre-existing `provision-cli.test.ts` failures present on `main` before this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

Problem
Self-driving assumed the project already had a PostHog SDK. A project without one had nowhere to start — no events, no signals, nothing to drive.
Changes
When PostHog isn't found, the wizard sets it up first, then hands off to Self-driving:
intro → "No PostHog found" → auth → detect-and-pick → integration → handoff → Self-drivingrunInProgramPhases), used by both the runner and the snapshot harness.Test plan
pnpm test— offline flow-trace, router, step, and screen tests.Screens