Files
codex-oauth-plus-onboarding…/skill/codex-oauth-plus-onboarding/references/openai-phone-verification-proxy1083-resend-2026-05-10.md
T
2026-05-10 08:45:11 +08:00

100 lines
5.1 KiB
Markdown

# OpenAI phone verification with 5sim SMS: proxy switch + resend-on-accepted-number notes (2026-05-10)
## Context
During a Codex2API OAuth onboarding run, OpenAI registration/login reached `https://auth.openai.com/add-phone`. BOSS suspected the previous proxy node influenced SMS delivery and asked to switch the visible Chrome browser proxy from `socks5://192.168.2.8:1085` to `socks5://192.168.2.8:1083`.
Important operating constraints from the run:
- Use visible Google Chrome stable with CDP on `127.0.0.1:9223`.
- Phone verification must use **5sim SMS activation** for product `openai`, not WhatsApp.
- Follow configured `FIVE_SIM_COUNTRY_ID`; if empty, use the original extension default `vietnam`.
- For non-USA numbers, verify the visible OpenAI country selector before buying/submitting the number.
- Do not leak phone numbers, API keys, OAuth URLs with codes, callback URLs, or admin keys.
## Proxy switch behavior
`1083` probe result in this session:
```text
nc 192.168.2.8 1083 -> TCP succeeded
curl --proxy socks5h://192.168.2.8:1083 https://api.ipify.org -> 43.207.194.18
curl --proxy socks5h://192.168.2.8:1083 -I https://chatgpt.com -> HTTP/2 403, cf-mitigated: challenge
```
Visible Chrome did not show a Cloudflare challenge, but switching proxy caused the OpenAI auth session to become invalid:
```text
https://auth.openai.com/add-phone -> title: 你的会话已结束 - OpenAI
```
Recovery pattern:
1. Cancel any active 5sim order before changing proxy.
2. Update `BROWSER_PROXY_SERVER` in `~/.hermes/env/codex_oauth_onboarding.env`.
3. Kill/relaunch only the isolated Chrome process using `--remote-debugging-port=9223 --proxy-server=<new proxy>`.
4. Regenerate a Codex2API OAuth URL from the **origin**, not from an admin page path:
- If `CODEX2API_URL=http://host:port/admin/accounts`, strip to `http://host:port`.
- Correct endpoint observed: `POST /api/admin/oauth/generate-auth-url` with `X-Admin-Key`.
5. Re-open the auth URL in the visible Chrome profile.
6. Re-login via email and poll ClawEmail for the latest OpenAI code.
7. Continue to `add-phone`.
Pitfall: using `CODEX2API_URL` directly when it contains `/admin/accounts` leads to wrong paths like `/admin/accounts/api/...` and 404. Always parse origin first.
## Country selector pitfall
OpenAI's country selector is React-controlled. CDP-only mutation of `input[type=tel]` can desync country state or let the selector revert to `美国 (+1)`. Future runs should prefer visible UI selection and paste:
1. Clear phone field.
2. Open country dropdown.
3. PageDown/scroll to the configured country.
4. Click the visible country row (Vietnam observed around screen coordinate `(620,1173)` on a 2560x1600 screenshot, but re-check with screenshot/OCR).
5. Verify DOM/body text includes the expected visible selector, e.g. `越南 (+84)`.
6. Buy 5sim activation only after the selector is stable.
7. Paste the local part of the phone via clipboard/UI, not CDP-only assignment.
8. Click the actual visible `继续` button; button center may differ by layout, verify screenshot if needed.
## Resend strategy correction from BOSS
BOSS corrected the workflow: when OpenAI does **not** immediately reject a phone number, do **not** cancel it after the first 5sim polling timeout. Treat it as an accepted/pending number:
1. Poll `/v1/user/check/{activationId}` for SMS.
2. If no SMS arrives, click OpenAI's visible/DOM `重新发送` control.
3. Poll again.
4. Repeat at least one more resend/poll cycle before canceling.
5. Only cancel and rotate when:
- OpenAI explicitly says `无法向此电话号码发送验证码`; or
- the number remains pending after resend attempts and no SMS arrives.
This matters because in this session some Vietnam numbers were not rejected immediately but never delivered SMS on 5sim. Those should be given resend attempts before cancellation.
## Observed results on 1083 + Vietnam
After switching to `socks5://192.168.2.8:1083`, multiple `vietnam/any/openai` SMS activation attempts were made. Outcomes:
- Several numbers were directly rejected by OpenAI with:
```text
无法向此电话号码发送验证码。请稍后重试或使用其他号码。
```
- Some numbers were not immediately rejected, but repeated 5sim checks returned `RECEIVED` with `sms=[]`.
- Applying the resend strategy still produced no SMS for the accepted/pending numbers in this run.
- Therefore, the current evidence points to poor availability/deliverability of the 5sim Vietnam OpenAI pool under both `1085` and `1083`, not a WhatsApp-vs-SMS mistake.
## Minimal reusable script pattern
For future automation, encapsulate this loop:
```text
cancel active order
ensure OpenAI add-phone page
ensure visible country selector == configured country
buy /v1/user/buy/activation/{country}/{operator}/openai
paste local phone via UI
click continue
if explicit reject: cancel + rotate
else: poll 5sim; click resend; poll; click resend; poll; then cancel + rotate if still no SMS
```
Do not hard-code `vietnam` unless `FIVE_SIM_COUNTRY_ID` is empty or BOSS explicitly requests it. If BOSS changes config to `england`, `japan`, etc., use that value and update the visible-country selection accordingly.