Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Document the fleet-narrative surface in ai-runtime and api-contracts

rcourtman7bd596d378aa
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 23463f7c4f..eab648b858 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -1759,3 +1759,21 @@ prompt budget. Reporting is therefore an additive consumer of AI
runtime, not a new ownership boundary, and the narrator/findings
surfaces inherit the same governance the rest of the canonical AI
runtime already enforces.
+
+The same canonical AI runtime now also owns the fleet-level report
+narrative through `report_fleet_narrator.go`. `Service` implements
+`pkg/reporting.FleetNarrator` with its own use-case label
+(`report_narrative_fleet`) so fleet vs single-resource spend is
+distinguishable in the cost ledger, and so the budget gate
+(`enforceBudget`) and dashboard taxonomy can address the two
+separately. The fleet payload is denormalised through
+`buildReportFleetPayload` into compact per-resource rows plus a
+fleet-wide aggregate so prompt cost scales linearly with fleet
+size without exploding token usage. The same fail-closed invariant
+holds: nil provider, parse failure, empty narrative, or context
+cancellation returns an error so the reporting engine falls back to
+`HeuristicFleetNarrator`. Single-resource report narration is
+deliberately not propagated through the multi-report path; a
+50-resource fleet report performs exactly one AI call (the fleet
+narrator) rather than 51 (one per resource plus a fleet-level
+summary).
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index fb0abba919..5aa9884067 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -4389,10 +4389,25 @@ narrator must fail closed: nil provider, parse failure, timeout, or
empty response causes the engine to fall back to the heuristic
narrative without surfacing the AI failure to the caller, so reporting
is never blocked by AI availability.
-Multi-resource fleet reports (`engine.GenerateMulti`) intentionally
-remain heuristic-only at this transport layer: a fleet narrative is a
-distinct contract shape from a single-resource narrative, and the
-narrator surface in `MetricReportRequest` does not propagate through
-`MultiReportRequest`. Adding fleet-level AI narrative is a future
-contract delta and must extend the multi-report request shape
-explicitly rather than reusing the per-resource narrator hook.
+Multi-resource fleet reports (`engine.GenerateMulti`) now also carry an
+optional fleet-level narrative through a distinct
+`pkg/reporting.FleetNarrator` interface, kept separate from the
+single-resource `Narrator` because the input shape is different (one
+cross-resource view rather than one resource's stats with a prior
+window). `MultiReportRequest` gains optional `FleetNarrator`,
+`Narrator`, and `FindingsProvider` fields; `MultiReportData` gains
+`FleetNarrative *FleetNarrative` populated by the engine before
+rendering. Per-resource narratives are intentionally not produced on
+the multi path: a 50-resource fleet report would otherwise trigger 50
+AI calls. Synthesis lives in the single fleet-level call instead.
+The fleet PDF renders the FleetNarrative in the fleet summary cover
+when present, replacing the legacy "Highest CPU / Most alerts"
+heuristic bullets. The narrative section owns: an executive prose
+paragraph, a `Resources to investigate` outlier list (named
+resources, severity-coloured), a `Cross-cutting patterns` section,
+recommendations, an optional period-comparison paragraph, and a
+provenance footer when `Source` is `ai`. The deterministic resource
+summary table (resource, type, status, avg CPU/memory/disk, alert
+count) remains rendered from the same per-resource aggregates
+above the narrative section, so every named outlier is verifiable
+against the table immediately below it.