Skip to content

fix(id): oversize requests refused permanently — RequestTooLarge, no retry (#3927) - #8250

Merged
dezren39 merged 1 commit into
mainfrom
queue/13029-3927-oversize-permanent
Nov 10, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/13029-3927-oversize-permanent

Conversation

@dezren39

@dezren39 dezren39 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

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

TokenBucket refill caps tokens_milli at capacity_milli, so a request whose cost exceeds the bucket's burst capacity can never be admitted — yet check_bytes / check_frame refused it as a temporary BudgetExhausted / RateLimited with a bounded retry_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

  • New RefusalReason::RequestTooLarge — permanent refusal, documented as such; Refusal::new now treats it like BlockedByOperator (retry_after_ms: None whatever delay was passed), and a Refusal::request_too_large() constructor mirrors blocked_by_operator().
  • TokenBucket::exceeds_capacity(cost) (cost * 1000 > capacity_milli); check_bytes and check_frame refuse oversize up front with RequestTooLarge. The combined paths (check_frame_and_bytes, check_frame_and_bytes_budgeted) apply the same rule to both legs before any temporary refusal, so retry_after_ms is now Some only for requests that can actually be admitted after the stated wait.
  • Module + Refusal docs state the permanent-oversize semantics and the wiring mapping: surfaces map RequestTooLarge to 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 refused RequestTooLarge/None at t=0 and t=1_000_000_000; exact-burst 4 MiB control still admitted.
  • zero_burst_frame_policy_refuses_frames_permanently — frame_burst: 0 refuses every frame permanently.
  • within_capacity_over_a_drained_bucket_still_retries_temporarily — control: drained bucket still returns BudgetExhausted with 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 RefusalReason by equality (frames.rs, world_net.rs), so the new variant is additive for them.

Refs #3927 · task 13029


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 10, 2026 20:44
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T20:44:58.258126Z
We couldn’t complete this review. Comment @codex review to try again.
13a49a4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7680e618-de7c-43e7-9329-5956d6bafbda
Commits

Reviewing files that changed from the base of the PR and between 16432a1 and 13a49a4.

Files selected for processing: 1

  • pkgs/id/src/abuse.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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