Repository navigation
fix(id): oversize requests refused permanently — RequestTooLarge, no retry (#3927) - #8250
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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 55 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Oversize requests refused permanently on check_bytes / check_frame (#3927)
Task 13029 (queue repo-health-code-pilot, lane code-y). One file:
pkgs/id/src/abuse.rs.The bug
TokenBucketrefill capstokens_milliatcapacity_milli, so a request whose cost exceeds the bucket's burst capacity can never be admitted — yetcheck_bytes/check_framerefused it as a temporaryBudgetExhausted/RateLimitedwith a boundedretry_after_ms, telling well-behaved peers to retry an impossible request forever (verified in the issue at t=0, t=1000, and t=1_000_000_000 ms; the zero-burst frame policy has the same trap: cost 1 > capacity 0).The fix
RefusalReason::RequestTooLarge— permanent refusal, documented as such;Refusal::newnow treats it likeBlockedByOperator(retry_after_ms: Nonewhatever delay was passed), and aRefusal::request_too_large()constructor mirrorsblocked_by_operator().TokenBucket::exceeds_capacity(cost)(cost * 1000 > capacity_milli);check_bytesandcheck_framerefuse oversize up front withRequestTooLarge. The combined paths (check_frame_and_bytes,check_frame_and_bytes_budgeted) apply the same rule to both legs before any temporary refusal, soretry_after_msis nowSomeonly for requests that can actually be admitted after the stated wait.Refusaldocs state the permanent-oversize semantics and the wiring mapping: surfaces mapRequestTooLargeto a permanent client error (e.g. HTTP 413), never 429/Retry-After— the distinction the id(comms): P0-A integration — frame-seam charging, HTTP 429+Retry-After, chat limiter consumer, counter visibility (phase of #2244) #3882 wiring consumes. (The id(comms): budgets — app-wide, per-IP, per-ID, and per-counterparty overrides (P1 of #2032) #2247 rolling-window budgets keep their own refusal contract; this change governs the token-bucket checks the issue names.)Tests (oracle-named, in
abuse.rs)oversize_byte_request_is_refused_permanently— 4 MiB+1 refusedRequestTooLarge/Noneat t=0 and t=1_000_000_000; exact-burst 4 MiB control still admitted.zero_burst_frame_policy_refuses_frames_permanently—frame_burst: 0refuses every frame permanently.within_capacity_over_a_drained_bucket_still_retries_temporarily— control: drained bucket still returnsBudgetExhaustedwith a bounded retry in [floor, cap].combined_check_refuses_oversize_permanently— the atomic path's byte leg.request_too_large_refusal_never_carries_a_retry— the permanent shape through the general constructor.Existing callers match on
RefusalReasonby equality (frames.rs, world_net.rs), so the new variant is additive for them.Refs #3927 · task 13029
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.