Part of epic #8286 (Phase 3 — Depth). Spike-first, mirroring JSONbored/metagraphed#7763 — but loopover's AI surface is much larger than metagraphed's, so the payoff is too: per-provider/per-model cost, latency, failure, and rate-limit visibility over the review pipeline's real AI spend.
Current state
The ORB's AI calls flow through src/selfhost/ai.ts (provider attempts, rate limits, close-breaker engagement — the ai subsystem in the existing Sentry taxonomy), feeding advisory routing and per-reviewer AI votes. Cost/latency visibility today is logs + whatever Sentry catches on failure; there is no per-model spend/latency analytics at all.
Scope
Boundaries
- Miner-side AMS AI calls are out of scope for the first pass (different package, different client) — noted for a follow-up once the ORB pattern is proven.
Resources
Part of epic #8286 (Phase 3 — Depth). Spike-first, mirroring JSONbored/metagraphed#7763 — but loopover's AI surface is much larger than metagraphed's, so the payoff is too: per-provider/per-model cost, latency, failure, and rate-limit visibility over the review pipeline's real AI spend.
Current state
The ORB's AI calls flow through
src/selfhost/ai.ts(provider attempts, rate limits, close-breaker engagement — theaisubsystem in the existing Sentry taxonomy), feeding advisory routing and per-reviewer AI votes. Cost/latency visibility today is logs + whatever Sentry catches on failure; there is no per-model spend/latency analytics at all.Scope
$ai_generationcapture shape against a real PostHog project (event properties: model, provider, latency, token counts, cost where derivable, error/rate-limit outcome) — metagraphed's spike validates the Workers path; ours validates posthog-node from the self-host server.src/selfhost/ai.tschokepoint (attempt-level: one event per provider attempt, including failed/rate-limited attempts — the retry/breaker behavior is exactly what needs visibility).PAYLOAD_KEYscrub treats prompts as payload — same rule here;$ai_generation's optional content fields stay empty by policy).Boundaries
Resources