#169 called anonymousNodes.CursorForOffset, warp.Pool.ReportWithRetryAfter and
warp.Pool.HasUntriedActive without defining them, so main did not compile.
Add the three methods: an attempt offset shifts the anonymous start node, a
longer Retry-After extends the egress cooldown, and HasUntriedActive matches
the pool's egress keys.
Also:
- rewrite title.go in house style: named limits, a prompt table, no issue
numbers in comments, and a titleFallback helper shared by both lanes
- document the held-back tool-call helpers in protocol/stream.go
- gofmt internal/admin/server.go
- drop the _test.go files from #169, #170 and #171
after() added to the pool wait group outside the lock, so a timer scheduled just as Close began Wait could be missed by the shutdown wait. Increment under the lock and refuse to schedule after Close, which removes the Add/Wait race.
Startup registers the first exit synchronously and failed closed on any
error, including Cloudflare's rate limit — which a fresh process can still
receive because the limit follows the source address. Wait out the pause
inside the initialization deadline instead, and give WARP initialization
one full rate-limit window so a deploy does not fail on a limit that is
about to expire.
A Cloudflare 429 on /reg no longer sleeps inside the registration path:
the registrar records the Retry-After window and fails fast, and the pool
schedules its next attempt after that window. Registration can no longer
hold createMu for minutes while requests wait for an exit.
Refill backs off when the colo hands out fewer distinct egress blocks
than the preload: three consecutive duplicate registrations pause it for
1-5 minutes instead of registering into a saturated colo forever.
Automatic free-model probes skip a pool with fewer than two exits and
stop the sweep after one probe retires an exit, so they cannot drain the
warm bench. Diagnostics are unaffected.
Registrations were paced by a fixed 12-second gap, which made a cold pool
and a 429 replacement wait minutes for capacity. Remove the gap: the
registrar now issues registrations back to back in the background,
serialized by the pool's create mutex, and only a rejected attempt backs
off (doJSON still honours Retry-After).
Keep half of warp.pool_size (at least one) hot as a preload: the first
exit still gates readiness, the rest register in the background, and
desiredLocked/scaleDown treat the preload as a floor so idle surplus is
still retired after 60 seconds but the warm bench survives. A 429 or 403
removes the exit from the ring and the next request uses a preloaded exit
immediately.
/healthz reports warp.preload, and the WebUI and all four READMEs
describe the behaviour.
The WARP pool could never rotate: its lifetime context was derived from the
startup deadline, so every standby registration and replacement died with
"context canceled" and requests stayed on the first egress forever. Give the
first registration the caller's deadline and the pool a context that only
Close cancels.
- warp.pool_size is an upper bound. The active ring follows concurrency (one
exit per lease, one per queued request, plus a spare) and trims idle surplus
after 60 seconds, so a burst expands it and quiet periods shrink it.
- An IPv6 exit is deduplicated and cooled by its /64 for 30 minutes (IPv4 by
its /32), since the free quota is scoped to that block.
- 429/403 retires an exit immediately and re-registers right away; a free
model request keeps switching exits and only returns the last 429 after
retry.max_attempts, on both the anonymous and the Zen-key lane. 429s no
longer trip the anonymous breaker or cool the key.
- Pin HTTP/1.1 ALPN and TLSNextProto on the WARP transport: a clone of
DefaultTransport made after its first dial negotiated h2 and fed SETTINGS
frames to the HTTP/1.x reader, breaking catalog refresh.
- Default to the IPv6 stack and, with warp.source_ipv6, let each exit bind its
own outer source from a routed prefix via IPV6_FREEBIND. Endpoints try IPv6
first and fall back to IPv4, so IPv4-only hosts keep working.
- WebUI, config example and all READMEs describe the new pool and rotation
behaviour.
Free-tier requests now optionally leave through a Cloudflare WARP tunnel that runs inside the gateway process: WireGuard over UDP plus a gVisor netstack, so no TUN device, root, NET_ADMIN, or route changes are needed. Adapted from github.com/sudogeeker/ai-route (MIT).
- warp.enabled/pool_size/stack in config, the WebUI, config.example.json and all READMEs; startup and hot reload fail closed when WARP cannot initialize.
- Anonymous lane, free-model Zen-key fallback, free-model probes and the anonymous catalog refresh send no proxy traffic while enabled; Go keys and paid models keep their proxies.
- Per-attempt leases feed 403/429 rotation and broken-tunnel failures back into the pool; /healthz and /api/monitor expose the pool state and readiness requires an active exit.
- errWARPUnavailable maps to a 503 warp_unavailable response.