fix: abort stale phone signup email verification

This commit is contained in:
root
2026-05-09 14:24:12 -04:00
parent 5462400aa4
commit e9d7086b30
6 changed files with 619 additions and 1 deletions
@@ -0,0 +1,10 @@
# Phone Signup Stale Email Verification Drift Adjudication Ledger
Immutable spec: `/root/projects/resister-codex/codex-oauth-automation-extension-upstream-base-vu8.0/codex-oauth-automation-extension/.worktrees/fix-icloud-polling-addphone-handoff/docs/superpowers/specs/2026-05-09-phone-signup-stale-email-verification-design.md`
Immutable plan: `/root/projects/resister-codex/codex-oauth-automation-extension-upstream-base-vu8.0/codex-oauth-automation-extension/.worktrees/fix-icloud-polling-addphone-handoff/docs/superpowers/plans/2026-05-09-phone-signup-stale-email-verification-plan.md`
## Active Adjudications Summary
| DRIFT_ID | STATUS | SCOPE | P9_FINAL_ADJUDICATION | EFFECTIVE_EXECUTION_CONTRACT |
| --- | --- | --- | --- | --- |
@@ -0,0 +1,18 @@
# Phone Signup Stale Email Verification Fix Plan
## Task 1: Detect Stale Email Verification During Phone SMS Wait
- Add a TDD regression test in the existing phone verification test area.
- Simulate `completeSignupPhoneVerificationFlow()` or its SMS wait helper entering phone-signup Step 4 with a valid signup phone activation while the auth tab is already on `/email-verification`.
- The failing test must show the helper currently continues SMS polling instead of returning/failing fast.
- Implement the smallest background-side page-state check needed to stop SMS waiting when the auth tab is already on email verification before SMS submission.
- Return or throw a distinct stale-phone-signup condition that `executeStep4()` can use to fail fast without treating it as a successful post-SMS handoff.
- Preserve existing successful post-SMS `emailVerificationRequired` handoff behavior.
## Task 2: Verification And Integration
- Run targeted tests covering phone verification and Step 4 handoff.
- Run full `PYTHONDONTWRITEBYTECODE=1 npm test`.
- Clean generated `scripts/__pycache__` artifacts.
- Create one checkpoint commit only after spec and code reviewers approve.
- Push the resulting branch to the Git export refs and the existing GitHub PR fork branch after final verification.
@@ -0,0 +1,26 @@
# Phone Signup Stale Email Verification Fix Design
## Scope
Fix phone-signup Step 4 behavior when OpenAI has already moved the auth tab to an email verification page before a phone SMS verification code is submitted.
## Required Behavior
- If phone-signup Step 4 is waiting for an SMS code and the auth tab is still on the phone verification page, keep polling the configured SMS provider.
- If phone-signup Step 4 is waiting for an SMS code but the auth tab has moved to `/email-verification`, stop waiting for SMS immediately.
- The `/email-verification` transition before SMS submission means the phone number is not usable for a new phone-signup account in this run. The flow must fail fast with a clear, actionable error so the current auto-run attempt can rotate/restart instead of hanging.
- If phone-signup Step 4 submits a valid phone SMS code and then OpenAI moves to `/email-verification`, preserve the existing handoff behavior and continue mailbox verification.
- Do not add operation-delay to SMS polling, email polling, backend retries, or background timers.
- Do not broaden iCloud-specific polling behavior to other mail providers.
## Error Semantics
The stale email-verification bailout must be distinguishable from SMS-provider timeout, invalid SMS code, user stop, and normal post-SMS email-verification handoff.
The user-facing message should explain that OpenAI moved to email verification before phone SMS verification completed, likely because the phone number is already associated with an existing account or login path, and the current number should be replaced.
## Testing Requirements
- Add a regression test that simulates phone-signup Step 4 polling while the auth tab is already on `/email-verification`; the test must fail before the implementation and pass after.
- Add or update tests to prove normal post-SMS email-verification handoff still works.
- Run targeted phone Step 4 tests and the full suite before completion.