---
id: 10515
title: Stabilize A2A Wake Substrate Integrity
state: CLOSED
labels:
  - enhancement
  - ai
  - 'agent-task:pending'
assignees:
  - neo-gemini-pro
createdAt: '2026-04-30T00:24:00Z'
updatedAt: '2026-04-30T01:14:25Z'
githubUrl: 'https://github.com/neomjs/neo/issues/10515'
author: neo-gemini-pro
commentsCount: 0
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-04-30T01:14:25Z'
---
# Stabilize A2A Wake Substrate Integrity

**Context**
During the stabilization of the `DreamService` pipeline (PR #10495), we triaged a critical phenomenon where A2A "wake subscriptions" were disappearing. This ticket separates the foundational Wake Substrate integrity work from the immediate token-exhaustion fixes of #10495 to ensure architectural clarity and prevent test-result pollution.

**The Problem**
A2A wake subscriptions are being prematurely pruned or leaking state across test boundaries:
1. `WakeSubscriptionService.spec.mjs` was leaking state due to `liveCursor` persistence across Playwright test iterations, leading to cross-worker pollution.
2. `SQLite.clear()` and aggressive `GraphMaintenanceService` apoptosis were pruning production-adjacent `WAKE_SUBSCRIPTION` nodes during test runs, effectively killing live agent subscriptions.

**The Architectural Reality**
- **Test Isolation**: The Playwright test suites currently lack strict boundary enforcement for shared singleton states like `liveCursor` in `WakeSubscriptionService.mjs`.
- **Graph Durability**: `GraphService.getOrphanedNodes` and related garbage collection (Apoptosis) routines currently do not whitelist or protect critical node types like `WAKE_SUBSCRIPTION` from being swept during aggressive cleanup operations.
- **Storage Layer**: The `SQLite` service lacks robust temp-path verification, risking unintended side-effects on production databases during test execution.

**The Fix**
Isolate and harden the A2A Wake Substrate:
1. **GC/Apoptosis Protection**: Implement `WAKE_SUBSCRIPTION` whitelisting/protection rules within `GraphService` to prevent them from being orphaned and deleted by Apoptosis.
2. **Test Harness Isolation**: Establish canonical test-harness isolation for `GraphService` and `WakeSubscriptionService` (e.g., implementing strict `beforeEach`/`afterEach` resets for `liveCursor` and `subscriptionCache`).
3. **SQLite Durability**: Add robust `SQLite` temp-path verification and boundary guards to guarantee safe test execution without production graph bleed.
4. **Regression Coverage**: Add bridge-level diagnostic regression tests.

**Acceptance Criteria**
- [ ] `WAKE_SUBSCRIPTION` nodes are protected from `GraphService` apoptosis sweeps.
- [ ] `WakeSubscriptionService` test suites enforce strict state isolation (`liveCursor` resets) preventing cross-worker leakage.
- [ ] `SQLite` test operations are strictly bounded to verified temp-paths.
- [ ] New diagnostic regression tests exist for wake subscription persistence.
- [ ] Swarm A2A signals correctly persist and route across IDE and daemon harnesses without unexpected disappearances.

**Out of Scope**
- Non-wake-related Graph Apoptosis tuning.
- Expanding A2A syntax or routing logic beyond persistence fixes.
- Tri-Vector or DreamService optimizations (handled in PR #10495).

**Origin Session ID**: df8049d8-56ad-417b-ae0e-17a38e22a0ae
**Retrieval Hint**: "A2A wake subscription disappearance theory" and PR #10495 split.

## Timeline

- 2026-04-30T00:24:06Z @neo-gemini-pro added the `enhancement` label
- 2026-04-30T00:24:06Z @neo-gemini-pro added the `ai` label
- 2026-04-30T00:24:06Z @neo-gemini-pro added the `agent-task:pending` label
- 2026-04-30T00:31:49Z @neo-gemini-pro assigned to @neo-gemini-pro
- 2026-04-30T00:46:53Z @neo-gemini-pro cross-referenced by PR #10516
- 2026-04-30T00:56:58Z @neo-gpt cross-referenced by #10517
- 2026-04-30T01:03:51Z @neo-gemini-pro referenced in commit `7104abf` - "fix(memory-core): stabilize wake substrate and protect SQLite environments (#10515)

- Protect WAKE_SUBSCRIPTION nodes from GraphService GC apoptosis.
- Introduce critical SQLite.clear() safety gate restricting wipe actions to temporary or test paths.
- Synchronize config.template.mjs with recent config.mjs changes.
- Harden singleton configuration-first test patterns across memory-core services to prevent cross-worker pollution."
- 2026-04-30T01:06:05Z @neo-gemini-pro referenced in commit `a1ae517` - "fix(memory-core): stabilize wake substrate and protect SQLite environments (#10515)

- Protect WAKE_SUBSCRIPTION nodes from GraphService GC apoptosis.
- Introduce critical SQLite.clear() safety gate restricting wipe actions to temporary or test paths.
- Synchronize config.template.mjs with recent config.mjs changes.
- Harden singleton configuration-first test patterns across memory-core services to prevent cross-worker pollution."
- 2026-04-30T01:07:52Z @neo-gemini-pro referenced in commit `8766ba3` - "fix(memory-core): stabilize wake substrate and protect SQLite environments (#10515)

- Protect WAKE_SUBSCRIPTION nodes from GraphService GC apoptosis.
- Introduce critical SQLite.clear() safety gate restricting wipe actions to temporary or test paths.
- Synchronize config.template.mjs with recent config.mjs changes.
- Harden singleton configuration-first test patterns across memory-core services to prevent cross-worker pollution."
- 2026-04-30T01:14:25Z @tobiu referenced in commit `4743688` - "fix(memory-core): stabilize wake substrate and protect SQLite environments (#10515) (#10516)

- Protect WAKE_SUBSCRIPTION nodes from GraphService GC apoptosis.
- Introduce critical SQLite.clear() safety gate restricting wipe actions to temporary or test paths.
- Synchronize config.template.mjs with recent config.mjs changes.
- Harden singleton configuration-first test patterns across memory-core services to prevent cross-worker pollution.

Co-authored-by: tobiu <tobiasuhlig78@gmail.com>"
- 2026-04-30T01:14:25Z @tobiu closed this issue
- 2026-05-06T13:55:23Z @neo-gpt cross-referenced by PR #10818
- 2026-05-11T05:07:13Z @neo-opus-ada cross-referenced by #11182

