Files
esengine 04007d942f fix(retry): say why a model request is retried, what it waits for, and expose idle_timeout_seconds
The retry status line showed "connection broke before the response headers"
for every retried failure, including 502/429 statuses, did not say what the
attempt was waiting for or when it counts as unanswered, and its seconds
counter ran from the first notice of the whole stall instead of per attempt.

The retrying event now carries a typed failure class (connection_closed,
timeout, upstream_status with the HTTP status, stream_idle, upstream_error),
the backoff before the next attempt, and the header wait of the coming
attempt. The producers set them: SendWithRetry knows the class, the adapters
pass their idle_timeout_seconds window, and the stream replay path maps the
stream-interrupt reason. The window words each class and phase (backoff
countdown, then a wait that restarts per attempt) from those fields, never
from text. The CLI machine record carries the same fields.

Provider settings gain one advanced row for idle_timeout_seconds (1..32767,
empty is the default), validated in the form and by the kernel's provider
edit endpoint.

Fixes #12046
2026-10-04 22:19:08 -07:00

32 lines
945 B
Go

package agent
import (
"context"
"os"
"testing"
"time"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
// Stream body retries use multi-second backoff in production; collapse it
// in package tests so recovery suites stay deterministic and fast.
streamRetrySleep = func(ctx context.Context, _ time.Duration) bool {
return ctx.Err() == nil
}
goleak.VerifyTestMain(m, liveRunLeakAllowances()...)
}
// A live measurement opens a real HTTP/2 connection whose read loop the
// provider owns and no test can reach to close. Only that goroutine is
// forgiven, and only under the env gate that asks for the traffic: forgiving
// everything parked on IO would make the live harness the one place its own
// leaks cannot be seen.
func liveRunLeakAllowances() []goleak.Option {
if os.Getenv("REASONIX_LIVE_REFUSAL") != "1" {
return nil
}
return []goleak.Option{goleak.IgnoreAnyFunction("net/http.(*http2ClientConn).readLoop")}
}