Repository navigation
fix(server): retry the model client on 429 and 5xx - #93
Conversation
The deployed server built its generative client from the limiter and the model registry, with no retry. The comment above it said it sat "outside the limiter and retries", but nothing retried. The Judge had retry.NewJudge; the answer model and BYOK clients had nothing. On vlb-engine, 28 of the pilot's 50 /v1/answer calls returned 500 on their first Vertex 429. Both now go through retry.New: 5 retries, exponential backoff from 1 s, capped at 20 s, Retry-After honoured. It sits outside the limiter, so every attempt takes a slot. 400s and the other non-transient classes are not retried.
Reviewer's GuideThe server now retries transient 429 and 5xx failures for both its configured model client and BYOK clients, using bounded exponential backoff with Retry-After support while placing retries outside the limiter; focused tests cover recovery, non-retryable 400s, and configuration. Sequence diagram for model request retries outside the limitersequenceDiagram
participant Request as /v1/answer
participant Retry as retry.New
participant Limiter as limit.Client
participant Model as Model provider
Request->>Retry: Call model client
Retry->>Limiter: Attempt 1
Limiter->>Model: Generate answer
Model-->>Limiter: 429 or 5xx
Limiter-->>Retry: Transient failure
Retry->>Retry: Retry-After or exponential backoff
Retry->>Limiter: Attempt 2
Limiter->>Model: Generate answer
Model-->>Limiter: Answer
Limiter-->>Retry: Success
Retry-->>Request: Answer
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 33 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The deployed server's answer-model client never retried. One Vertex 429 failed the whole
/v1/answerrequest.Measured
On vlb-engine I sent the pilot's 50 FinanceBench questions to
/v1/answer, four at a time:synthesis failed: gemini: 429: vertex: Resource exhausted, after 67 to 422 ms.Cause
cmd/server/main.gobuiltreqtiming.WrapClient(limit.Client(...)(registry.Client())). The comment above it says it sits "outside the limiter and retries", but nothing retried. The Judge hasretry.NewJudge; the generative client and the BYOK client frombyokFactoryhad no retry.Change
retry.New:Verification
go test ./...passes on vlb-engine.cmd/server/retry_test.go:Closes HAL-3206
Summary by Sourcery
Add bounded retries for transient generative-model failures across server and BYOK clients.
Bug Fixes:
Enhancements:
Tests: