Skip to content

Fix MethodError when an armed retry is abandoned at the request deadline#1324

Merged
quinnj merged 1 commit into
masterfrom
fe/retry
Jul 2, 2026
Merged

Fix MethodError when an armed retry is abandoned at the request deadline#1324
quinnj merged 1 commit into
masterfrom
fe/retry

Conversation

@fredrikekre

Copy link
Copy Markdown
Member

This is purely Claude's output and since I don't know the internals of HTTP it might be
garbage. In any case, the issue was found from this real-world error:

MethodError: no method matching release(::RetryBucket, ::RetryToken, ::Nothing)

When a retry has been armed (its retry-bucket reservation acquired) but
_sleep_retry_delay! bails out because the backoff delay would exceed the
request deadline, the finally block refunded the reservation with
`release(bucket, token, nothing)`. `release` only accepts an `Int` failure
cost, so instead of gracefully giving up and returning the last response,
the request failed with

    MethodError: no method matching release(::RetryBucket, ::RetryToken, ::Nothing)

Pass the cost through `_retry_bucket_failure_cost(nothing)` (i.e. 0, a
full refund) as intended. This path triggers in the wild whenever a
deadline-bounded request (e.g. `request_timeout` set) is retried against
a slow or unavailable server and the backoff no longer fits within the
deadline.

Add a regression test covering the abandoned-retry path, including that
the reservation is refunded in full.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (04a21cf) to head (c1c4d68).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1324      +/-   ##
==========================================
+ Coverage   87.96%   87.99%   +0.02%     
==========================================
  Files          30       30              
  Lines       11807    11807              
==========================================
+ Hits        10386    10389       +3     
+ Misses       1421     1418       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@quinnj quinnj merged commit d4152fe into master Jul 2, 2026
8 checks passed
@quinnj quinnj deleted the fe/retry branch July 2, 2026 20:09
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.

2 participants