[PR #5415] [MERGED] perf(mcp): record catalog identities for all schema profiles #6920

Closed
opened 2026-11-01 21:44:04 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5415
Author: @gensokyo-dev
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @gensokyo-dev

Base: main ← Head: perf/723-mcp-discovery-20261020


📝 Commits (1)

  • e495148 perf(mcp): record catalog identities for all schema profiles

📊 Changes

10 files changed (+1395 additions, -55 deletions)

View changed files

➕ experiments/analysis-efficiency/mcp-profile-costs.py (+74 -0)
➕ experiments/analysis-efficiency/mcp-profile-digest.mjs (+25 -0)
➕ experiments/analysis-efficiency/mcp-profile-identity.json (+808 -0)
➕ experiments/analysis-efficiency/mcp-profile-identity.md (+131 -0)
➕ experiments/analysis-efficiency/mcp-profile-identity.py (+199 -0)
📝 scripts/record-catalog-digests.mjs (+16 -3)
📝 src/catalogIdentity.ts (+81 -27)
📝 src/recordedCatalogDigests.ts (+5 -3)
📝 tests/boundary/mcp/mcpDoctor.test.ts (+36 -0)
📝 tests/boundary/mcp/serverIdentity.test.ts (+20 -22)

📄 Description

Summary

Compact input and output-off MCP profiles recomputed full schema-sensitive catalog identities at runtime, while the default profile already used build-time hashes. Record the four built-in combinations through the same build owner, sharing canonical schema conversion. Refs #723.

Exact profile digests, tool definitions, defaults, canonical server validation and complete results are preserved. Custom compact budgets and source execution keep their existing lazy calculation. Generated records are deeply immutable and contain only hashes (1,320 bytes total).

Contract and boundary impact

Ordinary performance fix within existing startup/identity authority; no new provider or target interaction. CLI doctor and MCP use the same identity owner. No catalog filtering, new schemas, live-state cache or Evidence semantic changes. Output-off identities still cover canonical output contracts. Generated runtime files remain ignored and are produced before bundling from compiled contracts.

Evidence and validation

Reproducible experiment and pinned receipt: 16 actual Codex app-server 0.163.0 discovery/status tasks, four profiles × before/after × two repetitions, complete with verified process-family cleanup and no observed OOM events. All 209 definitions and all four hash triples match the pre-change oracle.

  • Non-default profile total CPU: 9.76–19.23 s before → 7.40–8.48 s after. Whole-task wall: 10.33–23.47 s → 7.98–8.89 s. Cold/warm calls and kernel family memory are recorded separately.
  • Default profile has no established gain; one candidate repetition is slower. No token reduction is claimed. No model turns were started, so actual model usage/quality is unmeasured.
  • Isolated build digest compute CPU: 1.636 → 2.373 s for one → four identities. Source-mode speedup and other clients/platforms remain unverified.

Latest-main validation (base e84468c0b):

  • npm run build:cached — passed.
  • npm run test:focused -- ... — four affected files / 46 tests passed; production stdio doctor checks all four profiles.
  • npm run check — typecheck, lint, format, knip, metadata and architecture checks passed.
  • npm run docs:check — passed, including five README consistency tests.
  • Actual Codex compact/off discovery and first/warm calls passed again after rebase, with verified process-family cleanup.

The experiment preserves earlier failed controller/cleanup attempts and their limitations. Benchmarks remain pinned to d532b1812; rebasing does not relabel those timings.

Additional actual model-request capture is documented in the experiment comment: in the selected custom-provider path, 209 projected REA schemas repeat per request (51,354 full-input / 35,337 compact-input cl100k JSON proxy tokens); output schema advertisements are not injected. This is separate local scripted-backend evidence, with actual model usage/quality still unmeasured.

Author readiness

Human owner: @gensokyo-dev

The owner explicitly dictated these readiness declarations and authorized publication and merge in the working session; they are not inferred from CI or automated review.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff 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/5415 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `perf/723-mcp-discovery-20261020` --- ### 📝 Commits (1) - [`e495148`](https://github.com/morluto/rea/commit/e495148f6760f88354e9e055c246c30da1ad181b) perf(mcp): record catalog identities for all schema profiles ### 📊 Changes **10 files changed** (+1395 additions, -55 deletions) <details> <summary>View changed files</summary> ➕ `experiments/analysis-efficiency/mcp-profile-costs.py` (+74 -0) ➕ `experiments/analysis-efficiency/mcp-profile-digest.mjs` (+25 -0) ➕ `experiments/analysis-efficiency/mcp-profile-identity.json` (+808 -0) ➕ `experiments/analysis-efficiency/mcp-profile-identity.md` (+131 -0) ➕ `experiments/analysis-efficiency/mcp-profile-identity.py` (+199 -0) 📝 `scripts/record-catalog-digests.mjs` (+16 -3) 📝 `src/catalogIdentity.ts` (+81 -27) 📝 `src/recordedCatalogDigests.ts` (+5 -3) 📝 `tests/boundary/mcp/mcpDoctor.test.ts` (+36 -0) 📝 `tests/boundary/mcp/serverIdentity.test.ts` (+20 -22) </details> ### 📄 Description ## Summary Compact input and output-off MCP profiles recomputed full schema-sensitive catalog identities at runtime, while the default profile already used build-time hashes. Record the four built-in combinations through the same build owner, sharing canonical schema conversion. Refs #723. Exact profile digests, tool definitions, defaults, canonical server validation and complete results are preserved. Custom compact budgets and source execution keep their existing lazy calculation. Generated records are deeply immutable and contain only hashes (1,320 bytes total). ## Contract and boundary impact Ordinary performance fix within existing startup/identity authority; no new provider or target interaction. CLI doctor and MCP use the same identity owner. No catalog filtering, new schemas, live-state cache or Evidence semantic changes. Output-off identities still cover canonical output contracts. Generated runtime files remain ignored and are produced before bundling from compiled contracts. ## Evidence and validation [Reproducible experiment and pinned receipt](https://github.com/morluto/rea/blob/e495148f6760f88354e9e055c246c30da1ad181b/experiments/analysis-efficiency/mcp-profile-identity.md): 16 actual Codex app-server 0.163.0 discovery/status tasks, four profiles × before/after × two repetitions, complete with verified process-family cleanup and no observed OOM events. All 209 definitions and all four hash triples match the pre-change oracle. - Non-default profile total CPU: 9.76–19.23 s before → 7.40–8.48 s after. Whole-task wall: 10.33–23.47 s → 7.98–8.89 s. Cold/warm calls and kernel family memory are recorded separately. - Default profile has no established gain; one candidate repetition is slower. No token reduction is claimed. No model turns were started, so actual model usage/quality is unmeasured. - Isolated build digest compute CPU: 1.636 → 2.373 s for one → four identities. Source-mode speedup and other clients/platforms remain unverified. Latest-main validation (base `e84468c0b`): - `npm run build:cached` — passed. - `npm run test:focused -- ...` — four affected files / 46 tests passed; production stdio doctor checks all four profiles. - `npm run check` — typecheck, lint, format, knip, metadata and architecture checks passed. - `npm run docs:check` — passed, including five README consistency tests. - Actual Codex compact/off discovery and first/warm calls passed again after rebase, with verified process-family cleanup. The experiment preserves earlier failed controller/cleanup attempts and their limitations. Benchmarks remain pinned to `d532b1812`; rebasing does not relabel those timings. Additional actual model-request capture is documented in the experiment comment: in the selected custom-provider path, 209 projected REA schemas repeat per request (51,354 full-input / 35,337 compact-input cl100k JSON proxy tokens); output schema advertisements are not injected. This is separate local scripted-backend evidence, with actual model usage/quality still unmeasured. ## Author readiness Human owner: @gensokyo-dev The owner explicitly dictated these readiness declarations and authorized publication and merge in the working session; they are not inferred from CI or automated review. - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff 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-11-01 21:44:04 +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#6920
No description provided.