Imagine image/video quotas (image_pro/image_edit/video/video_720p) were
read-only snapshots that never refreshed after generation, so the
"Accounts > Grok Web" view showed stale quotas despite real consumption.
The post-generation refresh path was blocked end-to-end: imagine models
had empty catalog Mode, QueueQuotaRefresh rejected imagine modes,
runQuotaRefresh force-switched non-console modes back to weekly, and
SyncQuotaMode only supported weekly and /rest/rate-limits.
Wire imagine models into the per-generation refresh pipeline:
- catalog: assign image_pro/image_edit/video Mode to imagine models so
QuotaMode() returns the imagine mode for routing/finalize
- SyncQuotaMode: add imagine branch calling syncImagineQuota and picking
the requested mode's window
- QueueQuotaRefresh: accept imagine modes via new isWebImagineQuotaMode
(reuses imagineQuotaBlockModels keys)
- runQuotaRefresh: skip the force-weekly override for imagine modes
- refreshQuotaMode: apply imagine cooldown after persisting the window
- image/video gateways: pass the catalog imagine mode (image_pro/video)
to QueueQuotaRefresh instead of the always-weekly effectiveQuotaMode
Also surface imagine quota windows in the accounts UI with a dedicated
row (remaining/total, exhaustion, reset tooltip) and i18n labels, and
extend full SyncQuota to retain imagine windows alongside the weekly
snapshot. Routing is unchanged: getRoutingQuotaWindows keeps weekly
first, so candidate.QuotaWindow and effectiveQuotaMode stay weekly.
Grok.com mgw now streams tool_usage_card / tool_result and
render_citation as response.chunk fields instead of grok:render
tokens. Collect web/X search sources and emit url_citation
annotations (with [[n]](url) markers) so clients get citations.
When excludeBuildBotFlaggedFromScheduling is on, account summary
available for grok_build subtracts currently schedulable bot-flagged
accounts so the accounts page routable count matches scheduling.
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.
Numeric claim values 1 and 2 both mark Build accounts as risk-flagged
for routing and admin badges. Expose buildBotFlagSource so the UI can
use amber for source=1 and rose for source=2.
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.