Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(ci): mesh /livez+/readyz probes + resolve @aisoc/report-card from source
Beenu Arorad7cd653a9134
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.jsonindex 50bdec9a7..a5d9b4cd4 100644--- a/apps/web/tsconfig.json+++ b/apps/web/tsconfig.json@@ -31,6 +31,9 @@],"@aisoc/ui": ["../../packages/ui/src"+ ],+ "@aisoc/report-card": [+ "../../packages/report-card/src"]}},diff --git a/packages/aisoc-action/dist/index.js b/packages/aisoc-action/dist/index.jsindex dce6d2d2c..d6b0967d1 100644--- a/packages/aisoc-action/dist/index.js+++ b/packages/aisoc-action/dist/index.js@@ -24191,7 +24191,7 @@ async function fetchAlerts(octokit, owner, repo, sources) {return { alerts, notes };}-// ../report-card/dist/index.js+// ../report-card/src/index.tsfunction coverageGrade(percent) {if (percent >= 90) return "A";if (percent >= 75) return "B";diff --git a/packages/report-card/package.json b/packages/report-card/package.jsonindex eb27804e3..61ee7f3a7 100644--- a/packages/report-card/package.json+++ b/packages/report-card/package.json@@ -4,13 +4,13 @@"description": "Shared, dependency-free renderer for AiSOC share cards (triage summaries, ATT&CK coverage grades, investigation-replay verdicts) as SVG + Markdown. Used by the aisoc CLI --share flag, the noise-tuning dashboard, and the web OG image routes.","license": "MIT","type": "module",- "main": "./dist/index.js",- "module": "./dist/index.js",- "types": "./dist/index.d.ts",+ "main": "./src/index.ts",+ "module": "./src/index.ts",+ "types": "./src/index.ts","exports": {".": {- "types": "./dist/index.d.ts",- "import": "./dist/index.js"+ "types": "./src/index.ts",+ "import": "./src/index.ts"}},"files": ["dist", "src"],diff --git a/services/mesh/app/_health.py b/services/mesh/app/_health.pynew file mode 100644index 000000000..974269731--- /dev/null+++ b/services/mesh/app/_health.py@@ -0,0 +1,111 @@+"""+Phase 2.6 — shared liveness + readiness probes for AiSOC FastAPI+services.++The "liveness vs readiness" distinction is the single most-missed+detail in self-deployed Python services. The two checks answer+DIFFERENT questions and k8s (and any sensible load balancer)+treats the answers differently:++ * ``/livez`` — "is this process still running?". Returns 200 if+ the Python interpreter is responsive. Failure here+ means the orchestrator should RESTART the pod —+ not pull it from the load balancer, but kill it+ and reschedule.++ * ``/readyz`` — "is this process ready to accept traffic?".+ Returns 200 ONLY after the lifespan startup hook+ has finished. Failure here means the orchestrator+ should NOT send traffic to this pod (yet) — but+ should NOT kill it.++When a service ships only ``/healthz`` (or a single ``/health``)+and the orchestrator wires it as the liveness probe, the service+gets killed and restarted any time a dependency hiccups. When it's+wired as the readiness probe, the orchestrator never restarts+genuinely-stuck pods. You want BOTH, with different semantics.++Usage::++ from app._health import install_health_routes++ app = FastAPI(...)+ mark_ready, mark_not_ready = install_health_routes(+ app, service_name="aisoc-fusion"+ )++ @asynccontextmanager+ async def lifespan(app: FastAPI):+ ... startup work ...+ mark_ready()+ try:+ yield+ finally:+ mark_not_ready()+ ... shutdown work ...++Services using the deprecated ``@app.on_event("startup")`` /+``@app.on_event("shutdown")`` hooks call ``mark_ready()`` /+``mark_not_ready()`` from those handlers respectively.++This module is intentionally dependency-free (only FastAPI) so it+can be vendored into every service tree without import-graph+side-effects. Each service ships its own copy under+``services/<svc>/app/_health.py`` because services don't share a+Python path — keep the file in sync via+``scripts/sync_health_module.py`` (CI gate).+"""++from __future__ import annotations++from collections.abc import Callable+from typing import Any++from fastapi import FastAPI, Response+++def install_health_routes(app: FastAPI, *, service_name: str) -> tuple[Callable[[], None], Callable[[], None]]:+ """Install ``/livez`` and ``/readyz`` on ``app``.++ Returns a ``(mark_ready, mark_not_ready)`` tuple the caller+ wires into their lifespan / startup handler. The readiness+ flag defaults to False, so ``/readyz`` returns 503 until+ ``mark_ready()`` is called — exactly the right behaviour for a+ rolling deploy where the orchestrator should hold traffic+ until the pod's dependencies are connected.+ """+ state: dict[str, bool] = {"ready": False}++ @app.get(+ "/livez",+ tags=["system"],+ include_in_schema=False,+ )+ async def _livez() -> dict[str, Any]:+ return {"status": "alive", "service": service_name}++ @app.get(+ "/readyz",+ tags=["system"],+ include_in_schema=False,+ )+ async def _readyz() -> Response:+ if state["ready"]:+ return Response(+ content='{"status":"ready","service":"' + service_name + '"}',+ media_type="application/json",+ status_code=200,+ )+ return Response(+ content='{"status":"starting","service":"' + service_name + '"}',+ media_type="application/json",+ status_code=503,+ )++ def mark_ready() -> None:+ state["ready"] = True++ def mark_not_ready() -> None:+ state["ready"] = False++ return mark_ready, mark_not_readydiff --git a/services/mesh/app/main.py b/services/mesh/app/main.pyindex 4f7cbc408..2538df439 100644--- a/services/mesh/app/main.py+++ b/services/mesh/app/main.py@@ -13,12 +13,18 @@ import osfrom fastapi import FastAPI, HTTPExceptionfrom pydantic import BaseModel, Field+from app._health import install_health_routesfrom app.artifacts import IocSighting, VerdictSignaturefrom app.hub import DEFAULT_K, MeshHubapp = FastAPI(title="AiSOC Mesh Hub", version="0.1.0")_hub = MeshHub(k=int(os.environ.get("AISOC_MESH_K", DEFAULT_K)))+# Phase 2.6 liveness/readiness probes. The hub is in-memory with no external+# dependencies, so it is ready as soon as the process is up.+_mark_ready, _mark_not_ready = install_health_routes(app, service_name="aisoc-mesh")+_mark_ready()+@app.get("/health")def health() -> dict: