Parent Epic
#12065 — Sub 3 of 9. Depends on Sub 1 (hypothesis V-B-A) + Sub 2 (state model + observability) — must NOT start before those land.
Premise
Currently the orchestrator's dream task at Orchestrator.mjs:681-703 does only a subset of what runSandman.mjs does (per Discussion #12062 §2.3 9-row pipeline-diff). The unified executeRemCycle() method consolidates the canonical pipeline + adds the missing gates + observability hooks Sub 2 provides.
Prescription
New method on Orchestrator.mjs:
async executeRemCycle({reason, mode, includeGoldenPath = false, includeDecay = true, dryRun = false}) {
await this.lifecycleService.ready();
await this.dreamService.ready();
const provider = await this.waitForProvider();
if (!provider) return this.createProviderFailureDiagnostic(...);
const runId = crypto.randomUUID();
return withHeavyMaintenanceLease(async () => {
const remRun = this.openRemRun({runId, reason, mode});
try {
await this.dreamService.processUndigestedSessions({remRun, chunkingEnabled: <per Sub 7>});
if (includeGoldenPath) await this.refreshGoldenPath({reason: 'pair-bound', remRun});
if (includeDecay) await GraphService.decayGlobalTopology(); // per OQ4 RESOLVED_TO_AC; honor §2.10 control-plane safety
this.closeRemRun(remRun, 'completed');
} catch (e) {
this.closeRemRun(remRun, 'failed', {error: e});
throw e;
}
}, {owner: 'orchestrator-dream', reason});
}Refactor Orchestrator#dream cadence task to call this.executeRemCycle({reason: 'periodic-dream:' + interval, includeGoldenPath: false}). (Sub 4 makes runSandman.mjs call it with includeGoldenPath: true.)
Acceptance Criteria
Avoided Traps
- ❌ Bundle goldenPath unconditionally — destroys cheap-refresh UX per §2.9; use
includeGoldenPath flag
- ❌ Skip control-plane allowlist — empirical anchor: today's bridge-cursor failure (Discussion §2.10)
- ❌ Reimplement provider-readiness inline — use Sub 6's substrate placement
- ❌ Land before Sub 1 + Sub 2 — risks replicating silent-failure at unified layer
Related
- Epic #12065
- Discussion #12062 §2.3, §2.9 (split-and-recompose), §2.10 (control-plane safety), §2.11 (state model)
- Sub 1 (hypothesis V-B-A — input), Sub 2 (state model + observability — input), Sub 4-7 (delegate to this)
Parent Epic
#12065 — Sub 3 of 9. Depends on Sub 1 (hypothesis V-B-A) + Sub 2 (state model + observability) — must NOT start before those land.
Premise
Currently the orchestrator's
dreamtask atOrchestrator.mjs:681-703does only a subset of whatrunSandman.mjsdoes (per Discussion #12062 §2.3 9-row pipeline-diff). The unifiedexecuteRemCycle()method consolidates the canonical pipeline + adds the missing gates + observability hooks Sub 2 provides.Prescription
New method on
Orchestrator.mjs:async executeRemCycle({reason, mode, includeGoldenPath = false, includeDecay = true, dryRun = false}) { // Gates (per Discussion §2.3 rows 2-5) await this.lifecycleService.ready(); await this.dreamService.ready(); const provider = await this.waitForProvider(); // adapted from runSandman if (!provider) return this.createProviderFailureDiagnostic(...); // per Sub 6 // Lease + state model start (per Sub 2) const runId = crypto.randomUUID(); return withHeavyMaintenanceLease(async () => { const remRun = this.openRemRun({runId, reason, mode}); try { await this.dreamService.processUndigestedSessions({remRun, chunkingEnabled: <per Sub 7>}); if (includeGoldenPath) await this.refreshGoldenPath({reason: 'pair-bound', remRun}); if (includeDecay) await GraphService.decayGlobalTopology(); // per OQ4 RESOLVED_TO_AC; honor §2.10 control-plane safety this.closeRemRun(remRun, 'completed'); } catch (e) { this.closeRemRun(remRun, 'failed', {error: e}); throw e; } }, {owner: 'orchestrator-dream', reason}); }Refactor
Orchestrator#dreamcadence task to callthis.executeRemCycle({reason: 'periodic-dream:' + interval, includeGoldenPath: false}). (Sub 4 makesrunSandman.mjscall it withincludeGoldenPath: true.)Acceptance Criteria
Orchestrator.executeRemCycle()method shipped per signature aboveisProcessingreset-on-startup if hypothesis #1 confirmed)Orchestrator#dreamcadence task refactored to delegate toexecuteRemCycle()(no logic duplication)Avoided Traps
includeGoldenPathflagRelated