Files
codex-oauth-plus-onboarding…/skill/codex-oauth-plus-onboarding/references/openai-phone-country-scheduler-cyclic-chunks-2026-05-10.md

89 lines
2.7 KiB
Markdown

# Phone country scheduling: chunk limits must cycle until the global budget is exhausted
## Trigger
Use this note for OpenAI `add-phone` / 5sim phone verification runners that accept:
- an ordered country list, e.g. `italy,poland,spain,england`
- a global attempt budget, e.g. `20`
- a per-country consecutive-failure cap, e.g. `3`
## Pitfall observed
A runner built for:
```text
Italy/Poland/Spain/UK
max 3 consecutive failures per country
total attempts 20
```
used this shape:
```python
for country in ORDER:
local_attempt = 0
while total < MAX_TOTAL and local_attempt < MAX_CONSECUTIVE:
attempt(country)
```
This works for `total <= len(ORDER) * MAX_CONSECUTIVE`, e.g. 10 attempts with 4 countries and chunk size 3. But for `total=20`, it can only produce:
```text
Italy x3 -> Poland x3 -> Spain x3 -> UK x3 = 12 attempts
```
Then it exits early because the outer `for country in ORDER` is exhausted.
## Correct scheduling rule
When BOSS says:
```text
这些地区测试 N 次,每个地区连续失败 K 次就切换下一地区
```
interpret `N` as the global budget and `K` as the maximum consecutive attempts for one country. The country list must cycle until either success or `N` attempts are consumed.
For `ORDER=[italy,poland,spain,england]`, `N=20`, `K=3`, expected schedule is:
```text
1-3: italy
4-6: poland
7-9: spain
10-12: england
13-15: italy
16-18: poland
19-20: spain
```
Do **not** stop at 12 merely because every country had one chunk.
## Reference implementation
```python
def schedule_countries(order, max_total, max_consecutive):
total = 0
while total < max_total:
progressed = False
for country in order:
for local in range(1, max_consecutive + 1):
if total >= max_total:
return
total += 1
progressed = True
yield total, country, local
if not progressed:
return
```
Use the yielded `total` as the global attempt number and `local` as the consecutive attempt number within the current country chunk.
## Other gates still apply
- Do not buy a 5sim activation unless the active OpenAI page is already a usable `auth.openai.com/add-phone` page.
- Re-check visible country/area-code before buying and before submit.
- If OpenAI resend channel probes as WhatsApp and BOSS policy is SMS-only, cancel the activation and rotate/stop.
- If 5sim buy returns HTTP 200 `text/plain` such as `no free phones`, classify as inventory miss; no activation exists and no cancellation is needed.
- Close stale OAuth/OpenAI tabs before opening fresh recovery tabs unless the current tab is already the usable `add-phone` page.