Repository navigation
fix(v2): raise request body limit to 32 MiB - #282
Conversation
🦋 Changeset detectedLatest commit: 506a687 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe maximum Anthropic request body size increases from 10 MiB to 32 MiB. Tests cover rewriting a 12 MiB image request while preserving image data, and update checks for oversized declared and reconstructed requests. A patch changeset records the limit increase. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to Only near-limit requests risk a provider 413 after rewriting. The issue is bounded, but the outgoing size should be capped if full near-limit support is expected. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Larger image requests can now proceed through the existing bounded rewrite path. This increases per-request processing demand, but the reviewed code retains its size limit and credential-routing checks. No security bypass was established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Advanced
Run ID: 04d789cb-f084-4e60-a398-760940bb8b2c
📒 Files selected for processing (3)
.changeset/roomy-images-fit.mdsrc/index.tssrc/tests/index.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
|
been running this fix locally hope @eXamadeus can ship it as I was hitting the 10MB limit often without it and it was breaking my chats |
The 10 MiB cap rejected image-heavy sessions that Anthropic accepts, since the Messages API limit is 32 MB. opencode resends every image in the history on each turn, so a few screenshots were enough to hit it. Because the error is thrown from the http.request hook, opencode never sees a provider rejection and cannot compact its way out, which left those sessions permanently stuck. Fixes ex-machina-co#277
7ba6444 to
506a687
Compare
|
|
Looking forward to this. Thank you so much. |
Fixes #277.
MAX_REQUEST_BODY_BYTESwas 10 MiB, but the Anthropic Messages API accepts 32 MB. opencode resends every image in a session's history each turn, so a handful of screenshots pushes the body past 10 MiB. The plugin throws before the request leaves, and because the throw comes from thehttp.requesthook, opencode never sees a provider rejection. It can't compact its way out, so the session stays stuck.This raises the limit to 32 MiB. Past that, opencode already trims old images at 25 MiB, and it treats Anthropic's 413
request_too_largeas an overflow and compacts.The other fix suggested in #277 was to pass oversized bodies through unchanged. That wouldn't work, because every OAuth request needs the rewrite.
bun test(440 pass),bun run typesandbun run lintare clean locally.