forked from Rockachopa/Timmy-time-dashboard
feat: add Loop QA self-testing framework
Structured self-test framework that probes 6 capabilities (tool use, multistep planning, memory read/write, self-coding, lightning econ) in round-robin. Reuses existing infra: event_log for persistence, create_task() for upgrade proposals, capture_error() for crash handling, and in-memory circuit breaker for failure tracking. - src/timmy/loop_qa.py: Capability enum, 6 async probes, orchestrator - src/dashboard/routes/loop_qa.py: JSON + HTMX health endpoints - HTMX partial polls every 30s on the health panel - Background scheduler in app.py lifespan - 25 tests covering probes, orchestrator, health snapshot, routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
src/dashboard/routes/loop_qa.py
Normal file
34
src/dashboard/routes/loop_qa.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Loop QA health endpoints — capability self-test status."""
|
||||
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, Request
|
||||
from fastapi.responses import HTMLResponse, JSONResponse
|
||||
|
||||
from dashboard.templating import templates
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(tags=["health"])
|
||||
|
||||
|
||||
@router.get("/health/loop-qa")
|
||||
async def loop_qa_health():
|
||||
"""Return HealthSnapshot as JSON."""
|
||||
from timmy.loop_qa import loop_qa_orchestrator
|
||||
|
||||
snapshot = loop_qa_orchestrator.get_health_snapshot()
|
||||
return JSONResponse(content=snapshot)
|
||||
|
||||
|
||||
@router.get("/health/loop-qa/partial", response_class=HTMLResponse)
|
||||
async def loop_qa_health_partial(request: Request):
|
||||
"""Return HTMX partial for the dashboard health panel."""
|
||||
from timmy.loop_qa import loop_qa_orchestrator
|
||||
|
||||
snapshot = loop_qa_orchestrator.get_health_snapshot()
|
||||
return templates.TemplateResponse(
|
||||
request,
|
||||
"partials/loop_qa_health.html",
|
||||
{"snapshot": snapshot},
|
||||
)
|
||||
Reference in New Issue
Block a user