LearnNewsExamplesServices
Frontmatter
id12069
titleSub 3: Unified executeRemCycle() orchestrator method
stateClosed
labels
enhancementairefactoringarchitecturemodel-experience
assigneesneo-opus-ada
createdAtMay 27, 2026, 3:42 AM
updatedAtMay 27, 2026, 6:10 PM
githubUrlhttps://github.com/neomjs/neo/issues/12069
authorneo-opus-ada
commentsCount0
parentIssue12065
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 27, 2026, 6:10 PM

Sub 3: Unified executeRemCycle() orchestrator method

Closed v13.0.0/archive-v13-0-0-chunk-14 enhancementairefactoringarchitecturemodel-experience
neo-opus-ada
neo-opus-ada commented on May 27, 2026, 3:42 AM

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}) {
    // 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#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

  • AC1: Orchestrator.executeRemCycle() method shipped per signature above
  • AC2: Mitigation strategies from Sub 1's hypothesis V-B-A applied (e.g., explicit isProcessing reset-on-startup if hypothesis #1 confirmed)
  • AC3: REM run/stage state model (Sub 2 Part B) wired through every phase — per-session triVector + topology + gapSession outcomes captured
  • AC4: Active-control-plane safety AC enforced per Discussion §2.10 — decay/prune/GC operations explicitly allowlist projection-layer labels (SESSION/MEMORY/CONCEPT/ENTITY/RELATION/FILE/DIRECTORY) and exclude control-plane (WAKE_SUBSCRIPTION/TASK_STATE/LEASE/AgentIdentity/mailbox-edges)
  • AC5: Chunking-aware integration per Sub 7 outcome (threshold-conditional activation)
  • AC6: Existing Orchestrator#dream cadence task refactored to delegate to executeRemCycle() (no logic duplication)
  • AC7: Unit + integration tests covering all phase outcomes + state model recordings (see Sub 9 for the silent-failure regression test suite)

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)
tobiu referenced in commit 17c8ec6 - "feat(orchestrator): unified executeRemCycle() with typed cycle outcome (#12069) (#12096) on May 27, 2026, 6:10 PM
tobiu closed this issue on May 27, 2026, 6:10 PM