You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcpx(openapi): spec fetch truncates silently at 32MiB instead of refusing past the cap (#4375 contract decision 2) #8271
Found by the #4376 closing audit of the #4375 response-read contract (2026-11-10, lane code-b, task 13050). Two buffered reads of a fetched OpenAPI document in pkgs/mcpx/internal/openapi/openapi.go (lines 157 and 690) cap the read with io.ReadAll(io.LimitReader(resp.Body, 32<<20)) — bounded, but silently truncating: contract decision 2 (#4375) requires a buffered success body to be refused past its named cap, never silently truncated (the cap+1-and-refuse pattern the provider paths use with ProviderResponseBodyLimit). A truncated spec parses as a shorter document or fails downstream with a misleading error, instead of failing the fetch at the cap.
The source is an operator-configured URL, so this is a peer read under the contract, not a local file path (the os.ReadFile branch beside line 157 is out of scope — not peer bytes).
Fix shape
Apply the cap+1 refuse pattern at both sites with the cap named in internal/defaults (or recorded as a defaults constant), so an over-cap spec fails the fetch with a clear "exceeds N bytes" error. Behaviour change is deliberately not inside the #4376 audit (its acceptance allows only the single-site embeddings slip fix); this issue is the named follow-up the audit files.
Task 18622 (triage of issue #8271) — fixed and merged in the same claim (inline triage, section 1c):
Verified fresh: both silent-truncation sites were live on main (openapi.go Load fetch and API.Call, io.LimitReader at 32<<20 with no over-cap check).
PR fix(mcpx/openapi): refuse specs and call responses past the 32MiB cap (#8271) #10949 MERGED (45a2314): the cap is named as defaults.OpenAPISpecBodyLimit (recorded defaults constant per the issue's fix shape); both sites now read cap+1 and fail with a clear "exceeds the 33554432-byte limit" error, following the provider paths' pattern. The os.ReadFile local-path branch is untouched (not peer bytes).
Pre-existing, unrelated: internal/defaults' TestNoPackageRedeclaresADefault fails identically on clean main (flags internal/elicit/presence.go's DefaultAudienceWindow) — recorded on the PR, left for its own follow-up; the new constant lives in internal/defaults and is not flagged.
Review bots produced no findings (Codex usage limits, CodeRabbit rate limit; zero inline comments on the PR).
Freshly revalidated #8271 as CLOSED with status:done. The existing completion record confirms PR #10949 merged at 45a2314 and the issue was closed by that merge. Queue task 20132 completed as already_done; no implementation or duplicate follow-up was needed.
Activity
developing-today commentedon Nov 10, 2026
CODE-2462
Merge pull request #10949 from developing-today/queue/18622-8271-spec…
dezren39 commentedon Nov 17, 2026
agent-note:v1
state: done
task: 18622
lane: any-m
worker: repo-worker-code
Task 18622 (triage of issue #8271) — fixed and merged in the same claim (inline triage, section 1c):
Issue #8271 closed by the merge.
dezren39 commentedon Nov 17, 2026
agent-note:v1
state: done
task: 20132
lane: any-n
worker: repo-worker-code
Freshly revalidated #8271 as CLOSED with status:done. The existing completion record confirms PR #10949 merged at 45a2314 and the issue was closed by that merge. Queue task 20132 completed as already_done; no implementation or duplicate follow-up was needed.