8 Commits
Author SHA1 Message Date
Chenyme f97be4e553 fix: preserve output-loop code across audits and SSE 2026-08-31 20:49:01 +08:00
Chenyme c6acb00e0f Merge branch 'main' into pr/1027
# Conflicts:
#	backend/internal/application/gateway/service_test.go
#	backend/internal/transport/http/inference/handler.go
2026-08-31 18:53:19 +08:00
buddhism5080 5b3e7efa1f fix(inference): classify output-loop guard as upstream_output_loop
Doom-loop aborts were wrapped as a generic stream read failure, so audits
and SSE trailers reported upstream_stream_interrupted. Keep the sentinel
distinct so a model repeating the same delta is not mixed with a transport
cut.
2026-08-29 20:22:00 +08:00
buddhism5080 acc0fb5361 fix(audit): distinguish client vs upstream stream interrupts
After a 2xx SSE handoff, a client hangup is client_stream_interrupted and keeps the upstream status. upstream_stream_interrupted is only for an upstream cut. Pre-header 499 request_canceled is unchanged.
2026-08-29 05:57:47 +08:00
Chenyme d7fca59d68 fix: cool accounts after non-streaming idle responses 2026-08-25 18:10:57 +08:00
Chenyme e95a5bc523 feat: add multi-Provider streaming idle timeout protection 2026-08-07 11:29:21 +08:00
WuxiVIP ea18bb8622 feat: add configurable Grok Build stream idle timeout
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.
2026-08-06 21:31:46 +08:00
Chenyme cc578d551c fix: make response header timeout hot-reloadable and migration-safe 2026-07-23 02:36:45 +08:00