-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
app.state.orchestrator is never assigned in initialization/lifespan.py, but api/workflow.py reads it via getattr(request.app.state, "orchestrator", None). Since it's always None, the _validate_orchestrator() helper raises HTTP 422 on every request to POST /workflow/execute.
Similarly, api/agent.py accesses request.app.state.orchestrator directly (lines 787, 838, 890) — these will raise AttributeError at runtime.
Evidence
# No assignment of app.state.orchestrator anywhere in lifespan.py
grep -n "app.state.orchestrator" autobot-backend/initialization/lifespan.py
# (no output)
# But it's read in workflow.py and agent.py
grep -rn "app.state.orchestrator" autobot-backend/api/
# api/workflow.py:245: orchestrator = getattr(request.app.state, "orchestrator", None)
# api/agent.py:787: orchestrator = request.app.state.orchestrator
# api/agent.py:838: orchestrator = request.app.state.orchestrator
# api/agent.py:890: orchestrator = request.app.state.orchestratorDiscovered During
Working on #2181 (orchestrator consolidation). The LightweightOrchestrator had the same problem (never set on app.state) and was removed. The main orchestrator has the same gap.
Expected Fix
In initialization/lifespan.py, during startup:
from orchestrator import get_orchestrator
app.state.orchestrator = await get_orchestrator()Also audit api/agent.py to use safe getattr() access.
Impact
High — POST /workflow/execute and agent orchestration endpoints are non-functional.
Files
autobot-backend/initialization/lifespan.py— missing assignmentautobot-backend/api/workflow.py— readsapp.state.orchestratorautobot-backend/api/agent.py— readsrequest.app.state.orchestrator(3 locations)