Skip to content

Bound upstream provider response memory#226

Open
AnthonyRonning wants to merge 2 commits into
masterfrom
codex-opensecret-provider-response-bounds-opensecret
Open

Bound upstream provider response memory#226
AnthonyRonning wants to merge 2 commits into
masterfrom
codex-opensecret-provider-response-bounds-opensecret

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace unbounded provider-body collection with a checked aggregate reader
  • apply response-class-specific ceilings: 16 MiB completion JSON, 4 MiB model metadata, 64 MiB embeddings, 32 MiB transcription JSON, 100 MiB TTS audio, and 64 KiB diagnostic error bodies
  • cap each unfinished SSE frame at 1 MiB while incrementally draining coalesced frames and retaining the existing 120-second per-chunk timeout
  • keep public request APIs, routing, SSE grammar, and tool-call handling unchanged
  • add deterministic boundary, overflow, delimiter-free accumulation, split-frame, and coalesced-frame tests

Validation

  • nix develop -c cargo fmt --all -- --check
  • git diff --check
  • nix develop -c cargo test web::openai::tests::provider_body_limit -- --nocapture (2 passed)
  • nix develop -c cargo test web::openai::tests::sse_ -- --nocapture (4 passed)
  • nix develop -c cargo clippy --all-targets --all-features -- -D warnings
  • nix develop -c cargo test --all-features (219 passed, 16 database-dependent tests ignored)

Open in Devin Review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 61bea7ac-e080-48b2-b7e7-b0d5e257a99a

📥 Commits

Reviewing files that changed from the base of the PR and between a3ecc93 and 0ad34e6.

📒 Files selected for processing (2)
  • src/web/health_routes.rs
  • src/web/openai.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex-opensecret-provider-response-bounds-opensecret

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Amended this response-bounds PR to cover the remaining extended-health model fetch:

  • streams successful model bodies through the shared 4 MiB aggregate limit
  • bounds non-success bodies to 64 KiB and returns only a sanitized 150-character excerpt
  • maps oversize/read/parse failures through the existing HTTP 503 health-check response
  • adds four focused multi-chunk tests for accepted models, oversized models, oversized errors, and excerpt truncation

Validation: cargo fmt --check; git diff --check; cargo clippy --locked --all-targets --all-features with warnings denied; cargo test --locked (223 passed, 16 database-dependent tests ignored).

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