[PR #1005] [MERGED] fix(mcp): bound capture comparison input schema depth #2573

Closed
opened 2026-10-17 21:07:45 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1005
Author: @sx4im
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/mcp-wire-schema-model-limits


📝 Commits (7)

  • ac66a84 fix(mcp): advertise JSON values without recursive schemas
  • 12faa39 Merge remote-tracking branch 'origin/main' into fix/non-recursive-json-schemas
  • 0f87204 Merge remote-tracking branch 'origin/main' into fix/non-recursive-json-schemas
  • 4d5f09a fix(mcp): keep advertised input schemas within model function-calling limits
  • 7e81a29 fix(mcp): preserve catalog contracts while updating JSON schema projection
  • a8bd6f7 fix(mcp): describe complete capture inputs without deep result schemas
  • 82dd85e chore: synchronize catalog fix with merged main

📊 Changes

8 files changed (+364 additions, -11 deletions)

View changed files

📝 docs/mcp-contracts.md (+18 -0)
📝 docs/product-catalog.json (+2 -2)
📝 docs/verification/managed-conformance-manifest.json (+2 -2)
📝 skills/reverse-engineer-anything/SKILL.md (+1 -1)
➕ src/contracts/browserCaptureToolInputSchema.ts (+62 -0)
📝 src/contracts/browserToolContracts.ts (+4 -6)
📝 tests/boundary/mcp/browserMcp.test.ts (+35 -0)
➕ tests/boundary/mcp/wireInputSchemaLimits.test.ts (+240 -0)

📄 Description

Summary

Fixes #919.

compare_web_captures embedded full inspection and scenario result schemas, reaching 13 structural levels and blocking clients that reject an entire catalog when one input exceeds ten. Describe these inputs as complete producer-result objects to pass back unchanged, while retaining every nested runtime constraint. Together with merged #995, all 134 tools have cycle-free input/output schemas and inputs within the documented structural depth profile.

Problem and expected behavior

The deepest passive path includes WebSocket JSON shapes; recorded scenario history has another depth-13 path. Agents should be able to discover every tool and compare results already returned by REA. Both comparison groups now identify their exact producer; scenario authoring and normalization options remain fully described.

Change and scope

  • Add a contracts-layer projection for complete passive and scenario capture inputs, with cloned canonical validators.
  • Preserve the strict comparison root, paired-input refinement, defaults, full capture validation, and complete observation output schemas.
  • Check every live and generated input after SDK conversion against a stated ten-level profile, following local references per path. Property maps, definitions, and literal examples/defaults are not nesting levels.
  • Regenerate tracked product/skill metadata. The build-generated MCP catalog remains ignored.

Given earlier and later inspect_web_page responses:

await client.callTool({
  name: "compare_web_captures",
  arguments: {
    before: { inspection: earlier.structuredContent.result },
    after: { inspection: later.structuredContent.result },
  },
});

Scenario comparison similarly takes complete capture_browser_scenario results in before_scenario and after_scenario.

Contract and boundary impact

  • Semantic owner and earliest changed stage: contracts-layer input schema projection.
  • CLI and MCP/tool-catalog contract: same input groups and full runtime validation; clearer producer guidance and bounded advertised nesting.
  • Provider, bridge, target-format, or platform compatibility: no provider protocol changes; catalog compatibility is checked across the complete inventory.
  • Evidence, artifact, provenance, or reconstruction contract: capture contents, identity, completeness, and comparison results remain intact.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: canonical catalog digests and dependent generated documents refreshed through the repository generators.

Evidence and regression coverage

  • Full live/generated inventory, root and escaped references, shared acyclic definitions, dialect validity, examples, authority hints, strict inputs, and handler binding with original/reversed catalog ordering.

  • Incomplete payloads accepted by the advertised object envelope are rejected by the full server parser before the handler runs. A malformed deep WebSocket types entry is also rejected through MCP.

  • Actual stdio discovery reports 134 tools, zero reachable input/output cycles, and maximum structural input depth ten.

  • Real Chrome capture round trips passed for passive inspections and scenario history, with exact CLI/MCP comparison parity and preserved external-browser lifecycle.

  • Remaining proof gap: Muse Spark/opencode itself was unavailable. The documented profile counts schema structure; the model API's exact undocumented depth rule and any additional limits remain unverified.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run build:cached — passed with bounded local resource settings.
  • Nine focused Vitest files — 36 tests passed; three main documentation/catalog/release test files — 30 tests passed.
  • npm run check:fast -- --concurrency=1 --env-mode=loose — passed.
  • npm run docs:check -- --env-mode=loose — passed after synchronizing with merged main.
  • npm run verify:package — passed, including actual packed installation, CLI/MCP discovery, setup/update, skill, Evidence, and lifecycle checks.
  • Local real Chrome + stdio MCP round-trip harness — passed, including malformed deep input and CLI/MCP parity.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; pass complete existing results in the same fields.
  • Real Hopper/Ghidra coverage: not performed; no provider behavior changed. Real Chrome verification ran on Linux x64. Platform package CI is required before merge.
  • Package or release metadata impact: generated catalog identity changes; package version unchanged.
  • Security, privacy, process, or containment review: no new authority or data flow. Tests used isolated profiles/workspaces, two CPUs, and a 2 GiB family memory budget. Public examples omit host paths.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated.
  • User-visible CLI/MCP changes include a representative example.
  • Final diff checked for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1005 **Author:** [@sx4im](https://github.com/sx4im) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/mcp-wire-schema-model-limits` --- ### 📝 Commits (7) - [`ac66a84`](https://github.com/morluto/rea/commit/ac66a84c925179a78817fda91f64e42a37f9200e) fix(mcp): advertise JSON values without recursive schemas - [`12faa39`](https://github.com/morluto/rea/commit/12faa393d24d30fb0309242ee3e367959ec1f282) Merge remote-tracking branch 'origin/main' into fix/non-recursive-json-schemas - [`0f87204`](https://github.com/morluto/rea/commit/0f872045ba77891f5dc2cacbf47698dbcad74fc9) Merge remote-tracking branch 'origin/main' into fix/non-recursive-json-schemas - [`4d5f09a`](https://github.com/morluto/rea/commit/4d5f09a999d775361a6ffb70a0e11d959b35df0a) fix(mcp): keep advertised input schemas within model function-calling limits - [`7e81a29`](https://github.com/morluto/rea/commit/7e81a29ed7b9d1afd7c8c21b74492227e3f87545) fix(mcp): preserve catalog contracts while updating JSON schema projection - [`a8bd6f7`](https://github.com/morluto/rea/commit/a8bd6f79be292475a9bae9ba8aaa1322c0268b00) fix(mcp): describe complete capture inputs without deep result schemas - [`82dd85e`](https://github.com/morluto/rea/commit/82dd85e35af579c1f9739482752395b69397ee70) chore: synchronize catalog fix with merged main ### 📊 Changes **8 files changed** (+364 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/mcp-contracts.md` (+18 -0) 📝 `docs/product-catalog.json` (+2 -2) 📝 `docs/verification/managed-conformance-manifest.json` (+2 -2) 📝 `skills/reverse-engineer-anything/SKILL.md` (+1 -1) ➕ `src/contracts/browserCaptureToolInputSchema.ts` (+62 -0) 📝 `src/contracts/browserToolContracts.ts` (+4 -6) 📝 `tests/boundary/mcp/browserMcp.test.ts` (+35 -0) ➕ `tests/boundary/mcp/wireInputSchemaLimits.test.ts` (+240 -0) </details> ### 📄 Description ## Summary Fixes #919. `compare_web_captures` embedded full inspection and scenario result schemas, reaching 13 structural levels and blocking clients that reject an entire catalog when one input exceeds ten. Describe these inputs as complete producer-result objects to pass back unchanged, while retaining every nested runtime constraint. Together with merged #995, all 134 tools have cycle-free input/output schemas and inputs within the documented structural depth profile. ## Problem and expected behavior The deepest passive path includes WebSocket JSON shapes; recorded scenario history has another depth-13 path. Agents should be able to discover every tool and compare results already returned by REA. Both comparison groups now identify their exact producer; scenario authoring and normalization options remain fully described. ## Change and scope - Add a contracts-layer projection for complete passive and scenario capture inputs, with cloned canonical validators. - Preserve the strict comparison root, paired-input refinement, defaults, full capture validation, and complete observation output schemas. - Check every live and generated input after SDK conversion against a stated ten-level profile, following local references per path. Property maps, definitions, and literal examples/defaults are not nesting levels. - Regenerate tracked product/skill metadata. The build-generated MCP catalog remains ignored. Given earlier and later `inspect_web_page` responses: ```js await client.callTool({ name: "compare_web_captures", arguments: { before: { inspection: earlier.structuredContent.result }, after: { inspection: later.structuredContent.result }, }, }); ``` Scenario comparison similarly takes complete `capture_browser_scenario` results in `before_scenario` and `after_scenario`. ## Contract and boundary impact - Semantic owner and earliest changed stage: contracts-layer input schema projection. - CLI and MCP/tool-catalog contract: same input groups and full runtime validation; clearer producer guidance and bounded advertised nesting. - Provider, bridge, target-format, or platform compatibility: no provider protocol changes; catalog compatibility is checked across the complete inventory. - Evidence, artifact, provenance, or reconstruction contract: capture contents, identity, completeness, and comparison results remain intact. - Process execution, authorization, cleanup, or containment impact: none. - Generated metadata, package, or installation impact: canonical catalog digests and dependent generated documents refreshed through the repository generators. ## Evidence and regression coverage - Full live/generated inventory, root and escaped references, shared acyclic definitions, dialect validity, examples, authority hints, strict inputs, and handler binding with original/reversed catalog ordering. - Incomplete payloads accepted by the advertised object envelope are rejected by the full server parser before the handler runs. A malformed deep WebSocket `types` entry is also rejected through MCP. - Actual stdio discovery reports 134 tools, zero reachable input/output cycles, and maximum structural input depth ten. - Real Chrome capture round trips passed for passive inspections and scenario history, with exact CLI/MCP comparison parity and preserved external-browser lifecycle. - Remaining proof gap: Muse Spark/opencode itself was unavailable. The documented profile counts schema structure; the model API's exact undocumented depth rule and any additional limits remain unverified. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run build:cached` — passed with bounded local resource settings. - Nine focused Vitest files — 36 tests passed; three main documentation/catalog/release test files — 30 tests passed. - `npm run check:fast -- --concurrency=1 --env-mode=loose` — passed. - `npm run docs:check -- --env-mode=loose` — passed after synchronizing with merged main. - `npm run verify:package` — passed, including actual packed installation, CLI/MCP discovery, setup/update, skill, Evidence, and lifecycle checks. - Local real Chrome + stdio MCP round-trip harness — passed, including malformed deep input and CLI/MCP parity. ## Compatibility, safety, and release - Breaking changes or migration steps: none; pass complete existing results in the same fields. - Real Hopper/Ghidra coverage: not performed; no provider behavior changed. Real Chrome verification ran on Linux x64. Platform package CI is required before merge. - Package or release metadata impact: generated catalog identity changes; package version unchanged. - Security, privacy, process, or containment review: no new authority or data flow. Tests used isolated profiles/workspaces, two CPUs, and a 2 GiB family memory budget. Public examples omit host paths. ## Review checklist - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated. - [x] User-visible CLI/MCP changes include a representative example. - [x] Final diff checked for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:45 +00:00
Sign in to join this conversation.
No milestone
No project
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#2573
No description provided.