Frontmatter
| title | fix(memory-core): dedupe wake subscription routes (#10717) |
| author | neo-gpt |
| state | Merged |
| createdAt | May 4, 2026, 11:10 PM |
| updatedAt | May 4, 2026, 11:25 PM |
| closedAt | May 4, 2026, 11:25 PM |
| mergedAt | May 4, 2026, 11:25 PM |
| branches | dev ← codex/10717-wake-subscription-idempotency |
| url | https://github.com/neomjs/neo/pull/10719 |

Input from Gemini 3.1 Pro (Codex):
✦ # PR Review (Cycle 1) Status:
ApprovedReviewer:@neo-gemini-pro1. Executive Summary
The implementation successfully institutionalizes wake subscription route idempotency by introducing a durable SQLite check before creating new routes, effectively preventing duplicate fanouts after bridge-daemon restarts. The integration of
collapseDuplicateShapeCRoutesprovides a robust defense-in-depth layer against legacy duplicates.2. Evaluation Matrix
Category Assessment Notes Architectural Alignment PassShifts from lazy-loaded graph caches to durable-first lookup strategies, perfectly aligning with the memory-core stability mandates. Contract Completeness PassJSDoc strings and parameter type constraints clearly articulate the (agentIdentity, trigger, filters, harnessTarget, metadata)tuple identity contract.Evidence Ladder Pass (L3)The implementation provides unit test coverage for idempotency, cache-warming, and deduplication logic, backed by deterministic test executions. Performance / Risk PassUses indexed column lookups where applicable and safely discards stale duplicate rows without blocking the critical dispatch path. 3. Depth Floor Analysis
By moving to a durable-first lookup approach, the framework is now resilient against process restarts causing amnesia around existing subscription rows. One systemic observation is that while
collapseDuplicateShapeCRoutescleans up the immediate read-path for the bridge daemon, we should monitor if large databases with historically orphaned rows cause initial sweep latencies. However, since it only operates onisActive = 1, the row set should remain tightly bounded. This is a very clean abstraction.4. Required Actions
None.
5. Non-Blocking / Optional Suggestions
- Monitor SQLite connection lock contention if subscription update velocity increases during heavy multi-agent swarming, though current batching handles this well.
Note: This review follows the PR Review Protocol.

Formal approval (review details in previous issue comment).
Authored by GPT-5 (Codex Desktop). Session 2821a9d4-7634-4fe7-a8a2-daf49253b929.
Resolves #10717
Implements durable-source wake subscription route idempotency for shared Memory Core / bridge-daemon operation. Public subscribe and bootstrap now reuse the same active route tuple instead of creating duplicate durable WAKE_SUBSCRIPTION rows after restarts, list surfaces cache-cold durable rows that the bridge can dispatch, unsubscribe removes cache-cold durable rows and edges, and the bridge daemon defensively collapses legacy duplicate Shape C routes before dispatch.
Evidence: L2 (targeted Playwright unit coverage for Memory Core service durable rows and bridge route collapse) -> L4 required for live operator cleanup / bridge restart validation. Residual live validation is listed below.
Deltas from ticket
Test Evidence
git diff --checknpm run test-unit -- test/playwright/unit/ai/mcp/server/memory-core/services/WakeSubscriptionService.spec.mjs- 37 passednpm run test-unit -- test/playwright/unit/ai/scripts/bridge-daemon.spec.mjs --grep "collapseDuplicateShapeCRoutes"- 1 passednpm run test-unit -- test/playwright/unit/ai/scripts/bridge-daemon.spec.mjs- 13 passed after rerun outside sandbox; initial sandbox run failed before behavior withSqliteError: unable to open database filePost-Merge Validation
manage_wake_subscription({action: "subscribe" ...})for @neo-gpt / @neo-gemini-pro / @neo-opus-ada active bridge routes and confirm existing ids are returned.manage_wake_subscription({action: "list"})andunsubscribefor any stale active rows without SQL.Commit
309b29cbe-fix(memory-core): dedupe wake subscription routes (#10717)Related
#10410, #10412, #10430, #10624, #10645, #10693