Skip to content

Limit immediate unexpected-EOF retry to statusless errors#2

Merged
hex-ci merged 1 commit into
mainfrom
devin/1780644362-eof-statusless-gate
Jun 5, 2026
Merged

Limit immediate unexpected-EOF retry to statusless errors#2
hex-ci merged 1 commit into
mainfrom
devin/1780644362-eof-statusless-gate

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Addresses the Codex P2 review on router-for-me#3726 ("Preserve cooldown handling for status-bearing EOFs").

The unexpected EOF fast path in shouldRetryAfterError now only fires for statusless errors:

-if isUnexpectedEOFError(err) {
+if status == 0 && isUnexpectedEOFError(err) {
     if !m.retryAllowed(attempt, providers) { return 0, false }
     return 0, true // immediate retry, no cooldown wait
 }

Why: isUnexpectedEOFError matches the substring "unexpected eof", so a status-bearing error (e.g. a 5xx whose body text contains "unexpected EOF") could match. For such an error MarkResult has already applied a 60s model/auth cooldown. The unconditional fast path returned an immediate retry that selection then rejects with a model_cooldown error — and when that cooldown exceeds max-retry-interval (default 30s) the cooldown error is surfaced to the client without ever retrying upstream. Gating on status == 0 lets status-bearing errors fall through to the existing cooldown-aware path instead.

This does not change the real-world behavior the original fix targeted: genuine unexpected EOFs in this codebase are statusless — both io.ReadAll(decodedBody) (claude_executor.go:310-313) and scanner.Err() (claude_executor.go:512-519) return plain errors with no StatusCode().

Tests

  • New TestManager_ShouldRetryAfterError_StatusBearingEOFUsesCooldownPath — a 500 error whose message contains "unexpected EOF", with a single cooled-down credential (cooldown > maxWait), returns shouldRetry=false (no immediate fast path).
  • Existing statusless EOF tests still pass (immediate retry, retry-count/disabled limits honored).
  • gofmt, go vet ./sdk/cliproxy/auth/, go build ./..., go test ./... all pass.

Link to Devin session: https://app.devin.ai/sessions/eb1be9597f8d44c9af3d671e9fda7c03
Requested by: @hex-ci

Co-Authored-By: Hex <hex@codeigniter.org.cn>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@hex-ci hex-ci merged commit 5a0adba into main Jun 5, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant