fix(install): surface unclaimed environments honestly - #234
Merged
gjtorikian merged 2 commits intoAug 26, 2026
Conversation
A friction log of the AuthKit getting-started path found the installer describing a zero-auth environment it had just minted itself as "the WorkOS credentials you provided". The tester went to the dashboard to reconcile a client ID that did not match, and only found the claim prompt by accident after starting a dev server. The provenance gate added in #200 was correct; the label feeding it was not. runWithCore backfills credentials from the project's .env.local before the machine starts, and that is the path a freshly provisioned environment takes, so checkingCliFlags short-circuited and called them 'cli'. Reading the machine's own transitions exonerates it -- the mislabeling happens one level up, in whoever builds the initial context. Claiming is the one step that cannot be recovered later, since an unclaimed environment's credentials live only on this machine, so it now leads the completion box instead of appearing once at provision time and scrolling away behind the agent run. Provisioning returns no environmentId or environmentName, so the environment naming from #231 could never reach an unclaimed environment and every status line degraded to generic copy. Persisting authkitDomain gives it the one human-recognizable name it has.
Greptile SummaryThe PR corrects install-time credential provenance and improves the guidance shown for newly provisioned unclaimed environments.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
|
A pair where the user supplied one credential and the project env file backfilled the other was labeled 'env' wholesale, so the installer announced `.env.local` as the origin of a value typed on the command line and stayed silent about the value the user did provide. Only a pair the user supplied nothing toward is an env-file resolution — the freshly provisioned unclaimed environment path this provenance was added for. Mixed pairs keep the caller's source. Extracted the decision into resolveCredentialSource() so it is covered directly.
gjtorikian
deleted the
fix/unclaimed-env-credential-provenance-and-claim-cta
branch
August 26, 2026 20:54
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
Three coupled fixes to the zero-auth install path, all from the same finding: the installer minted an environment, then described it in a way that sent the tester to the dashboard to reconcile a client ID that didn't match anything they had.
credentialSourcegate from feat!: consent-gated agent setup and flat CLI output #200 was correct, but the label feeding it was not.runWithCorebackfillsoptions.apiKey/clientIdfrom the project's.env.localbefore the state machine starts — and that is exactly the path a freshly provisioned unclaimed environment takes, since provisioning writes that file frombin.tsfirst. SocheckingCliFlagsshort-circuited and hardcoded'cli', and the installer announced "Using the WorkOS credentials you provided" for credentials it had just minted itself. Credentials backfilled from a project env file are now labeled'env'.workos profile claimwas printed once, at provision time, then buried under scaffolding and the whole agent run. It now leads the completion box's next steps — first, because an unclaimed environment's credentials live only on the local machine, so a missed claim is the one step that cannot be recovered later. Resolved by reading config at completion (an environment claimed mid-install via the browser CTA is not told to claim itself) and gated on an exact credential match, so a leftover unclaimed profile can't name an environment this install never touched.POST /x/one-shot-environmentsreturns noenvironmentIdorenvironmentName, soprofileEnvironmentLabel()had nothing to build from and the environment naming shipped in feat(install): name the environment in installer status lines #231/feat(install): show the whole team in the environment picker #232 could never reach an unclaimed environment — every status line degraded to "Using your active WorkOS environment", reading as though the CLI had picked up an environment the user already had. TheauthkitDomainthe API already returns was being discarded; it is now persisted and rendered: "Using a new WorkOS environment created for this install (witty-rest-53.authkit.app)".credentials:found, not juststaging:success. Worth a reviewer's attention: the provisioned-unclaimed path never reaches staging resolution, so anything added only to thestaging:successhandler is dead code for the most common zero-auth install. Both paths are handled.Found existing WorkOS credentials in .env.localno longer prints for credentials passed as--api-key/--client-id, which never came from that file.Notes for reviewers
credentials:foundgained a payload (source,credentials); it was previouslyRecord<string, never>.workos install, which would provision a real unclaimed environment and run the agent end to end.src/generated/runtime-deps-manifest.tsis untracked and not in.gitignore, unlike its two siblings on lines 25-26. Pre-existing and left alone here, but probably worth a follow-up.