fix: import task_registry without 'agent.' package prefix in container

In the container, agent.py is at /opt/voice-agent/agent.py (flat, not a
package). The 'from agent.task_registry import ...' raised ModuleNotFoundError
which killed the job before session.start(), causing 'assistant not ready
retry' in the browser. Added try/except ImportError fallback to bare import.
This commit is contained in:
Shane
2026-08-22 18:41:11 -04:00
parent 44e8d05e2c
commit dd33837055
+4 -1
View File
@@ -554,7 +554,10 @@ async def handle_job(ctx: JobContext) -> None:
logger.info("user state -> %s", ev.new_state)
# ── Background task events → room data channel ─────────────────────────
from agent.task_registry import registry as task_registry
try:
from agent.task_registry import registry as task_registry
except ImportError:
from task_registry import registry as task_registry
async def _publish_task_event(task_id: str, event: dict) -> None:
payload = json.dumps({"type": "task_event", "task_id": task_id, **event})