mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #7882] fix(mcp): bound input-validation allocation before amplified diagnostics #4651
Closed
opened 2026-10-31 00:51:57 +00:00 by bsakaguchi
·
2 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#4651
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gensokyo-dev on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7882
Before submitting
Area
MCP / shared input admission and validation resource bounds
Observed behavior
Source-derived finding, subsequently reproduced, on
37827af59: Zod is pinned to 4.6.6, butcompare_bundles.record_pairsstill has an unbounded object array. MCP registers the canonical parser without a pre-validation resource admission step. Invalid elements can therefore create a separate diagnostic each before REA's response budget is applied. Nested arrays and copied complete observations require the same investigation; merely limiting the eventual error text cannot bound its allocation.This issue records the validation-resource boundary. #5930 separately records the semantic batch-decompilation limit. #7661 records lost field diagnostics; a resource fix must preserve useful field/index diagnostics for ordinary invalid calls.
Reproduction
Executed on an unchanged
37827af59control with pinned Node/SDK/Zod and the actual public loopback HTTP entry point. An owned malformedcompare_bundlescall with 8,192 numericrecord_pairselements had a 16,542-byte argument JSON and returned a 556,706-byte diagnostic. Two calls completed; pings and valid controls before/after continued to work. No provider acquisition or external target was needed. A canonical-schema probe with 65,537 invalid elements produced 65,537 issues and about 43 MiB heapUsed delta before SDK formatting; it did not intentionally crash the process. A further bounded probe of 1,024 empty comparison Evidence objects generated 16,384 missing-field issues and about 26 MiB heapUsed delta, so the default was calibrated for structured-object expansion rather than scalar arrays alone.Fix PR: #7905. Runtime verification uses
5db72c85f; final fixture-only follow-upc762ffaeeleaves production behavior unchanged. The final default is 1,024 combined array elements and object members. With an explicitly selected 8,192-element allowance, the original small HTTP request returns an 824-byte refusal. Actual HTTP and stdio entry points pass. A calibrated patched-only request carrying 2,090,000 numeric elements (4,180,158 argument-JSON bytes, below the SDK body ceiling) returns an 824-byte refusal and keeps serving. Small calibration must prove the guard active before this larger fixture is constructed; no full-size crashing baseline was attempted.Structured calibration is not a claim that every advertised schema executes through SDK validation:
find_changed_behavioralready authenticates Evidence individually. The actualbuild_call_pathregistration does validate a complete Evidence array. Its final boundary test admits 1,019 empty Evidence objects plus five members, returns the existing ordinary validation error, and refuses 1,020 objects with an 824-byte resource error. The completed isolated workflow used 3.926 s elapsed / 4.863 s CPU / 601.8 MiB sampled family RSS, under a 2 GiB process-family guard. Ordinary admitted error diagnostics can still be large (1,456,474 bytes at this edge); this repair does not promise a fixed diagnostic count or exact heap ceiling.Real Linux TShark/capinfos 4.0.17 capture → Evidence export → explicit record-pair comparison passes under the default allowance, preserving identity and source bytes. Related source tests (123), public/native cases (5), existing capacity and Evidence workflows, static checks and documentation consistency passed. Larger downstream capacity fixtures select explicit finite transport allowances so their original assertions still execute. Model-token costs and native behavior on other platforms remain unmeasured. Detailed completed-task comparisons and measurement limits are in #7905.
Expected behavior
Reject input exceeding a justified validation resource allowance before element validation allocates amplified diagnostics. Share the MCP admission rule across HTTP and stdio while retaining shared CLI/application canonical parsers; retain normal canonical validation and precise correction facts, expose meaningful resource limits, and keep the advertised schema/client behavior consistent. Preserve full Evidence access and caller-selected values within admitted workflows.
Impact and scope
Observed CPU/memory and returned-diagnostic expansion while rejecting input. The HTTP body limit remains present and was not bypassed. Current-version full-OOM reproduction was not attempted. The repair reuses the pinned SDK's existing pre-validation combined-element counter, defaults to 1,024 and supports a finite operator-selected allowance via
REA_MCP_MAX_INPUT_ELEMENTS. No target execution, mutation or HTTP authentication change is proposed. This default is a breaking admission change for formerly accepted larger calls; canonical schemas and ordinary admitted-call semantics remain unchanged.REA version
Source
37827af5918a20b87698329a13d3705becdd6868, package 6.8.0, Zod 4.6.6, MCP SDK 2.3.1.Runtime and platform
Linux x64; pinned Node 24.22.1 / npm 11.16.0. Executed runtime measurements and limits are above and in #7905.
Target and artifact context
No external target. Synthetic malformed arguments and owned offline observations only.
Interface / earliest failure stage
MCP input validation before provider/application dispatch; shared CLI/application admission to be checked.
Relevant output or evidence
Typed outcome or recovery expected
Bounded, nonretryable input/resource refusal with the applicable allowance and actionable correction facts. Ordinary malformed input retains its canonical field diagnostics. No provider acquisition for refused calls; subsequent valid calls remain usable.
Analysis / additional context
Inspect the installed SDK and Zod producing boundaries before choosing a structural fix. Account for nested representations and validation-error expansion before allocation. Measure equivalent completed tasks, report elapsed/CPU/peak process-family memory, and leave token costs or real-provider coverage unmeasured where not established.
@gensokyo-dev commented on GitHub (Oct 28, 2026):
Detailed validation record for #7905. Production code is unchanged from
655d83965; this snapshot describes runtime-identical head5db72c85fand the final fixture-only follow-upbc27c15d0. It does not claim that the final-head CI has completed.Validation performed
Tested final head
5db72c85f, based on main37827af59. The final follow-up changes verification fixtures/documentation only; production behavior is unchanged from655d83965.npm run check:ci:fast: typecheck, lint, formatting and module boundaries passed — 32.554 s elapsed / 54.014 s CPU / 4649.6 MiB sampled family RSS.npm run docs:check: passed, including 9 consistency tests — 13.441 s / 16.098 s CPU / 671.9 MiB RSS.Only owned offline artifacts and synthetic arguments were used. Native coverage is Linux; other native platforms and particular agent hosts were not established locally.
Resource evidence and limits
Local runners use two CPUs and a 3 GiB Node heap allowance; the HTTP/stdio/TShark input-capacity proof servers explicitly use the same heap allowance. Other fixture/verifier children retain their existing native limits. Family RSS is sampled every 50 ms and can count shared pages twice. Public HTTP/stdio, isolated structured and native proof runs additionally used a 2 GiB / 120 s family guard. A mixed multi-file run triggered that guard and was stopped; the final runs were separated and passed. No intentionally crashing baseline probe was run.
build_call_pathHTTP registration: 1,019 empty Evidence objects + five members exactly fill the allowance and retain canonical validation; the completed isolated workflow used 3.926 s / 4.863 s CPU / 601.8 MiB RSS. Its ordinary error is still 1,456,474 bytes. At 1,020 objects, admission instead returns 824 bytes, followed by successful ping and settings calls. This covers the actual registration path, rather than inferring reachability from the advertised schema alone. Existingfind_changed_behavioralready authenticates Evidence individually; its direct-schema calibration does not establish bulk diagnostic expansion on that public path.62d3b90: 19.328 s / 23.293 s CPU / 1338.4 MiB. These are separate from the expanded final HTTP file above.Fresh processes were used; filesystem/code-cache warmth and other load are uncontrolled. Earlier fixed startup observations varied (including 35.246 s HTTP and 11.571 s native), and interleaved native repeats overlapped baseline times. No overall speedup claim. Model-token costs are unmeasured. Catalog size and client output-schema compilation are unchanged.
Final independent-stdio and package verification
The final follow-up selects the existing finite conformance environment in
tests/boundary/cli/workflowInputIdentities.test.ts, preserving every identity/integrity assertion across inline, retained and mixed operands. No production behavior changes.npm run test:focused -- tests/boundary/mcp/deferredRuntime.test.tsgenerated the required test-owned catalog and passed all 30 cases: 200.006 s elapsed / 227.517 s CPU / 2180.8 MiB sampled family RSS. Generated metadata is ignored and not committed.37827af59with the same toolchain: selectednode_modules/.bin/nodeversusprocess.execPathatnode_modules/node/bin/node, both identifying the pinned binary. No Pi source/assertion was changed. Putting that binary's real directory first after/usr/local/binon PATH, keeping Node 24.22.1 / npm 11.16.0, passed the whole 8-case file: 57.513 s / 69.346 s CPU / 652.7 MiB. Baseline reproduction: 7.334 s / 8.606 s CPU / 588.5 MiB.npm run verify:packagepassed on the final source tree: actual package archive and install, analysis/artifact/managed/platform/Evidence CLI, setup plan/approval/backup/idempotence/uninstall, symlink ownership, failure recovery, extracted plugin MCP, 231 tools and 6 prompts. Complete run: 301.002 s / 330.403 s CPU / 1335.7 MiB. Cleanup verified an empty descendant set. Startup observation: 939.97 ms process-start-to-tools/list; server sampled peak VmRSS 157,032,448 bytes. Cache warmth is uncontrolled; no speed comparison is claimed.npm run check:ci:fastpassed: 49.611 s / 78.446 s CPU / 4963.7 MiB. Finalnpm run docs:checkpassed with 9 consistency cases: 3.945 s / 4.587 s CPU / 544.6 MiB.Real macOS CI at
5db72c85fpassed 6 bundles across directory, ZIP and DMG through CLI/MCP, detached the DMG and preserved Mach-O bytes: https://github.com/morluto/rea/actions/runs/40774172718/job/123139847726 . All four native package platforms and four SQLite Node combinations passed at that runtime-identical head. Portable qualification found the independent identity fixture above; its correction is now on the final follow-up, whose CI is rerunning. Full licensed Hopper GUI execution remains outside the established coverage.Final fixture follow-up —
c762ffaeeProduction behavior remains unchanged from
655d83965(default 1,024). An additional 139-file MCP boundary cohort completed with 136 files passing and three wholly skipped across bounded runs. The first run reached its 1,200-second guard after 126 passing files, one trace-fixture failure and three skips; owned processes were stopped and no OOM occurred. Its sampled family RSS was 3,473.4 MiB; complete CPU accounting is unavailable after interruption. It is not a completed green run.The trace comparison fixture now explicitly selects the existing shared finite conformance allowance. Its original 200-event input, complete diagnostic assertion and production default are unchanged. Only that fixture and nine unfinished files were resumed: 10 files / 189 cases passed, 155.628 s elapsed / 180.077 s CPU / 2,802.9 MiB sampled process-family RSS, two CPUs. Commands used the existing exact-test/development-artifact plan with one worker.
Fresh
npm run check:ci:fastpassed (53.927 s / 84.873 s CPU / 5,365.5 MiB), andnpm run docs:checkpassed including 9 tests (4.047 s / 4.732 s CPU / 522.9 MiB). Logs:/tmp/rea-7882-remaining-mcp-boundaries.log,/tmp/rea-7882-remaining-mcp-resume.log,/tmp/rea-7882-trace-fixture-{static,docs}.log. Current-head CI/review is required after this test-only commit. No additional scope or release is requested.@gensokyo-dev commented on GitHub (Oct 29, 2026):
Final qualification for
c762ffaeef64f351c27d353e3d08a2438d104d6c: all eight test shards, source tests, static checks, documentation, package build, real Apple artifact CLI/MCP E2E, all four SQLite Node combinations, Windows capability/package and Linux x64/arm64 plus macOS arm64 package baselines passed. RequiredPortable testsandCI requiredare successful. Exact-head CI.Source CI: 1,159 files passed, 21,532 cases passed / 15 skipped. Codex completed with no findings; Greptile 5/5 on this exact commit; no unresolved review threads. The manual author declaration remains unchecked; it is not an implementation/test failure and no claim of human review is made.
Runtime default remains 1,024 combined elements/members, explicitly configurable; completed measurements and coverage limits remain as recorded above. No release or advisory publication is part of this change.