---
id: 10923
title: 'CoalescingEngineService.setMcpServer regression: rename in #10916 left dangling test consumers'
state: CLOSED
labels:
  - bug
  - ai
  - testing
  - regression
assignees:
  - neo-opus-ada
createdAt: '2026-05-07T18:32:24Z'
updatedAt: '2026-05-09T21:15:46Z'
githubUrl: 'https://github.com/neomjs/neo/issues/10923'
author: neo-opus-ada
commentsCount: 0
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-05-07T18:45:33Z'
---
# CoalescingEngineService.setMcpServer regression: rename in #10916 left dangling test consumers

## Context

Surfaced 2026-05-07 by Lane C followup PR [#10922](https://github.com/neomjs/neo/pull/10922) CI on the `unit` matrix row (post-#10903-cascade). Empirical evidence from [run 25514310691](https://github.com/neomjs/neo/actions/runs/25514310691/job/74881199792).

## The Problem

[#10916](https://github.com/neomjs/neo/pull/10916) refactored `CoalescingEngineService` from singleton `mcpServer` to `Set<McpServer>` for the per-session McpServer factory pattern. As part of that:

```diff
- setMcpServer(mcpServer)
+ addMcpServer(mcpServer) + removeMcpServer(mcpServer)
```

Two test files weren't updated:
- [`test/playwright/unit/ai/mcp/server/memory-core/services/CoalescingEngineService.spec.mjs:175,192`](https://github.com/neomjs/neo/blob/dev/test/playwright/unit/ai/mcp/server/memory-core/services/CoalescingEngineService.spec.mjs)
- [`test/playwright/unit/ai/mcp/server/memory-core/services/WakeSubscriptionService.spec.mjs`](https://github.com/neomjs/neo/blob/dev/test/playwright/unit/ai/mcp/server/memory-core/services/WakeSubscriptionService.spec.mjs) — 8+ call sites

All call `CoalescingEngineService.setMcpServer(...)` which now throws `TypeError: CoalescingEngineService.setMcpServer is not a function`.

## The Architectural Reality

- `setMcpServer(server)` was a singleton-set semantic (1:1)
- `addMcpServer(server)` is multi-set semantic (1:N)
- `setMcpServer(null)` was the "clear" semantic; new API has no direct equivalent — would require iterating through `mcpServers` and `removeMcpServer` each.

## The Fix (Two prescriptions, prefer A)

### Path A: Migrate test consumers (recommended)

Update the test fixtures to use new API:
- `setMcpServer(server)` → `addMcpServer(server)`
- `setMcpServer(null)` → loop-and-removeMcpServer pattern OR `clearMcpServers()` helper

Tests are mechanical updates; ~10 grep-level call-site changes.

### Path B: Backward-compat shim

Add `setMcpServer(server)` to `CoalescingEngineService.mjs` that internally:
- If `server`: clears existing then `addMcpServer(server)` (singleton-emulation)
- If `null`: clears the Set

Keeps test consumers unchanged. But aliases-without-deprecation introduce confusion and the singleton emulation contradicts the per-session multi-server design intent of #10916.

**Recommend Path A** unless there's a substantive operator reason to keep `setMcpServer` callable.

## Acceptance Criteria

- [ ] All 10+ `setMcpServer` callers in test corpus migrated to new API.
- [ ] `grep -rn "setMcpServer" --include="*.mjs"` returns zero matches outside this ticket's reference comments.
- [ ] CoalescingEngineService.spec.mjs and WakeSubscriptionService.spec.mjs pass under `NEO_TEST_SKIP_CI=true` in Lane C `unit` matrix row.

## Out of Scope

- Other unit-test substrate failures discovered in the same Lane C run (filed separately as Bucket G).
- Refactoring the per-session McpServer pattern itself.

## Related

- **Surfacing context:** [Lane C followup PR #10922 run 25514310691](https://github.com/neomjs/neo/actions/runs/25514310691) `unit` matrix row.
- **Originating refactor:** [#10916](https://github.com/neomjs/neo/pull/10916) (per-session McpServer factory + Set-based notification dispatch).
- **Sibling ticket:** Bucket G — additional substrate failures (filed concurrently).

Origin Session ID: `7e897a0b-33ce-4d6c-b1a9-a1ff93e4e571`

Retrieval Hint: `query_raw_memories(query="setMcpServer addMcpServer regression CoalescingEngineService #10916 test consumers")`

## Timeline

- 2026-05-07T18:32:25Z @neo-opus-ada added the `bug` label
- 2026-05-07T18:32:26Z @neo-opus-ada added the `ai` label
- 2026-05-07T18:32:26Z @neo-opus-ada added the `testing` label
- 2026-05-07T18:32:26Z @neo-opus-ada added the `regression` label
- 2026-05-07T18:32:53Z @neo-opus-ada cross-referenced by #10924
- 2026-05-07T18:33:36Z @neo-opus-ada cross-referenced by PR #10922
- 2026-05-07T18:38:09Z @neo-gemini-pro cross-referenced by PR #10925
- 2026-05-07T18:45:34Z @tobiu closed this issue
- 2026-05-07T18:45:34Z @tobiu referenced in commit `e912c57` - "fix(mcp): migrate CoalescingEngine tests to multi-server API (#10923) (#10925)

- Implemented clearMcpServers on CoalescingEngineService to complete the missing primitive in the multi-server transition.

- Mechanically migrated test call sites in CoalescingEngineService.spec.mjs and WakeSubscriptionService.spec.mjs away from the deprecated setMcpServer singleton mutator.

- Validated fixes locally via Playwright unit suite.

Co-authored-by: neo-gemini-pro <neo-gemini-pro@users.noreply.github.com>"
- 2026-05-09T21:15:46Z @neo-gemini-pro assigned to @neo-opus-ada

