Repository navigation
refactor(backend): one conductor — single Orchestrator class, rename 6 misnamed '*Orchestrator' classes #5040
Copy link
Copy link
Closed
Description
The Rule
In an orchestra, there is only one conductor.
Today the codebase has 8 classes named `*Orchestrator`. Only one of them is actually THE orchestrator (the multi-agent conductor). The rest are specialized coordinators/dispatchers/runners that misappropriate the name, which (a) dilutes the concept and (b) makes it ambiguous which one callers should reach for.
Inventory
| # | Class | File | Actual role | Action |
|---|---|---|---|---|
| 1 | `ConsolidatedOrchestrator` | `autobot-backend/orchestrator.py` | THE multi-agent conductor | Rename → `Orchestrator`, absorb #2 |
| 2 | `EnhancedMultiAgentOrchestrator` | `autobot-backend/enhanced_orchestration/init.py` | Duplicate multi-agent planner/executor | Merge into #1, delete class |
| 3 | `SLMDeploymentOrchestrator` | `services/slm/deployment_orchestrator.py` | SLM deployment API bridge | Rename → `SLMDeploymentBridge` |
| 4 | `DeploymentOrchestrator` | same file | Multi-node rollout tracker | Rename → `DeploymentCoordinator` |
| 5 | `SubagentOrchestrator` | `services/orchestration/subagent_orchestrator.py` | Parallel subagent dispatcher | Rename → `SubagentDispatcher` |
| 6 | `AutonomousLoopOrchestrator` | `services/knowledge/autonomous_loop.py` | Knowledge loop runner | Rename → `AutonomousLoopRunner` |
| 7 | `AdvancedWorkflowOrchestrator` | `services/advanced_workflow/orchestrator.py` | Workflow intelligence coordinator | Rename → `WorkflowCoordinator` |
| 8 | `AgentOrchestrator` | `agents/agent_orchestration/coordinator.py` | Distributed agent lifecycle | Rename → `DistributedAgentCoordinator` |
Also rename files that contain them (e.g., `services/slm/deployment_orchestrator.py` → `services/slm/deployment.py`; `services/advanced_workflow/orchestrator.py` → `services/advanced_workflow/coordinator.py`).
Non-negotiable requirements
- Zero functionality loss. Every public method on Docs improvements #1 and Docs improvements #2 must survive the merge. No behavior changes.
- Function uniqueness. When two classes have the same method (e.g., both Docs improvements #1 and Docs improvements #2 define `_update_agent_performance`), diff them, pick the canonical implementation, and deduplicate. Extract to a shared helper if both versions have value.
- Function reusability. Logic shared across multiple classes (agent-performance tracking, parallel execution patterns) should live in one place and be imported — not copy-pasted.
Method-overlap audit (confirmed duplicates between #1 and #2)
- `_update_agent_performance` — defined in both
- Agent coordination / workflow planning / performance tracking — overlapping conceptual surface
Out of scope (for now)
- `api/orchestration.py` — FastAPI router, keep as-is (it routes to THE orchestrator)
- `autobot-backend/orchestration/` package — internal extracted modules (types, executor, planner); keep
- Further unification of Dev new gui #5/Refactor backend API and remove unused variables #6/Dev new gui #7/Analysis report 20250803 #8 with Docs improvements #1 — they are genuinely specialized, not misnamed duplicates
Acceptance criteria
- Exactly one class named `Orchestrator` in `autobot-backend/` (grep check)
- All other classes renamed per table above
- All file renames applied
- All 34+ importers updated
- `pytest autobot-backend/tests/orchestration/` passes (34 tests)
- `python -m py_compile` passes on every modified file
- Zero `TODO`/commented-out code in the refactor
Subsumes
- refactor(backend): unify EnhancedMultiAgentOrchestrator into ConsolidatedOrchestrator (Phase 4) #5037 (unify EnhancedMultiAgent into ConsolidatedOrchestrator) — will be closed by this PR
- discovery(backend): rename ResourceFactory.get_enhanced_orchestrator → get_orchestrator (stale terminology) #5038 (rename `ResourceFactory.get_enhanced_orchestrator`) — will be closed by this PR
- discovery(backend): 12 test files use 'ConsolidatedOrchestrator as Orchestrator' alias #5039 (test file alias cleanup) — will be closed by this PR
Related
- refactor(backend): complete orchestrator consolidation (7→4 target) #4048 (closed by refactor(backend): consolidate orchestrator files 5→4 (#4048) #5027) — Phase 2+3 partial consolidation (5→4 files)
- refactor(backend): consolidate 7 orchestrator files to 4 #3393 (closed) — original consolidation
Reactions are currently unavailable
Activity
refactor(orchestrator): merge EnhancedMultiAgentOrchestrator into Con…
refactor(orchestrator): rename ConsolidatedOrchestrator → Orchestrato…
refactor(services): rename specialized orchestrators (SLM, deployment…
refactor(backend): align ResourceFactory and tests with single Orches…
refactor(backend): remove all backward-compat shims and name aliases (#…
refactor(backend): clean up stale AgentOrchestrator reference in agen…
Merge pull request #5053 from mrveiss/issue-5040
mrveiss commentedon Apr 17, 2026
✅ Closed by PR #5053 (merged in 7b74d42).
Acceptance criteria met:
Orchestratorinautobot-backend/— verified via grep '^class.*Orchestrator\b' returns onlyorchestrator.py:215:class Orchestrator:as OldNamealias imports removedPost-merge discoveries (filed as follow-ups, not closure blockers):
_ma_prefix leakbounded_gatherhelper opportunity across Orchestrator and SubagentDispatcher