feat: add per-virtual-model retry rules by status
DR
5d ago+1122+1122+0123456789012345678901234567890123456789-55-55-01234567890123456789
Closes #1605.
Virtual models and model policies can now override upstream retry behavior for specific HTTP statuses. A rule can increase or reduce retries, set a fixed delay, or set max_retries: 0 so the failure moves to failover. Statuses without a rule keep the gateway retry policy, and every retry uses the existing per-attempt timeout.
Includes config and admin API support, persistence, resolver plumbing, documentation, and regression tests.
Targeted tests: GOMAXPROCS=1 go test -p 1 ./internal/virtualmodels ./internal/llmclient ./internal/httpclient ./internal/gateway ./config ./internal/core ./internal/app ./internal/admin -count=1 (all passing).
Summary by CodeRabbit
- New Features
- Configure upstream retry rules by HTTP status for virtual models, including redirects and concrete models.
- Set retry limits and optional delays for statuses 400–599. A limit of zero disables retries for that status; statuses without a rule follow the gateway’s retry policy.
- View and manage retry rules through virtual-model administration. Each retry uses the configured per-attempt timeout, while failover follows its own policy.
- Documentation
- Added guidance on retry-rule configuration, defaults, limits, and validation.