Free Web accounts 429 when duration exceeds 6s, which then rotates
accounts without changing the payload. Add a Grok Web setting
(freeVideoDurationCap, default 6) and clamp duration for free-tier
accounts at the Web adapter so retries are not wasted.
Video generation often runs long, and frequent 429s during create make a dedicated retry/switch budget more valuable than waiting on a single limited account. Add routing.videoMaxAttempts as a number-or-unlimited setting used only for video create-phase account failover, keep poll pinned after create succeeds, surface real upstream statuses such as 429 in video audits, and mark provider create/poll stages so retries stay safe.
Add an Account maintenance toggle that removes Build accounts with
bot_flag_source/bfs in {1,2} from ProviderBuild candidate selection only.
Linked Web/Console scheduling is unchanged; accounts stay in the pool.
Add a streamIdleTimeout setting (default 2m, range 30s–10m) to the Grok
Build runtime settings. When a streaming response goes silent for the
configured duration, the request context is cancelled and the read aborts
with a new upstream_stream_idle_timeout error code — instead of hanging
for ~10 minutes until the caller's context deadline fires.
The idle deadline is enforced via an idleTimeoutReadCloser body wrapper
injected at the egress transport layer, covering both the managed-client
and direct-fallback paths. Each successful Read resets the timer, so a
slow-but-steady stream is never interrupted. The wrapper uses
context.WithCancelCause so the Go transport unblocks the in-flight body
read on timeout.
Idle-timeout aborts do not degrade account health (the new error code is
excluded from isUpstreamStreamFailure) and are exempt from egress-node
cooldown, matching the existing treatment of response-header timeouts.
Mirrors the full responseHeaderTimeout pipeline: domain constants, config
struct/validation/default, settings service conversions, HTTP DTO, DB
backfill migration, egress manager atomic field + hot-reload + cache-key
fold, CLI adapter Config field, app assembly wiring, and frontend
types/model/UI/i18n.
Add a hot-reloadable routing switch so different accounts no longer share
the same upstream HTTP/TCP client pool, while the same account keeps
connection reuse. This helps upstream egress load balancers spread
traffic by connection across Build/Web/Console outbound calls.
Drain stale autoCleanWake so the first run waits one interval.
Recheck active media jobs after FOR UPDATE to close the TOCTOU window.
Add settings defaults/roundtrip tests, multi-batch cursor proof,
null-anchor/queued-media skip tests, and second-mark anchor stability.
Use reauth_marked_at as minAge clock, skip media-blocked accounts without
failing the batch, rename include-disabled setting, and cover aging/media/multi-batch.
Add a default-off runtime setting that periodically deletes accounts already
marked reauthRequired after a minimum age. Preserve cooldown-only accounts and
permanent-refresh drain semantics; wire settings end-to-end including admin UI.
Expose frontend.publicApiBaseURL and frontend.preferRequestBaseURL through
the admin settings API and UI so operators can control image/public URL
generation without editing YAML or restarting the process.
Resolution priority is now switch-aware:
1. request-derived base when preferRequestBaseURL is enabled
2. configured publicApiBaseURL when set
3. request-derived base as fallback
4. http://127.0.0.1:8000 as last resort
Also hot-update /api/admin/v1/system so docs examples reflect the live
configured base URL after settings changes.