docs: learn official phone verification update

This commit is contained in:
2026-05-10 15:44:19 +08:00
parent ca30d4c5cd
commit 02121412e3
5 changed files with 506 additions and 0 deletions
@@ -48,6 +48,7 @@ These are confirmed operating rules for BOSS's environment:
- ClawEmail creates a fresh mailbox for every run (`CLAWEMAIL_CREATE_PER_RUN=true`). Record every created mailbox locally with outcome classification: pending, success, failed. **Immediately after creation, actively set/verify the mailbox's communication settings before submitting it to OpenAI:** new sub-mailboxes can default to internal-only (`commLevel=1`, `extReceiveType=0`), which blocks OpenAI verification mail. The gate must pass with external receive enabled (`commLevel=2`, `extReceiveType=1`). Do not merely tell BOSS to do this manually: first try the logged-in ClawEmail Dashboard API `POST /api/v1/mailboxes/comm-settings?id=<mailboxId>` with `{commLevel:2, extReceiveType:1, extSendType:0}`. If the Dashboard is not logged in, open/login to it and ask BOSS only for the QQ master-mailbox 6-digit login code if the agent cannot read QQ mail. See `clawemail-operations` reference `references/clawemail-dashboard-comm-settings-openai-signup-2026-05-10.md` and this skill's `references/clawemail-external-receive-gate-openai-2026-05-10.md`.
- Phone/SMS platform has no default. Keep `PHONE_VERIFICATION_ENABLED=false` and `PHONE_SMS_PROVIDER` empty unless BOSS configures one or approves enabling it after a phone verification appears.
- If phone verification appears and BOSS has configured 5sim, use **SMS activation for `openai`**, not WhatsApp receive channels. The original extension's 5sim provider buys `/v1/user/buy/activation/{country}/{operator}/openai`, polls `/v1/user/check/{activationId}`, and finishes/cancels the activation. **Before buying any 5sim number, pass the identity gate:** the browser must already be confirmed on `auth.openai.com/add-phone` for a usable OpenAI account. If OpenAI returns `account_deactivated`, if ClawEmail cannot create a new sub-mailbox due to quota, or if reused sub-mailboxes only show password mismatch, stop and ask BOSS to free mailbox quota/provide the correct password/approve another mailbox provider. **Country selection priority is `FIVE_SIM_COUNTRY_ORDER` first** (comma-separated list such as `argentina,netherlands,indonesia`), then `FIVE_SIM_COUNTRY_ID`, then the original extension default `vietnam` only if both are empty. For each configured country, rotate numbers up to `PHONE_VERIFICATION_REPLACEMENT_LIMIT`; do **not** silently switch outside the configured order unless BOSS approves. Before buying/submitting a non-USA number, verify the OpenAI visible country selector is already the expected country (for example `阿根廷 (+54)`, `荷兰 (+31)`, `印度尼西亚 (+62)`, or `越南 (+84)`); if it reverted to `美国 (+1)`, fix the selector first or the number will be parsed as invalid. Use visible UI paste/click on `add-phone` when possible because CDP-only input mutation can desync React state and revert the country on submit. If a number is **not immediately rejected**, do not cancel it after one polling timeout: poll 5sim, click OpenAI `重新发送`, poll again, and retry resend at least once before canceling/rotating. If changing proxy (for example `1085``1083` or back), expect OpenAI auth session invalidation and restart from a fresh target OAuth URL. Codex2API env URLs may point at `/admin/accounts`; derive the API origin before calling `/api/admin/oauth/generate-auth-url`. If OpenAI returns `account_deactivated` after email verification, stop the current account and start with a new ClawEmail sub-mailbox instead of burning 5sim numbers. See `references/openai-add-phone-5sim-sms-activation-2026-05-10.md`, `references/openai-phone-verification-5sim-sms-2026-05-10.md`, `references/openai-phone-verification-proxy1083-resend-2026-05-10.md`, `references/codex-oauth-token-lite-automation-flow-2026-05-10.md`, and `references/clawemail-quota-identity-gate-before-phone-verify-2026-05-10.md` for observed behavior, resend strategy, proxy-switch recovery, identity-gate checks, and pitfalls.
- If a phone-verification runner is stopped or interrupted, immediately inspect/cancel any active 5sim activation left in `RECEIVED`; killed scripts may not execute cleanup. For a UK `+44` run, use 5sim country slug `england`, OpenAI ISO `GB`, visible selector `英国 (+44)`, and dial prefix `44`. See `references/openai-add-phone-strict-country-gate-2026-05-10.md` and `references/openai-add-phone-uk44-and-runner-cleanup-2026-05-10.md`.
- Plus mode uses `PLUS_PAYMENT_METHOD=gopay`. Any paid GoPay action still requires explicit confirmation immediately before payment/approval.
- GoPay WhatsApp OTP uses **方案 A / manual checkpoint**: set `GOPAY_OTP_SOURCE=manual`. The extension detects OTP input and opens a side-panel prompt (`requestGoPayOtpInput` / “输入 GoPay 验证码”); BOSS pastes the WhatsApp code, then the extension fills OTP, fills `GOPAY_PIN`, and continues.
- `GOPAY_OTP` should normally stay empty before the run. It is only a temporary prefill/cache for the current OTP dialog, not a durable secret.
@@ -0,0 +1,97 @@
# Official codex-oauth extension update learnings for phone verification (2026-05-10)
Source inspected: `QLHazyCoder/codex-oauth-automation-extension` update from local `7dc5cf2` to upstream `6bd00db` (`origin/master`).
## Files inspected
- `background/phone-verification-flow.js`
- `content/phone-auth.js`
- `phone-sms/providers/five-sim.js`
- `tests/phone-auth-country-match.test.js`
- `tests/phone-verification-flow.test.js`
## Useful changes to copy into Hermes runner/workflow
### 1. Detect WhatsApp resend channel without clicking
Official content script now extracts resend button text from `value`, `aria-label`, `title`, `innerText`, and `textContent`, then classifies the resend channel:
- `whatsapp` if text matches `/whats\s*app/i`
- `sms` if text matches `sms|text message|短信`
- `unknown` otherwise
It supports a `probeOnly` mode that returns channel info without clicking.
Hermes runner rule:
1. After submitting a phone number and before clicking resend, probe resend button/channel.
2. If channel is `whatsapp` and BOSS's policy is SMS-only, cancel the 5sim SMS order and rotate/stop; do not click WhatsApp resend.
3. Log compact JSONL phase `whatsapp_resend_detected_cancel`.
### 2. Classify OpenAI HTTP 500/contact-verification server errors
Official update adds server-error detection for pages such as:
- `This page isnt working`
- `currently unable to handle this request`
- `HTTP ERROR 500`
- `500 Internal Server Error`
Hermes runner rule:
- If resend or phone verification lands on this error page, classify as `resend_server_error`, cancel current activation, recover by navigating/generating fresh OAuth session back to `add-phone` before next number.
### 3. Broader direct-delivery-refused detection
Official update adds a broader delivery-refused classifier for Chinese/English variants such as:
- `无法向此电话号码发送验证码`
- `无法向...号码...发送验证码/短信`
- `cannot/unable to send/deliver verification code/sms/text to this phone number`
Hermes runner should treat these as direct number rejection:
- cancel/ban the current order;
- rotate to next number;
- do not keep polling.
### 4. United Kingdom prefix mapping
Official HeroSMS prefix mapping includes:
```js
{ prefix: '44', id: 16, label: 'United Kingdom' }
```
For 5sim/OpenAI country tests in BOSS's runner, map UK as:
```text
5sim country slug: england
OpenAI select ISO: GB
visible text: 英国 (+44)
prefix: 44
```
### 5. Stale email-verification guard
Official signup phone flow now checks whether the page has unexpectedly returned to `/email-verification` before polling/submitting phone SMS. Treat that as stale signup/email-verification state and stop/replace number/account rather than burning SMS orders.
### 6. Waiting callback while polling 5sim
Official 5sim provider added `onWaitingForCode` during polling. Hermes runner can mimic this with compact JSONL status events so long waits do not look stuck.
## Runner patch applied locally
`/tmp/phone_verify_strict_gate_10.py` was patched to:
- probe resend channel before clicking;
- cancel and continue if WhatsApp resend is detected;
- classify server-error pages before/after resend;
- keep strict country gate before buying and before clicking Continue.
## Keep from prior Hermes-specific lessons
- Do not submit if `selectValue` and visible country/dial code mismatch.
- Do not submit a non-US number when visible country is `美国 (+1)`.
- If a 5sim order is already bought and country gate fails, cancel immediately.
- For BOSS's configured SMS-only policy, do not switch to WhatsApp providers unless explicitly approved.
@@ -0,0 +1,89 @@
# Strict OpenAI phone country/area-code gate (2026-05-10)
## Trigger
Use this note for any OpenAI `auth.openai.com/add-phone` automation that buys and submits 5sim phone numbers.
## Bug that caused this rule
During a 1085 + Indonesia test, the browser page had silently reverted to the United States selector (`美国 (+1)`) while the agent bought an Indonesia `+62` number. The number was submitted as a US local number, and OpenAI moved to `phone-verification` showing it had sent to a `+1 (...)` number. That attempt was invalid and the 5sim order was canceled.
## Mandatory rule
Never rely on the intended country in the script. Before buying, after filling, and immediately before clicking Continue, verify BOTH:
1. Native select value equals the intended ISO country code.
2. Visible country button text contains the intended country and dialing code.
Examples:
| Country | ISO | Visible text |
| --- | --- | --- |
| Argentina | `AR` | `阿根廷 (+54)` |
| Netherlands | `NL` | `荷兰 (+31)` |
| Indonesia | `ID` | `印度尼西亚 (+62)` |
If either check fails:
- Do not click Continue.
- If a 5sim order was already bought, cancel it immediately.
- Reset the country selector and re-check before retrying.
- Exclude the invalid attempt from country/provider result statistics.
## Reliable country setting
React Aria click/pointer events are unreliable. Use the hidden/native select directly:
```js
const sel = document.querySelector('select');
sel.focus();
sel.value = 'ID'; // AR, NL, ID, etc.
sel.dispatchEvent(new Event('input', { bubbles: true }));
sel.dispatchEvent(new Event('change', { bubbles: true }));
await new Promise(r => setTimeout(r, 800));
```
## Gate function
```js
function visibleCountryText() {
return [...document.querySelectorAll('button')]
.map(b => b.innerText)
.find(t => /\(\+\d+\)/.test(t));
}
function assertCountryGate(iso, visible) {
const selectValue = document.querySelector('select')?.value;
const country = visibleCountryText();
if (selectValue !== iso || country !== visible) {
throw new Error(`country_gate_failed: select=${selectValue} visible=${country}`);
}
}
```
## Correct runner behavior
1. Restore or open `add-phone`.
2. Set country via native select.
3. Run `assertCountryGate()`.
4. Only then buy a 5sim activation.
5. Fill the local part of the phone number.
6. Run `assertCountryGate()` again.
7. Click Continue.
8. Read the result:
- direct rejection (`无法向此电话号码发送验证码` / `电话号码无效`) -> cancel and rotate;
- accepted/waiting -> poll 5sim, click resend once, poll again, then cancel/rotate if still no SMS.
## Replacement limit
For the current configured test, BOSS requested 10 replacements:
```text
PHONE_VERIFICATION_REPLACEMENT_LIMIT=10
```
Keep using configured country order first:
```text
FIVE_SIM_COUNTRY_ORDER=argentina,netherlands,indonesia
```
@@ -0,0 +1,96 @@
# OpenAI add-phone UK +44 and interrupted-run cleanup notes (2026-05-10)
## What changed
BOSS requested stopping the active Argentina/Netherlands/Indonesia run and switching phone verification to the UK `+44`.
## Mandatory cleanup when stopping a runner
When a background phone-verification runner is killed/interrupted, immediately inspect the last active 5sim activation from the JSONL log and cancel it if status is still `RECEIVED`.
Observed interrupted order:
```json
{"activation_id":"1006733450","country":"netherlands","status":"RECEIVED","sms_count":0}
```
Cleanup result:
```json
{"activation_id":"1006733450","result":"CANCELED"}
```
Do not assume a killed runner canceled its current order.
## UK +44 mapping for OpenAI add-phone
5sim country slug used successfully for buying OpenAI activation:
```text
england
```
OpenAI selector mapping:
```text
ISO: GB
Visible text: 英国 (+44)
Dial prefix: 44
```
Config for UK-only run:
```text
FIVE_SIM_COUNTRY_ORDER=england
PHONE_VERIFICATION_REPLACEMENT_LIMIT=10
FIVE_SIM_OPERATOR=any
FIVE_SIM_PRODUCT=openai
```
## Strict country gate remains mandatory
Before buying and before clicking Continue, verify both:
```json
{"country":"英国 (+44)","selectValue":"GB"}
```
Observed valid gate before the first UK buy:
```json
{
"phase": "country_gate_before_buy",
"country": "england",
"attempt": 1,
"ok": true,
"country_text": "英国 (+44)",
"selectValue": "GB"
}
```
Then 5sim bought a UK number:
```json
{"phase":"buy","country":"england","activation_id":1006734496,"masked":"+4477***381","status":"RECEIVED"}
```
## Runner behavior after UK switch
Use a single configurable strict-gate runner, not ad-hoc CDP snippets:
1. Stop old runner.
2. Cancel in-flight activation from its log.
3. Set `FIVE_SIM_COUNTRY_ORDER=england`.
4. Ensure metadata includes `england: {iso:'GB', visible:'英国 (+44)', prefix:'44'}`.
5. Restore OAuth/add-phone if currently on phone-verification or a Chrome error page.
6. Set country via native select.
7. Run strict gate.
8. Buy only after gate passes.
9. Fill local phone part.
10. Run strict gate again.
11. Click Continue.
12. Poll; resend once; poll; cancel/rotate if no SMS.
## Pitfall
BOSS watches the visible screen and will catch wrong country/area code. If the visible selector says `美国 (+1)` while a non-US number is being used, stop immediately, cancel any new order, restore add-phone, and verify the correct visible code before buying/submitting again.