fix(brand-claim): recover from stale WorkOS domain entries with null token/prefix#3958
Closed
fix(brand-claim): recover from stale WorkOS domain entries with null token/prefix#3958
Conversation
…token/prefix When issueDomainChallenge found an existing pending domain entry in WorkOS that had null verificationToken or verificationPrefix, it returned the stale row as ok:true, causing a silent "WorkOS didn't return a DNS record" error with no user recovery path. Every retry hit the same code path deterministically, requiring manual admin deletion of the WorkOS domain row to unstick. The idempotent pre-check now detects this broken state, deletes the stale row (with 404/410 tolerance for concurrent requests), and falls through to a fresh create so a usable challenge token is returned. Verified entries are unaffected. Fixes #3953. https://claude.ai/code/session_01Cy3qQbLTEqJ4dd7xyXPe79
Contributor
Author
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.
Closes #3953
When
issueDomainChallengefound an existing pending domain entry in WorkOS that hadnullverificationTokenorverificationPrefix, it returned the stale row asok: true. The caller then rendered"Issued a challenge for {domain} but WorkOS didn't return a DNS record to publish — that's unusual."with no user recovery path. Every retry hit the same deterministic code path. Unsticking required manual admin deletion of the WorkOS domain row in the console (escalation #302, vastlint.org). The idempotent pre-check now detects this broken state, deletes the stale row (with 404/410 tolerance for concurrent requests), and falls through to a freshcreateOrganizationDomaincall so a usable token and prefix are returned. Verified entries are untouched — the guard only fires when!isVerifiedState(state).Non-breaking justification: purely server-side behavioral fix; no API contract, schema, or protocol definition changes. Changeset is
--empty.Pre-PR review:
== nullis right (SDK types token asstring|undefined); changeset front-matter correct. Nits: (1)toHaveBeenCalledWith({ organizationId: ORG, domain: DOMAIN })assertion missing in the two stale-delete tests; (2) no test forstate: verified, token: nullto prove the isVerifiedState guard blocks the delete path. Neither is a CI blocker.brand_claim_stale_domain_deletedPostHog event to track production frequency.Session: https://claude.ai/code/session_01Cy3qQbLTEqJ4dd7xyXPe79
Generated by Claude Code