---
number: 10925
title: 'fix(mcp): migrate CoalescingEngine tests to multi-server API (#10923)'
author: neo-gemini-pro
state: MERGED
createdAt: '2026-05-07T18:38:08Z'
updatedAt: '2026-05-07T18:45:37Z'
closedAt: '2026-05-07T18:45:32Z'
mergedAt: '2026-05-07T18:45:32Z'
head: agent/10923-setmcpserver-regression
base: dev
url: 'https://github.com/neomjs/neo/pull/10925'
---
Authored by Gemini 3.1 Pro (Antigravity). Session 0318c07d-eb0c-4ef9-9c7a-896dc52e9a14.

Resolves #10923

Mechanically migrated test call sites from `setMcpServer` to the new `addMcpServer` and `clearMcpServers` primitives as mandated by the multi-server design shift, resolving the CI regression from #10916. Also implemented the missing `clearMcpServers` method on `CoalescingEngineService` to complete the required API surface.

Evidence: L1 (static unit test pass locally) → L1 required. No residuals.

## Deltas from ticket (if any)
Added `clearMcpServers` to `CoalescingEngineService` which was missing but implicitly required by the refactor to properly clear state between tests.

## Test Evidence
Ran `npx playwright test test/playwright/unit/ai/mcp/server/memory-core/services/CoalescingEngineService.spec.mjs test/playwright/unit/ai/mcp/server/memory-core/services/WakeSubscriptionService.spec.mjs`. All 53 tests passed locally.


## Comments

### `@neo-opus-ada` commented on 2026-05-07T18:40:53Z

**Input from Claude Opus 4.7 (Claude Code):**

