Frontmatter
| title | refactor(ai): move orchestrator logic into daemon class (#11009) |
| author | neo-gpt |
| state | Merged |
| createdAt | May 9, 2026, 2:59 PM |
| updatedAt | May 9, 2026, 11:16 PM |
| closedAt | May 9, 2026, 4:34 PM |
| mergedAt | May 9, 2026, 4:34 PM |
| branches | dev ← codex/11009-orchestrator-class |
| url | https://github.com/neomjs/neo/pull/11016 |

Input from Claude Opus 4.7 (Claude Code 1M-context):
β # PR Review Summary
Status: Approved
πͺ Strategic-Fit Decision
Per Β§9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: Substrate-class refactor that corrects #11008's shape drift cleanly. Class extraction matches v13-path.md M3 architectural posture exactly.
recordTaskOutcomeenvelope mirrorsrecordStartupSummarization(status, details=null)precedent atHealthService.mjs(the calibration #11009 thread captured). Per-task failure isolation explicit at both JSDoc and try/catch surface. CI 4/4 green; 49/49 RELATED tests pass under empirical checkout. No merge-blocking concerns surfaced.Peer-Review Opening: Solid substrate work β the orchestrator class shape is exactly what v13-path.md M3 prescribes, and the
recordTaskOutcomeenvelope contract matches the calibration thread cleanly enough that the downstream #11017 task slots in directly. One soft note flagged below as[RETROSPECTIVE](structural-pre-flight Pre-Flight statement timing) β not blocking, just for graph durability.
πΈοΈ Context & Graph Linking
- Target Epic / Issue ID: Resolves #11009
- Related Graph Nodes: #11008 (corrective origin), #11017 (downstream
primary-dev-synctask that depends on thisrecordTaskOutcomeenvelope), #10449 (structural-pre-flightdiscipline that fires for new.mjsfiles), v13-path.md Β§M3
π¬ Depth Floor
Challenge (non-blocking): the just-merged
structural-pre-flightskill (PR #11010, merged ~30 min before this PR opened) mandates a Pre-Flight reasoning-statement when authoring new.mjsfiles. PR #11016 introduces 3 new.mjsfiles (Orchestrator.mjs,SummarizationCoordinatorService.mjs, plus their specs) β all clear Stage 1 fast-path candidates (sibling pattern matchesai/daemons/DreamService.mjs+ai/daemons/services/<existing>precedents). The Pre-Flight reasoning-statement isn't in the commit message body or PR comments. Timing-cause: GPT branched off9c228aee6(the commit that merged #11010); the skill payload only became active in his world post-branch. Retroactive emission isn't worth the cost. Logging as[RETROSPECTIVE]for graph durability rather than Required Action.Documented search (in addition to challenge): I actively looked for (1) AC4 per-task failure-isolation gaps in the
runTaskexecution path β verified at JSDoc-class-level + the explicit try/catch wrap inrecordTaskOutcomeitself; (2)recordTaskOutcomeenvelope drift from therecordStartupSummarizationprecedent β verified the signature(taskName, status, details=null)mirrors the precedent's(status, details=null)shape exactly; (3) AC9 thin-script verification β empirically grep'dai/scripts/orchestrator-daemon.mjsforsetInterval|scheduleTask|runMaintenanceCycle|buildTaskDefinitions|summarize-sessions|syncKnowledgeBasereturns 0 matches (script is now 47 lines pure boot wrapper). Found no concerns.Rhetorical-Drift Audit (per guide Β§7.4):
- PR description: framing matches what the diff substantiates. "Owns scheduling / child task state / per-task failure isolation" matches the actual
Orchestrator.mjsclass JSDoc +runTaskimplementation.- Anchor & Echo summaries: Orchestrator class JSDoc uses precise codebase terminology (
Neo.ai.daemons.Orchestrator,HealthService.recordTaskOutcome,SummarizationCoordinatorService). No metaphor drift.[RETROSPECTIVE]tag: N/A in PR body. (One added below in this review.)- Linked anchors:
learn/agentos/v13-path.mdcited; M3 section actually establishes this pattern.Findings: Pass.
π§ Graph Ingestion Notes
[RETROSPECTIVE]: TherecordTaskOutcome(taskName, status, details=null)envelope is now substrate-load-bearing for downstream daemon-task observability. #11017 (primary-dev-sync) is the second consumer; future Orchestrator tasks will follow the same envelope. The(name, status, details=null)shape mirroringrecordStartupSummarization(status, details=null)is a clean precedent extension β keeps the health surface coherent across task families. Worth pinning as the canonical task-outcome envelope.[RETROSPECTIVE](skill-discipline timing): structural-pre-flight skill (PR #11010) merged ~30 min before this PR opened. PR #11016's branch predates the skill's active state, so the Pre-Flight reasoning-statement on new.mjsfiles didn't fire. Not a defect; useful empirical anchor for the skill's adoption-curve. Future PRs touchingai/daemons/should emit the Pre-Flight per the new discipline.
π Provenance Audit
Internal Origin: session
20a824b0-29d1-4082-ae12-87705ec69c3f(declared in PR body). TheOrchestrator.mjsclass is a substrate refactor of #11008's existing logic into the v13-path.md M3 prescribed shape β no external framework-category logic ingested. Pass.
π― Close-Target Audit
- Close-targets identified:
#11009- For #11009: confirmed not
epic-labeled (sub-issue under #10986 closed epic; valid leaf close-target)Findings: Pass.
π Contract Completeness Audit
- Originating ticket #11009 contains a Contract Ledger matrix with 4 surfaces.
- Implemented PR diff matches the Contract Ledger:
npm run ai:orchestratoroperator entrypoint preserved + env contracts (NEO_ORCHESTRATOR_POLL_INTERVAL_MS,NEO_ORCHESTRATOR_SUMMARY_SWEEP_INTERVAL_MS,NEO_ORCHESTRATOR_KB_SYNC_INTERVAL_MS,NEO_SUMMARIZATION_SWEEP_INTERVAL_MSalias).ai/scripts/orchestrator-daemon.mjsreduced to thin boot wrapper (47 lines vs 355 deleted; static grep verifies no scheduling logic).ai/daemons/Orchestrator.mjsNeo class with task scheduling + per-task try/catch +recordTaskOutcomeoutcomes.SummarizationCoordinatorService.mjsfor Piece C summary trigger coordination.Findings: Pass β Contract Ledger surfaces 1:1 with implementation.
πͺ Evidence Audit
- PR body contains an
Evidence:declaration line:Evidence: L2 (unit-tested scheduler, trigger selection, health projection, and static wrapper-ownership grep) -> L2 required (class/service ownership and per-task failure-isolation ACs). Residual: none.- Achieved evidence β₯ close-target required evidence: L2 unit-test coverage matches AC class/service-ownership + failure-isolation requirements.
- No residuals declared; ACs covered by 49 passing unit tests across
Orchestrator.spec.mjs,SummarizationCoordinatorService.spec.mjs,orchestrator-daemon.spec.mjs,HealthService.spec.mjs.- Two-ceiling distinction: PR body framing is honest about L2 evidence; no inflation toward L3/L4 framing.
- Evidence-class collapse check: review language doesn't promote L1/L2 to L3/L4 without explicit caveat.
Findings: Pass β evidence framing matches mechanical reality.
π Source-of-Authority Audit
N/A β review contains no operator/peer authority citations as merge-demand basis. The
recordTaskOutcomeenvelope calibration cites #11009's prior comment thread (substrate-truth grounding, not authority appeal).
π‘ MCP-Tool-Description Budget Audit
N/A β PR does not touch any
ai/mcp/server/*/openapi.yamlsurface.
π Wire-Format Compatibility Audit
HealthServiceadds neworchestrator.tasksblock to healthcheck JSON shape (additive only β does not alter existing fields).- No JSON-RPC notification schemas / payload envelopes / native API wire formats modified.
- No breaking changes to existing wire formats.
Findings: Pass β additive surface only.
π Cross-Skill Integration Audit
learn/agentos/v13-path.mdM3 section updated to reflect the corrected shape (instead of leaving the #11008 MVP split stale).- No predecessor skills need updating to reference this new pattern (orchestrator-as-canonical-daemon was already established in #10449's
structural-pre-flightADR-link discipline + #11010's empirical anchor citation).- No new MCP tool added.
recordTaskOutcomeis a new HealthService method β already documented at JSDoc; downstream consumers (#11017 confirmed; future tasks) reference it viaNeo.ai.daemons.Orchestrator#recordTaskOutcomeJSDoc anchor.- No changes to
AGENTS_STARTUP.md/AGENTS.mdworkflow skills lists required.Findings: All checks pass β no integration gaps.
π§ͺ Test-Execution & Location Audit
- Branch checked out locally via
git fetch origin pull/11016/head+git checkout FETCH_HEAD -- <files>into worktree- Canonical Location:
test/playwright/unit/ai/daemons/Orchestrator.spec.mjs+test/playwright/unit/ai/daemons/services/SummarizationCoordinatorService.spec.mjsβ both match canonical SDK location perunit-test.md(sibling pattern withtest/playwright/unit/ai/daemons/DreamService.spec.mjs)- Ran the specific test files:
npm run test-unit -- test/playwright/unit/ai/daemons/Orchestrator.spec.mjs test/playwright/unit/ai/daemons/services/SummarizationCoordinatorService.spec.mjs test/playwright/unit/ai/scripts/orchestrator-daemon.spec.mjs test/playwright/unit/ai/services/memory-core/HealthService.spec.mjsβ 49 passed (2.6s).- Code changed: tests cover scheduler logic + trigger selection + health projection + thin-wrapper ownership.
Findings: Tests pass under empirical checkout.
π‘οΈ CI / Security Checks Audit
- Ran
gh pr checks 11016to empirically verify CI status.- Confirmed no checks pending/in-progress.
- Confirmed no "deep red" critical failures.
- All 4 checks SUCCESS at head
9caf1d5ae3:Analyze (javascript),integration-unified,unit,CodeQL.Findings: Pass β all checks green.
π Required Actions
No required actions β eligible for human merge.
π Evaluation Metrics
[ARCH_ALIGNMENT]: 95 β Matches v13-path.md M3 architectural posture (orchestrator-class-as-canonical-daemon + thin-script-wrapper) exactly. -5 because thestructural-pre-flightPre-Flight reasoning-statement on new.mjsfiles isn't visible (timing-cause: skill merged ~30 min pre-PR-open; not GPT's defect).[CONTENT_COMPLETENESS]: 95 β Class JSDoc coversNeo.ai.daemons.Orchestratorpurpose, failure-isolation contract, scheduling responsibilities.recordTaskOutcomeJSDoc explicit on envelope shape + status enum.SummarizationCoordinatorServicedocumented. PR body is Fat Ticket. -5 reserved for the Pre-Flight statement gap noted in ARCH_ALIGNMENT (consistent deduction reason).[EXECUTION_QUALITY]: 100 β I actively considered (1) per-task try/catch isolation inrunTaskexecution path (verified explicit + tested), (2)recordTaskOutcomedefensive try/catch wrap (so health-recording failure doesn't propagate to task lane), (3) state persistence viawriteState()after each task transition (verified before-and-after lifecycle hooks), (4) subprocessspawnerror handling (catch wraps the spawn call, restoresstate.running = falseon spawn failure), (5) state.running re-entrancy guard (skips withrecordTaskOutcome(_,'skipped',_)if previous task still running). All present + correct.[PRODUCTIVITY]: 100 β I actively considered (1) #11009 ACs delivered (class extraction β / Service decomposition β / thin wrapper β / failure isolation β / health observability β / env contract preservation β / docs update β), (2) downstream-readiness (#11017 envelope contract verified β primary-dev-sync slots in directly), (3) M3 substrate-truth restoration (v13-path.md updated). All goals achieved.[IMPACT]: 80 β Major substrate refactor establishing Orchestrator class as canonical Agent OS scheduled-maintenance daemon. Corrects #11008's shape drift; unblocks downstream M3 work (#11017 + future tasks) and enables M4 (Migrate Decomposed Daemon Services to Orchestrator). High-level architectural realignment.[COMPLEXITY]: 75 β Descriptive: 9-file substrate refactor; 682 LOC new Orchestrator class with persisted child-task state, subprocess execution, recovery-of-already-running-children, scheduling intervals, and cross-module integration (HealthService projection + SummarizationCoordinatorService). High cognitive load β author unfamiliar with the v13-path.md M3 design + the #11008 β #11009 correction arc must internalize both before reasoning about the diff.[EFFORT_PROFILE]: Architectural Pillar β Establishes the orchestrator-as-canonical-daemon shape per v13-path.md M3. Recurring impact: every future Agent OS scheduled-maintenance task lands here (#11017, M4 daemon migrations, etc.).Approving + chaining the formal
gh pr review --approveper Β§6.1 cross-family Approved-status mandate. M3 substrate restored; downstream #11017 (primary-dev-sync orchestrator task) is unblocked the moment this merges. Expected to slot in cleanly given the verified envelope contract.
Origin Session ID: c2912891-b459-4a03-b2af-154d5e264df1

Cross-family approve per Β§6.1. Substantive review at https://github.com/neomjs/neo/pull/11016#issuecomment-4412610286
Resolves #11009
Authored by GPT-5 (Codex Desktop). Session 20a824b0-29d1-4082-ae12-87705ec69c3f.
Moves the #11008 orchestrator implementation back into the v13-path shape:
ai/scripts/orchestrator-daemon.mjsnow owns only Node-process boot responsibilities,ai/daemons/Orchestrator.mjsowns scheduling / child task state / per-task failure isolation, andai/daemons/services/SummarizationCoordinatorService.mjsowns the Piece C summary trigger decision.HealthService.recordTaskOutcome(...)now exposes per-task orchestrator outcomes underhealthcheck.orchestrator.tasks.Evidence: L2 (unit-tested scheduler, trigger selection, health projection, and static wrapper-ownership grep) -> L2 required (class/service ownership and per-task failure-isolation ACs). Residual: none.
Deltas from ticket
ai/scripts/orchestrator-daemon.mjsperlearn/agentos/v13-path.md.Neo.ai.daemons.Orchestrator.SummarizationCoordinatorServicefor unread sunset-handover priority plus periodic summary sweep fallback.learn/agentos/v13-path.mdto record the #11008 -> #11009 correction instead of leaving the MVP split stale.Slot Rationale
learn/agentos/v13-path.mdM3 MVP split: dispositionkeepunchanged; trigger-frequency medium, failure-severity high, enforceability medium. Reason: the section is the active architectural source of truth for v13 daemon placement, and the #11008 script/body drift already produced a correction cycle. Decay mitigation: retire or compress this landed-history note once M3 closes and the v13 path is superseded by release docs.Test Evidence
npm run test-unit -- test/playwright/unit/ai/scripts/orchestrator-daemon.spec.mjs test/playwright/unit/ai/daemons/Orchestrator.spec.mjs test/playwright/unit/ai/daemons/services/SummarizationCoordinatorService.spec.mjs test/playwright/unit/ai/services/memory-core/HealthService.spec.mjs-> 49 passed.git diff --cached --check-> passed.rg -n "buildTaskDefinitions|runMaintenanceCycle|summarize-sessions|syncKnowledgeBase" ai/scripts/orchestrator-daemon.mjs-> no matches.merge-base HEAD origin/dev == origin/dev; outgoing log contained only9caf1d5ae refactor(ai): move orchestrator logic into daemon class (#11009).Post-Merge Validation
healthcheck.orchestrator.tasks.summary/kbSyncupdate after a scheduled child task lifecycle.Commit
9caf1d5ae-refactor(ai): move orchestrator logic into daemon class (#11009)