Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/agents/investigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def _spawn_work_order_generator(work_order_id: int) -> None:
instead of a throwaway stub.
"""
try:
from agents.work_order_generator import (# type: ignore[import-not-found]
from agents.work_order_generator import ( # type: ignore[import-not-found]
run_work_order_generator,
)
except ImportError:
Expand Down
12 changes: 12 additions & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

from __future__ import annotations

import asyncio
import logging
from contextlib import asynccontextmanager

from agents.sentinel import sentinel_loop
from aria_mcp.server import http_app as mcp_http_app
from core.config import get_settings
from core.database import db
Expand Down Expand Up @@ -38,9 +40,19 @@ async def lifespan(app: FastAPI):
log.info("ARIA backend ready")
async with mcp_http_app.lifespan(mcp_http_app):
log.info("MCP server ready at /mcp")
# Sentinel must start INSIDE the MCP lifespan wrapper — its first
# `mcp_client.call_tool()` hits 404 otherwise (MCP HTTP app not
# yet mounted). See #26 audit comment.
sentinel_task = asyncio.create_task(sentinel_loop(), name="sentinel")
try:
yield
finally:
sentinel_task.cancel()
try:
await sentinel_task
except asyncio.CancelledError:
pass
log.info("Sentinel cancelled")
await db.disconnect()


Expand Down
Loading