[PR #2193] [MERGED] feat(wasm): add opt-in first-call summary delivery #5075

Closed
opened 2026-10-31 01:02:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2193
Author: @N0zoM1z0
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @N0zoM1z0

Base: main ← Head: feat/wasm-summary-delivery-20261012


📝 Commits (5)

  • f9ed417 feat(wasm): add opt-in first-call summary delivery
  • 7dd1546 fix(experiments): validate advertised WASM delivery capability
  • 23b7628 docs(experiments): record repeated WASM summary delivery measurements
  • 8743b1a docs(experiments): record real Codex WASM delivery trials
  • 030899a docs(experiments): verify WASM follow-up after prerequisite merge

📊 Changes

12 files changed (+499 additions, -88 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/references/native-and-artifacts.md (+4 -0)
📝 docs/mcp-contracts.md (+7 -1)
📝 experiments/analysis-efficiency/README.md (+7 -2)
📝 experiments/analysis-efficiency/corpus.json (+34 -0)
📝 experiments/analysis-efficiency/measure.mjs (+104 -79)
➕ experiments/analysis-efficiency/questions/wasm-interface.txt (+1 -0)
➕ experiments/analysis-efficiency/wasm-first-call.md (+149 -0)
📝 src/contracts/wasm/wasmToolContracts.ts (+17 -4)
📝 src/domain/analysisView/analysisView.ts (+7 -0)
📝 src/server/createServer.ts (+1 -0)
📝 src/server/registerWasmTools.ts (+25 -1)
📝 tests/boundary/mcp/wasmArtifactMcp.test.ts (+143 -1)

📄 Description

Summary

Let a WASM interface/count question request inspect_wasm_artifact detail: summary on its first MCP call. Keep omitted/complete requests and CLI output complete, retain the original Evidence, and read selected exports through the existing parent-linked views. Refs #2016.

Prerequisite #2122 is merged at 58fb372071e56da9c5df0e37593ee3f0da6b64bc. This branch is rebased onto latest fetched main and targets main directly. This PR contains the bounded first-call delivery increment, not the whole analysis-efficiency roadmap.

Problem and expected behavior

The existing SQLite/CSS workflow first completes analysis, hits the MCP response ceiling, then reads retained summary and export views. A fitting Tree-sitter runtime reply can still deliver 6.43 MB when the question needs counts and four exports. Explicit summary delivery should return those metadata first without changing provider inputs or original source identity.

Nine real paired SDK comparisons preserve selected facts and complete source IDs. For the published VS Code Tree-sitter runtime, summary plus exact exports returns 18,891 bytes versus 6,433,872 bytes (about 99.7% less). These are result JSON bytes, not model tokens.

Ten actual Codex CLI trials preserve the 12 requested producer facts, real source references and profile cleanup. Three SQLite pairs report median total input 96,832 → 79,264 and answer time 61.521 → 55.656 seconds; median uncached input increases. The two VS Code single pairs reduce total input but take longer. These observations support optional smaller delivery, not uniform speedup or a statistically established causal effect.

Change and scope

  • Add optional MCP delivery selection and its exact existing WASM summary carrier; strip delivery before the service call.
  • Reuse shared retained-analysis summarization and original Evidence lookup. Existing registration arguments remain valid; the optional lookup is appended.
  • Add meaningful default/explicit-complete, oversized continuation, exact parent identity, invalid WAT and unavailable-retention coverage.
  • Add two digest-verified published component inputs, one fixed interface question, actual advertised-schema capability validation, and concise measurements. Detailed JSON/transcripts/binaries stay outside Git.

Contract and boundary impact

  • Semantic owner and earliest changed stage: existing domain summary schema and shared application projection; MCP adapter owns optional delivery after complete production.
  • CLI/MCP catalog: optional detail: complete|summary; omitted and explicit complete preserve original behavior. CLI stays complete. Complete catalog grows 3,369 JSON bytes (about 0.14%). Clients discover actual schemas, including SDK-generated references.
  • Provider/format/platform: existing caller-supplied WABT 1.0.42, exact local artifact/glue/candidate choices and static WASM scope. No provider input/default change.
  • Evidence/provenance: same complete source record/ID, derived summary parent link, exact export forms and coverage/limitations. Fixed servers lacking retention reject summary while complete remains usable.
  • Process/authorization/cleanup: existing admission and service/process owners; target execution/fetch authority stays unchanged. Existing cleanup behavior is preserved.
  • Generated/package/install: authored contract/docs/skill changes; ignored outputs regenerated by existing build/CI. No package/version/installer change relative to the base.

Representative request:

{"name":"inspect_wasm_artifact","arguments":{"path":"/artifacts/module.wasm","detail":"summary"}}

Use the returned normalized_result.parent_evidence_id for inspect_analysis_view with view: {"kind":"wasm","facet":"exports","offset":0,"limit":4}. The complete source remains retained.

Evidence and regression coverage

  • Executed: three alternating paired public-SDK trials per shipped module; three SQLite model pairs and one pair for each VS Code component, requested gpt-5.6-terra high through Codex CLI 0.161.0. Requested alias does not prove resolved server-side model identity.

  • Tests: exact SDK-converted 2020-12 schemas; old/default/complete requests; delivery stripped before production; same source identity; summary/export continuation without provider rerun; invalid WAT digest; fixed-server missing retention.

  • Proof gaps: small stochastic model sample, uncontrolled remote/cache latency and Linux-only WABT scope. This does not prove whole application/runtime behavior or other provider/OS domains.

  • Resource qualification: cohorts used last-sampled counters. Regrading all ten existing answers after #2122's counter-closeout correction preserves facts/IDs/cleanup but marks final resource conditions unverified. Active controls were one CPU, 4 GiB hard/3 GiB early-stop, no swap; observed model peaks 656–944 MiB. No absent-late-event or fully resource-qualified performance claim is made. Review-only corrections do not rerun unrelated model/provider/build tests.

  • Observed, derived and inferred claims remain distinguishable.

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

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

Validation performed

  • Prototype full static/docs gates and 54 focused assertions passed.
  • Rebased build:cached, check:fast, docs:check, 29 focused assertions across WASM MCP/service/schema files, and verify:wasm:package passed (42 actual WABT CLI/MCP cases after private-prefix installation).
  • Final pinned runtime: build:cached, check:fast, seven WASM MCP workflows passed again after carrying the substantive source-identity fixes.
  • measure.mjs / compare.mjs: 9/9 paired fact/settings/source-ID comparisons pass; actual agent-trial.py / factual review: 10/10 selected answers pass, with final resource conditions separately unverified.
  • Related resource parser/short-command and existing-answer regrading probes pass. Latest changes are documentation/research-driver-only; production/bridge/bootstrap/package/skill sources are byte-unchanged from the measured candidate.
  • After the prerequisite merge and latest-main rebase: seven relevant WASM MCP workflows and one fresh real-WABT SQLite SDK workflow pass; selected facts and original source ID match the pinned candidate. Intervening main logging/CLI/CI changes remain preserved. No unrelated provider/model/package cohort is repeated.
  • Formatting, diff and required pre-push type/lint checks passed. The latest-main gate was a cache miss; it is the mandatory gate, not a repeated full local matrix.

Complete pinned methods, failures, usage, timing and scope.

Compatibility, safety, and release

  • Migration: explicit opt-in; old requests keep complete output and source identity. This covers recorded workflows, not every historical client.
  • Real providers: actual Linux WABT on SQLite and two published VS Code WASM components. Other domains retain #2122's separately qualified verification scope; they are not rerun for this WASM-only change.
  • Package/release: version and dependencies unchanged; no publication or deployment.
  • Containment/privacy: existing provider authority; original caller values preserved, no ambient environment dump. Binaries, raw results, auth/profile state and generated JSON are excluded from Git.

Review checklist

  • Concrete agreed enhancement with one focused outcome and Conventional Commit title.
  • Related issue and prerequisite PR linked.
  • Changed behavior and meaningful failures covered.
  • Owning contracts, docs and authored skill updated.
  • Representative MCP flow included.
  • 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/2193 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `feat/wasm-summary-delivery-20261012` --- ### 📝 Commits (5) - [`f9ed417`](https://github.com/morluto/rea/commit/f9ed417a6f3fd0c54cb0319601a6d29859124802) feat(wasm): add opt-in first-call summary delivery - [`7dd1546`](https://github.com/morluto/rea/commit/7dd1546b7f9c489a2f3150a6a723b600e46260f1) fix(experiments): validate advertised WASM delivery capability - [`23b7628`](https://github.com/morluto/rea/commit/23b7628d6308567a1ae44f02f3ef730caf857cd0) docs(experiments): record repeated WASM summary delivery measurements - [`8743b1a`](https://github.com/morluto/rea/commit/8743b1a852e60bcac2a5d56454df12c9feb53508) docs(experiments): record real Codex WASM delivery trials - [`030899a`](https://github.com/morluto/rea/commit/030899a82b2a9fc7ccc5d049d351034c23bda677) docs(experiments): verify WASM follow-up after prerequisite merge ### 📊 Changes **12 files changed** (+499 additions, -88 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/references/native-and-artifacts.md` (+4 -0) 📝 `docs/mcp-contracts.md` (+7 -1) 📝 `experiments/analysis-efficiency/README.md` (+7 -2) 📝 `experiments/analysis-efficiency/corpus.json` (+34 -0) 📝 `experiments/analysis-efficiency/measure.mjs` (+104 -79) ➕ `experiments/analysis-efficiency/questions/wasm-interface.txt` (+1 -0) ➕ `experiments/analysis-efficiency/wasm-first-call.md` (+149 -0) 📝 `src/contracts/wasm/wasmToolContracts.ts` (+17 -4) 📝 `src/domain/analysisView/analysisView.ts` (+7 -0) 📝 `src/server/createServer.ts` (+1 -0) 📝 `src/server/registerWasmTools.ts` (+25 -1) 📝 `tests/boundary/mcp/wasmArtifactMcp.test.ts` (+143 -1) </details> ### 📄 Description ## Summary Let a WASM interface/count question request `inspect_wasm_artifact detail: summary` on its first MCP call. Keep omitted/complete requests and CLI output complete, retain the original Evidence, and read selected exports through the existing parent-linked views. Refs #2016. Prerequisite **#2122 is merged** at `58fb372071e56da9c5df0e37593ee3f0da6b64bc`. This branch is rebased onto latest fetched main and targets main directly. This PR contains the bounded first-call delivery increment, not the whole analysis-efficiency roadmap. ## Problem and expected behavior The existing SQLite/CSS workflow first completes analysis, hits the MCP response ceiling, then reads retained summary and export views. A fitting Tree-sitter runtime reply can still deliver 6.43 MB when the question needs counts and four exports. Explicit summary delivery should return those metadata first without changing provider inputs or original source identity. Nine real paired SDK comparisons preserve selected facts and complete source IDs. For the published VS Code Tree-sitter runtime, summary plus exact exports returns 18,891 bytes versus 6,433,872 bytes (about 99.7% less). These are result JSON bytes, not model tokens. Ten actual Codex CLI trials preserve the 12 requested producer facts, real source references and profile cleanup. Three SQLite pairs report median total input 96,832 → 79,264 and answer time 61.521 → 55.656 seconds; median uncached input increases. The two VS Code single pairs reduce total input but take longer. These observations support optional smaller delivery, not uniform speedup or a statistically established causal effect. ## Change and scope - Add optional MCP delivery selection and its exact existing WASM summary carrier; strip delivery before the service call. - Reuse shared retained-analysis summarization and original Evidence lookup. Existing registration arguments remain valid; the optional lookup is appended. - Add meaningful default/explicit-complete, oversized continuation, exact parent identity, invalid WAT and unavailable-retention coverage. - Add two digest-verified published component inputs, one fixed interface question, actual advertised-schema capability validation, and concise measurements. Detailed JSON/transcripts/binaries stay outside Git. ## Contract and boundary impact - **Semantic owner and earliest changed stage:** existing domain summary schema and shared application projection; MCP adapter owns optional delivery after complete production. - **CLI/MCP catalog:** optional `detail: complete|summary`; omitted and explicit complete preserve original behavior. CLI stays complete. Complete catalog grows 3,369 JSON bytes (about 0.14%). Clients discover actual schemas, including SDK-generated references. - **Provider/format/platform:** existing caller-supplied WABT 1.0.42, exact local artifact/glue/candidate choices and static WASM scope. No provider input/default change. - **Evidence/provenance:** same complete source record/ID, derived summary parent link, exact export forms and coverage/limitations. Fixed servers lacking retention reject summary while complete remains usable. - **Process/authorization/cleanup:** existing admission and service/process owners; target execution/fetch authority stays unchanged. Existing cleanup behavior is preserved. - **Generated/package/install:** authored contract/docs/skill changes; ignored outputs regenerated by existing build/CI. No package/version/installer change relative to the base. Representative request: ```json {"name":"inspect_wasm_artifact","arguments":{"path":"/artifacts/module.wasm","detail":"summary"}} ``` Use the returned `normalized_result.parent_evidence_id` for `inspect_analysis_view` with `view: {"kind":"wasm","facet":"exports","offset":0,"limit":4}`. The complete source remains retained. ## Evidence and regression coverage - **Executed:** three alternating paired public-SDK trials per shipped module; three SQLite model pairs and one pair for each VS Code component, requested `gpt-5.6-terra` high through Codex CLI 0.161.0. Requested alias does not prove resolved server-side model identity. - **Tests:** exact SDK-converted 2020-12 schemas; old/default/complete requests; delivery stripped before production; same source identity; summary/export continuation without provider rerun; invalid WAT digest; fixed-server missing retention. - **Proof gaps:** small stochastic model sample, uncontrolled remote/cache latency and Linux-only WABT scope. This does not prove whole application/runtime behavior or other provider/OS domains. - **Resource qualification:** cohorts used last-sampled counters. Regrading all ten existing answers after #2122's counter-closeout correction preserves facts/IDs/cleanup but marks final resource conditions unverified. Active controls were one CPU, 4 GiB hard/3 GiB early-stop, no swap; observed model peaks 656–944 MiB. No absent-late-event or fully resource-qualified performance claim is made. Review-only corrections do not rerun unrelated model/provider/build tests. - [x] Observed, derived and inferred claims remain distinguishable. - [x] Artifact identity, source provenance and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable and uncertain outcomes remain visible. ## Validation performed - Prototype full static/docs gates and 54 focused assertions passed. - Rebased `build:cached`, `check:fast`, `docs:check`, 29 focused assertions across WASM MCP/service/schema files, and `verify:wasm:package` passed (42 actual WABT CLI/MCP cases after private-prefix installation). - Final pinned runtime: `build:cached`, `check:fast`, seven WASM MCP workflows passed again after carrying the substantive source-identity fixes. - `measure.mjs` / `compare.mjs`: 9/9 paired fact/settings/source-ID comparisons pass; actual `agent-trial.py` / factual review: 10/10 selected answers pass, with final resource conditions separately unverified. - Related resource parser/short-command and existing-answer regrading probes pass. Latest changes are documentation/research-driver-only; production/bridge/bootstrap/package/skill sources are byte-unchanged from the measured candidate. - After the prerequisite merge and latest-main rebase: seven relevant WASM MCP workflows and one fresh real-WABT SQLite SDK workflow pass; selected facts and original source ID match the pinned candidate. Intervening main logging/CLI/CI changes remain preserved. No unrelated provider/model/package cohort is repeated. - Formatting, diff and required pre-push type/lint checks passed. The latest-main gate was a cache miss; it is the mandatory gate, not a repeated full local matrix. [Complete pinned methods, failures, usage, timing and scope](https://github.com/morluto/rea/blob/030899a82b2a9fc7ccc5d049d351034c23bda677/experiments/analysis-efficiency/wasm-first-call.md). ## Compatibility, safety, and release - **Migration:** explicit opt-in; old requests keep complete output and source identity. This covers recorded workflows, not every historical client. - **Real providers:** actual Linux WABT on SQLite and two published VS Code WASM components. Other domains retain #2122's separately qualified verification scope; they are not rerun for this WASM-only change. - **Package/release:** version and dependencies unchanged; no publication or deployment. - **Containment/privacy:** existing provider authority; original caller values preserved, no ambient environment dump. Binaries, raw results, auth/profile state and generated JSON are excluded from Git. ## Review checklist - [x] Concrete agreed enhancement with one focused outcome and Conventional Commit title. - [x] Related issue and prerequisite PR linked. - [x] Changed behavior and meaningful failures covered. - [x] Owning contracts, docs and authored skill updated. - [x] Representative MCP flow included. - [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-31 01:02:53 +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#5075
No description provided.