fix: registration no longer drops accounts on transient network errors

Merged
AM
21d ago
+81-18

Problem

Generated accounts were silently never added to the pool. Worker logs always ended with \1 fully created, but the gateway log showed the real story:

\
ERROR zcode_gateway.dash: generator: pool registration failed for
requests.exceptions.SSLError: ... UNEXPECTED_EOF_WHILE_READING
\\

Two stacked issues:

  1. Silent system-proxy inheritance. On Windows,
    equests\ with \proxies=None\ still inherits the IE/registry proxy (e.g. a VPN client on \127.0.0.1:10808) via \ rust_env\ — even when the generator config says \ip_source: direct. Every device-flow call rode that tunnel, which drops TLS connections at random.
  2. One flake killed the whole registration. \get_zcode_jwt/\get_plan\ had no per-request retry or exception handling. A single escaping \RequestException\ jumped straight past
    egister_account's outer 3-attempt loop, dropped the account, and left only a log line. (The catch-up scan only runs at startup, so nothing rescued it.)

Fix

*\generator/plan_check.py*

  • Shared
    equests.Session\ with \ rust_env = False: direct actually means direct; keep-alive across the init/authorize/callback/poll chain. \ZAI_PROXY\ still wins when explicitly set.
  • New _request()\ helper: per-request retries (3x, capped backoff) on transient \RequestException, used by every device-flow / billing / claim / telemetry call.
  • \get_plan\ / \get_current\ / \preview_plans\ return \None/[]\ on exhausted retries instead of raising.
  • Test-shim compatibility: when tests monkeypatch \plan_check.requests.get/post, _request\ dispatches through the patched functions (canned envelopes keep working, no live calls).

*\zcode_gateway/api_dash.py*


  • egister_account\ now catches per-attempt exceptions inside both retry loops, so a single network flake costs one attempt instead of the whole registration.

Evidence

  • Targeted suites green: \ est_claim_start, \ est_generator, \ est_accounts_dir, \ est_login_resilience\ — 55 passed.
  • Full suite: identical results vs pristine \master\ on the same machine (62 failed / 289 passed both trees; the 62 are env-dependent, e.g. missing optional deps / live-socket guards).
  • Live smoke test (real account token): a mid-flow \ConnectionError\ on /oauth/cli/poll\ was retried and recovered — JWT minted, plan read ['zcode-v3-start-plan-nt-1026', 'zcode-v3-start-plan-0817']. On master that same flake dropped the account.

Notes

  • No behavior change for proxied setups (\ZAI_PROXY\ set): retries and session pooling apply the same way.
  • The _MEI\ PyInstaller copy is unaffected — this only changes source; a rebuild picks it up.