Skip to content

jev: retry a 403 once before failing closed - #6

Merged
jerryfane merged 1 commit into
mainfrom
fix/jev-retry-403
Sep 26, 2026
Merged

jerryfane merged 1 commit into
mainfrom
fix/jev-retry-403

Conversation

@jerryfane

Copy link
Copy Markdown
Contributor

Same change as gitmoot/gitmoot#2267, which applies to this copy of the client too: a 403 gets exactly one retry after 2 s, and a second 403, 401 or 422 fails as before. Test TestClientRetriesOneForbiddenOnly. Found when OpenRouter/TypeSafe returned a transient RBAC: access denied on 2026-09-26; during it, test-check advice exited 3.

@jerryfane
jerryfane merged commit b1a900d into main Sep 26, 2026
2 checks passed
@jerryfane

Copy link
Copy Markdown
Contributor Author

Agent: g7-review
Runtime: omp
Job: local-review-review-router-18d8d0e5c04521b4-1

Decision: approved
Summary: Executed review at exact head 646e943 (diff 612ee14..646e943: internal/jev/client.go +19/-2, client_test.go +33). Change is correct: a 403 gets exactly one retry with a fixed 2s pause, gated by loop-local forbiddenRetried, and consumes the shared MaxRetries budget (DefaultMaxRetries=2 in production → fail closed after 2 attempts). Verified live: transient 403→200 succeeds on attempt 2; lasting 403 stops at 2 attempts even though a third budget slot exists; a second 403 after a 500 is still final; Retry-After on the 403 is overridden by the 2s wait per documented 'short pause' intent; MaxRetries=1 fits, MaxRetries=0 means no retry (consistent with an explicit no-retry opt-out, noted not defected). Non-APIError paths (encode, cancelled pace/sleep) still break immediately via errors.As guard; wait>maxBackoff cap and ctx cancellation during the forbidden sleep behave correctly. Prior verdicts cover PRs #1/#2/#4 only — none for PR #6.

Tests Run

  • CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./... — clean at head 646e943 (plain go build fails on sandboxed cgo headers /usr/include/stdc-predef.h: Permission denied; toolchain limitation, not the diff)
  • CGO_ENABLED=0 go test ./... — ok cmd/test-check 0.181s, internal/check 0.004s, internal/jev 0.007s, internal/prove 3.432s, internal/source 0.109s
  • CGO_ENABLED=0 go test -v -run 'TestClientRetriesOneForbiddenOnly|TestClientDoesNotRetryAuthFailureAndRedactsKey|TestClientRetriesServerErrorsThenSucceeds|TestClientCapsRetryAfterAtMaxBackoff' ./internal/jev/ — all 4 PASS
  • Throwaway probes in $TMPDIR/jevcheck copy: TestProbeForbiddenAfterServerError, TestProbeForbiddenIgnoresRetryAfter, TestProbeSecondForbiddenIsFinal, TestProbeForbiddenWithOneBudget, TestProbeForbiddenNoBudget — all 5 PASS (go test -count=1 -run TestProbe ./internal/jev/)
  • go test -race ./internal/jev/ — not runnable: race detector requires cgo, blocked by sandbox; acceptable since the change adds only loop-local state

Raw runtime output was retained in local Gitmoot state and is not posted here.

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