You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
guardian(opencode): retry transient inference_failed 400s and carry the gateway's response body #779
On large diffs the opencode-go gateway returns HTTP 400 with errorCode: inference_failed. The console request log shows this is a transient upstream failure, not a bad request:
a request that succeeded had attemptCount: 2: first attempt 400 in 171 ms, second attempt 200 in 55 s;
the failing chunked-run requests had attemptCount: 1 — the gateway did not retry them.
Our provider does not retry a 400: BaseProvider._retry only retries httpx.TimeoutException/NetworkError, and _post calls response.raise_for_status(), which also drops the response body. CI therefore shows only Client error '400 Bad Request' with no reason, and a transient gateway failure becomes a failed review (or, under chunking, a review degraded to "⚠ finder call failed").
What to change
On any non-429 HTTP error, raise with the status andresponse.text[:400], so the gateway's reason reaches the job log.
Treat a 400 whose body marks inference_failed as transient and retry it through the existing _retry loop (MAX_ATTEMPTS with backoff). Other 4xx must still fail on the first attempt — a validation error must not burn three paid calls.
Keep OpenCodeQuotaError for 429 as it is.
Done when
a 400 carrying inference_failed is retried and succeeds when the next attempt succeeds;
a 400 with any other body raises immediately with the body in the message;
exhausted retries raise the transient error (not a silent empty verdict);
tests cover retried-then-success, exhausted, and non-transient-4xx; the focused provider/runner tests and the repository gates are green;
The 8000-token completion budget (the successful large request spent all 8000 output tokens on reasoning — reasoningTokens: 8000), per-chunk context size (chunk prompts reached 161 KB vs 99 KB single-pass), and the ~60 s upstream window. Those are separate measurements; note them if the retry alone does not make large-PR reviews work.
Activity
fix(guardian): retry the gateway's transient inference_failed 400 (#779)
refactor(guardian): keep _post under the cognitive-complexity gate (#779
fix(guardian): read the transient gateway code from the JSON error (#779
fix(guardian): retry the gateway's transient inference_failed 400 (#779…