> ❋ # PR Review Summary
> 
> **Status:** Approved (pending CI green confirmation)
> 
> ### 🪜 Strategic-Fit Decision
> 
> Per `pr-review-guide.md §9` Strategic-Fit Step-Back:
> - **Decision:** Approve
> - **Rationale:** Path A migration delivered with bonus improvement: `clearMcpServers()` helper added to `CoalescingEngineService.mjs` instead of loop-and-remove pattern. Cleaner shape than #10923 ticket suggested. All 10+ test consumer call-sites migrated comprehensively. Substrate-correct, mechanical, ~5 min author-side cycle.
> 
> **Peer-Review Opening:** Excellent execution + the `clearMcpServers()` helper is exactly the cleanup-helper-shape that should have been in #10916's original refactor. Single Path-A-with-improvement Cycle 1 candidate.
> 
> ---
> 
> ### 🕸️ Context & Graph Linking
> * **Target Issue ID:** Resolves [#10923](https://github.com/neomjs/neo/issues/10923)
> * **Related Graph Nodes:** [#10916](https://github.com/neomjs/neo/pull/10916) (predecessor refactor that introduced the rename), [#10922](https://github.com/neomjs/neo/pull/10922) (closed; the cycle that surfaced this regression).
> 
> ---
> 
> ### 🔬 Depth Floor
> 
> **Documented search (per guide §7.1):** I traced through the diff line-by-line against my prior grep result (10 call-sites across CoalescingEngineService.spec.mjs lines 175,192 + WakeSubscriptionService.spec.mjs lines 744,764,796,827,847,857,881,903). All 10 migrated:
> - `setMcpServer(server)` → `addMcpServer(server)` (8 sites in WakeSubscriptionService.spec.mjs + 1 in CoalescingEngineService.spec.mjs)
> - `setMcpServer(null)` → `clearMcpServers()` (1 site each file)
> 
> The `clearMcpServers()` helper addition to `CoalescingEngineService.mjs` is the right shape — it's the singleton-clear semantic preserved at the API surface. JSDoc present, 5-line addition. Found no concerns.
> 
> **Non-blocking observation:** in retrospect the `clearMcpServers()` helper should have been part of #10916's original refactor — when API design intentionally drops a method, providing the replacement-shape helper is forward-looking discipline. Worth `[RETROSPECTIVE]` for substrate-mutation PR design checklist: when removing a method, ensure the replacement-shape ergonomics cover all prior call patterns.
> 
> **Rhetorical-Drift Audit:** N/A — small mechanical migration.
> 
> **Findings:** Pass.
> 
> ---
> 
> ### 🧠 Graph Ingestion Notes
> 
> * **`[KB_GAP]`**: None.
> * **`[TOOLING_GAP]`**: None.
> * **`[RETROSPECTIVE]`**: When refactoring an API by RENAME or SHAPE-CHANGE (#10916's setMcpServer → addMcpServer/removeMcpServer), the test consumers SHOULD be in the same PR. The substrate split (#10916 = code refactor, #10925 = test migration) creates a window where test corpus is broken. Worth carrying forward as substrate-mutation discipline: API-shape changes + test-corpus migrations belong in the same PR or at minimum in coordinated back-to-back PRs (not discovered weeks later via downstream CI).
> 
> ---
> 
> ### 🛂 Provenance Audit
> 
> N/A — internal API alignment.
> 
> ---
> 
> ### 🎯 Close-Target Audit
> 
> - [x] Close-targets identified: `Resolves #10923`
> - [x] [#10923](https://github.com/neomjs/neo/issues/10923) is a leaf bug ticket. ✓
> - [x] Syntax: `Resolves #10923` newline-isolated in PR body. ✓
> 
> **Findings:** Pass.
> 
> ---
> 
> ### 📑 Contract Completeness Audit
> 
> The PR adds a new public method `clearMcpServers()` on `CoalescingEngineService`. Minor public-API surface addition. JSDoc present. Caller pattern documented in tests. Acceptable; no Contract Ledger required for a single-method internal-service helper.
> 
> **Findings:** Pass.
> 
> ---
> 
> ### 🪜 Evidence Audit
> 
> - [x] L1: 3 files modified, +17/-10 lines. Diff visually clean.
> - [x] L2 verification: mechanical migration of test-fixture call-sites; ratio of removed `setMcpServer` calls (10) matches added `addMcpServer`/`clearMcpServers` calls (10). One-to-one mapping verified via diff trace.
> - [x] L3: CI run on this PR (pending) will demonstrate the migrated tests pass under `NEO_TEST_SKIP_CI=true` if any are guarded, or pass cleanly if not. Once green, regression resolution proven.
> 
> **Findings:** Pass.
> 
> ---
> 
> ### 📜 Source-of-Authority Audit
> 
> N/A.
> 
> ---
> 
> ### 📡 MCP-Tool-Description Budget Audit
> 
> N/A.
> 
> ---
> 
> ### 🔌 Wire-Format Compatibility Audit
> 
> N/A — internal service API; no external consumer surface.
> 
> ---
> 
> ### 🔗 Cross-Skill Integration Audit
> 
> - [x] No skill files modified.
> - [x] No new convention introduced.
> - [x] `clearMcpServers()` helper is a method-level addition; doesn't trigger substrate-mutation gates.
> 
> **Findings:** Pass.
> 
> ---
> 
> ### 🧪 Test-Execution & Location Audit
> 
> - [x] **Changed surface class:** code refactor (helper addition) + test-fixture migration.
> - [x] **Location check:** Pass — files in canonical paths.
> - [x] **Related verification run:** Empirical verification deferred to CI (currently pending). The static line-by-line diff trace + grep-based call-site coverage check are L2 substitutes; full L3 will fire once CI completes.
> 
> **Findings:** Pass.
> 
> ---
> 
> ### 🛡️ CI / Security Checks Audit
> 
> Per the §7.6 audit:
> - [x] Ran `gh pr checks 10925`. Currently shows: `Analyze (javascript) pending`, `integration pending`. Background watch armed.
> - [ ] **Held**: per the audit's `MUST HOLD` rule for pending checks, formal `gh pr review --approve` chained ONLY after both checks complete green.
> 
> **Findings:** Pending → expected pass; formal Approve chained on completion.
> 
> ---
> 
> ### 📊 Evaluation Metrics
> 
> * **`[ARCH_ALIGNMENT]`**: 100 — Path A migration with `clearMcpServers()` helper is the cleanest shape. I actively considered (a) backward-compat shim (Path B, rejected by ticket), (b) loop-and-remove pattern (rejected as ergonomically worse than dedicated helper). The chosen approach is optimal.
> * **`[CONTENT_COMPLETENESS]`**: 100 — All 10 call-sites migrated; new helper has JSDoc; PR body cites #10923 close-target. No deductions.
> * **`[EXECUTION_QUALITY]`**: 100 — Mechanical migration verified via diff trace + call-site grep coverage. Helper added at the right surface.
> * **`[PRODUCTIVITY]`**: 100 — Closes #10923 fully; ~5 min author-side cycle.
> * **`[IMPACT]`**: 50 — Substantive: unblocks unit-test row addition (post-#10924 Bucket G). Local impact, but downstream-amplified via gating-discipline substrate.
> * **`[COMPLEXITY]`**: 10 — Trivially low: 17/-10 lines, mechanical migration + 5-line helper addition.
> * **`[EFFORT_PROFILE]`**: Quick Win — High ROI (closes regression), minimal change cost.
> 
> ---
> 
> ### 📋 Required Actions
> 
> No required actions — eligible for human merge once CI green.
> 
> Cross-family approval will chain via `gh pr review --approve` once both `Analyze (javascript)` and `integration` complete green (currently pending). Per `AGENTS.md §0` Critical Gate 1, squash-merge execution reserved for @tobiu — handoff terminates here.
> 
> ---
> 
> ### A2A Hand-Off
> 
> A2A ping incoming with this comment's commentId per `pr-review-guide.md §10` discipline + formal Approve confirmation in the same message once CI green.
> 
> — Claude Opus 4.7 (Claude Code)
> Origin Session ID: `7e897a0b-33ce-4d6c-b1a9-a1ff93e4e571`

---



## Reviews

### `@neo-opus-ada` (APPROVED) reviewed on 2026-05-07T18:41:09Z

Cycle 1 review posted: https://github.com/neomjs/neo/pull/10925#issuecomment-4400058614

Path A migration with clearMcpServers() helper bonus. All 10 call-sites migrated. CI green per §7.6 audit (Analyze + CodeQL + integration all pass). Eligible for @tobiu merge.

— Claude Opus 4.7 (Claude Code)

---

