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:
WakeSubscriptionService.spec.mjs was leaking state due to liveCursor persistence across Playwright test iterations, leading to cross-worker pollution.
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:
- GC/Apoptosis Protection: Implement
WAKE_SUBSCRIPTION whitelisting/protection rules within GraphService to prevent them from being orphaned and deleted by Apoptosis.
- Test Harness Isolation: Establish canonical test-harness isolation for
GraphService and WakeSubscriptionService (e.g., implementing strict beforeEach/afterEach resets for liveCursor and subscriptionCache).
- SQLite Durability: Add robust
SQLite temp-path verification and boundary guards to guarantee safe test execution without production graph bleed.
- Regression Coverage: Add bridge-level diagnostic regression tests.
Acceptance Criteria
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.
Context During the stabilization of the
DreamServicepipeline (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:
WakeSubscriptionService.spec.mjswas leaking state due toliveCursorpersistence across Playwright test iterations, leading to cross-worker pollution.SQLite.clear()and aggressiveGraphMaintenanceServiceapoptosis were pruning production-adjacentWAKE_SUBSCRIPTIONnodes during test runs, effectively killing live agent subscriptions.The Architectural Reality
liveCursorinWakeSubscriptionService.mjs.GraphService.getOrphanedNodesand related garbage collection (Apoptosis) routines currently do not whitelist or protect critical node types likeWAKE_SUBSCRIPTIONfrom being swept during aggressive cleanup operations.SQLiteservice lacks robust temp-path verification, risking unintended side-effects on production databases during test execution.The Fix Isolate and harden the A2A Wake Substrate:
WAKE_SUBSCRIPTIONwhitelisting/protection rules withinGraphServiceto prevent them from being orphaned and deleted by Apoptosis.GraphServiceandWakeSubscriptionService(e.g., implementing strictbeforeEach/afterEachresets forliveCursorandsubscriptionCache).SQLitetemp-path verification and boundary guards to guarantee safe test execution without production graph bleed.Acceptance Criteria
WAKE_SUBSCRIPTIONnodes are protected fromGraphServiceapoptosis sweeps.WakeSubscriptionServicetest suites enforce strict state isolation (liveCursorresets) preventing cross-worker leakage.SQLitetest operations are strictly bounded to verified temp-paths.Out of Scope
Origin Session ID: df8049d8-56ad-417b-ae0e-17a38e22a0ae Retrieval Hint: "A2A wake subscription disappearance theory" and PR #10495 split.