refactor(backend): complete orchestrator consolidation (7→4 target) #4048
Copy link
Copy link
Closed
Description
Status
Continuation of #3393. Orchestrator consolidation is ~40% complete.
Current State
- Still 7 orchestrator files (target: 4)
- Backward-compat shims added in first pass
- Full consolidation deferred
Remaining Files
autobot-backend/agents/agent_orchestrator.py
autobot-backend/api/orchestration.py
autobot-backend/enhanced_multi_agent_orchestrator.py
autobot-backend/enhanced_orchestration/orchestrator.py
autobot-backend/orchestrator.py
autobot-backend/services/advanced_workflow/orchestrator.py
autobot-backend/services/slm/deployment_orchestrator.py
Consolidation Plan
- Phase 2: Remove backward-compat shims (breaking change for 1-2 releases)
- Phase 3: Evaluate remaining specialized orchestrators (agent_orchestration, advanced_workflow, slm deployment)
- Phase 4: Consolidate into single canonical pattern or justified service-specific variants
Related: #3393
Reactions are currently unavailable
Activity
refactor(backend): consolidate orchestrator files 5→4 (#4048)
refactor(backend): clean up stale EnhancedOrchestrator docstrings (#4048
Merge pull request #5027 from mrveiss/issue-4048
mrveiss commentedon May 4, 2026
✅ Closing with proof — 7→4 target exceeded (now 2 production files, 1 actual Orchestrator class)
Exact commit chain that resolved the 7-file consolidation
agents/agent_orchestrator.pyacf060502refactor(backend): remove backward-compat shim orchestrator files (#3393) (#4869)enhanced_multi_agent_orchestrator.py8493bb7f8refactor(orchestrator): merge EnhancedMultiAgentOrchestrator into ConsolidatedOrchestrator (#5040)enhanced_orchestration/orchestrator.py2d9e4d61frefactor(orchestrator): decompose god class into collaborators (#5058)services/advanced_workflow/orchestrator.py27d704020refactor(services): rename specialized orchestrators (#5040)services/slm/deployment_orchestrator.py27d704020(same commit, same PR)orchestrator.py00919e750renameConsolidatedOrchestrator→Orchestratorapi/orchestration.pyThis issue's own work:
350e5d511refactor(backend): consolidate orchestrator files 5→4 (#4048) — landed via PR #5027 on 2026-04-17. Plusdc413f324cleanup of stale EnhancedOrchestrator docstrings (also #4048).Subsequent cleanup:
dc5342f70refactor(orchestration): 5 targeted fixes from discovery audit (#6404, 2026-04-28).Final state — verified 2026-05-04
Of the 7 originally-listed files, 5 are gone, 1 is the canonical (
orchestrator.py), and 1 is a thin FastAPI router (api/orchestration.py). Production-orchestrator-class count = 1. Original target was 4. Target exceeded.Phase 2 / Phase 3 / Phase 4 status (from original plan)
acf060502)Orchestratoris the single conductor) + refactor(orchestrator): three overlapping workflow execution paths in single Orchestrator class #5058 (decomposed into reusable collaborators)Deep-audit follow-ups filed today (2026-05-04)
A read-only deep-audit of the four remaining orchestration packages (
agents/agent_orchestration/,enhanced_orchestration/,orchestration/,services/orchestration/) surfaced 7 separate consolidation opportunities. None of these are part of issue #4048's scope — they are new tech debt found during closure verification:WorkflowPlannername collision — orphaned canonical vs liveStrategyPlannerAgentCapabilitydefinitions — Enum vs dataclass, same nameAgentRouterclasses (522 LOC vs 68 LOC) — same name, different scopesubagent_dispatcher.pylives inservices/, test-only — layering violationTotal tech debt surfaced: ~3,654 LOC of unwired or duplicated orchestration code, scoped into discrete actionable issues.
Acceptance criteria — final check
Orchestratorinorchestrator.py, decomposed into collaborators in refactor(orchestrator): three overlapping workflow execution paths in single Orchestrator class #5058)mrveiss commentedon May 4, 2026
Self-audit follow-up — 7 additional discovery issues filed
After the user pushed back on whether the deep-audit findings were fully captured, I cross-checked the 4 audit reports against the 7 issues already filed and found I had missed 7 more. Filed now:
WorkflowExecutorgod class (1,178 LOC) — decompose into StepOrchestrator/ParallelCoordinator/CheckpointResumerAgentRegistryfragmentation — 4 implementations + 1 Protocol with same nameRLRouter(Issue #2092) infrastructure-complete but unreachable in productionExecutionStrategyHandlergod class — 6 strategies in one 317-LOC classorchestration.performance_tracker↔enhanced_orchestration.typesSuccessCriteriaEvaluator+CollaborationCoordinatorare single-caller modulesTotal tech debt surfaced by this issue's closure audit: 14 follow-up issues (#6816–#6822 + #6826–#6832).
The most actionable: #6826 (P1) reveals that #3228 was closed before the migration was complete — code comments still reference it as "tracked in #3228" for work that hasn't happened.
mrveiss commentedon May 4, 2026
Framing correction — "orphans" was wrong; these are unwired-by-design completed features
User pushed back: the modules I called "orphans" all have explicit tracker issue references in their docstrings. Checking each:
Every tracker is closed but the code is not reachable from a production path. That's not orphan code — that's systemic premature-closure, the same pattern this very issue (#4048) almost fell into until the user pushed back on my first proposed closure.
Filed as #6836 (P1) with all 3,906 LOC of evidence and recommended CLAUDE.md updates to the closure verification gate.
The 14 follow-up issues (#6816–#6822, #6826–#6832) remain valid — they describe the wire-in work for each module — but their framing should be "complete the integration that the prematurely-closed parent tracker missed," not "audit and remove orphan." The issue bodies use "wire it in or retire," which is correct; only my user-facing summary used the wrong word.
feat(closure-gate): layered defense against premature feature-issue c…