Commit Graph

25 Commits

Author SHA1 Message Date
rcourtman e657f6ace9 Suppress assessment error penalty after trailing-success recovery
The overall-health "Recent Patrol errors" coverage factor in
summarizeRecentPatrolCoverage was anchoring the score to a
stale ratio: it counted errors across the last 10 runs without
weighting recency. After Pulse fixed two compounding Patrol
bugs today, four consecutive successful runs (50+ tool calls
each) followed six earlier failures. The assessment kept
showing C/65 with the prediction "most recent Patrol runs
encountered errors (6 of 10)" — directly contradicting the
fact that *every* recent run had succeeded.

Operators reading that score would conclude Pulse Patrol is
still broken. It isn't. The fix dragged the grade.

This commit adds a recovery-suppression check: count trailing
successful full Patrol runs from the most-recent end of the
window (GetAll returns newest-first), skipping non-full runs.
When three or more consecutive trailing successes exist —
roughly a 9-hour clean stretch at the default 3-hour cadence —
the error penalty drops entirely. The score reflects current
reality.

Three is conservative: a single recovery run could be a
transient win; three consecutive demonstrate the underlying
fix is sticking. Below the threshold, the existing ratio-tiered
penalty still applies so partially-recovered states still
register.

Two tests guard the boundary:
  - 6 historical errors + 3 trailing successes → no coverage
    factor (suppressed)
  - 6 historical errors + 2 trailing successes → coverage
    factor remains (recovery incomplete)

Live verified after this commit lands: the assessment that's
been stuck at C/65 since the malformed-history fix will
recompute to A/B grade as soon as the trailing 3 successful
runs are recognized by the same recent-runs query.

ai-runtime contract updated.
2026-05-10 23:02:57 +01:00
rcourtman a343ba0126 Tier patrol-coverage health impact by recent-error ratio
The overall health score chip read "A · 95/100" while the same
assessment card said "Coverage incomplete · Recent Patrol runs
encountered errors · Verify full coverage." Those messages
contradicted because the "recent errors but had a successful run"
coverage factor used a flat -10 penalty regardless of the error
ratio. With one successful manual run among many failed startup
runs, the math stayed in the A band and the score directly
undermined the warning it sat next to.

The factor now tiers the impact by ratio of errored runs to
relevant runs in the scoring window:

  >50% errored → -30, "Most recent Patrol runs encountered errors
                       (N of M); the current health summary is not
                       reliable until coverage stabilizes."
  >25% errored → -20, "Recent Patrol runs encountered errors
                       (N of M), so the current health summary
                       may be incomplete."
  else         → -10, original light-tier description.

A single transient error stays in grade A; dominant-error periods
drop out of A so the grade matches the warning. Adds two tests
covering both ends of the new tiering and updates the ai-runtime
subsystem contract Current State section.
2026-05-10 19:33:18 +01:00
rcourtman e38332de86 Keep Patrol evidence aligned with live findings 2026-05-08 11:08:53 +01:00
rcourtman 3c0707751b Canonicalize Patrol activity semantics 2026-03-29 13:38:06 +01:00
rcourtman 77d496f70e Align Patrol coverage text with run history
AI runtime coverage summaries now distinguish recent full patrol errors from scoped-only activity so Patrol assessment copy matches the verification evidence.
2026-03-25 12:18:31 +00:00
rcourtman 2ec625091c Degrade Patrol health on incomplete coverage 2026-03-25 10:13:08 +00:00
rcourtman 249df06149 Remove resource intelligence policy posture 2026-03-19 15:21:03 +00:00
rcourtman 071da2c189 Centralize canonical resource metadata refresh 2026-03-19 05:33:25 +00:00
rcourtman c4c154efcf Route correlations through intelligence facade 2026-03-19 04:15:26 +00:00
rcourtman b8a77cf726 Route AI recent changes through canonical intelligence 2026-03-19 04:04:14 +00:00
rcourtman 116bce58e1 Move policy posture summary into unified resources 2026-03-19 03:42:36 +00:00
rcourtman 43664a3f27 Centralize AI memory change conversion 2026-03-19 03:39:38 +00:00
rcourtman 2523b62379 Centralize memory change formatting 2026-03-19 02:58:28 +00:00
rcourtman 399f5d64dc Share recent change section formatting 2026-03-19 02:53:50 +00:00
rcourtman 85914c21b9 Centralize resource change summary formatting 2026-03-19 02:50:55 +00:00
rcourtman 7e42773c2f Expose resource intelligence policy posture 2026-03-19 01:14:20 +00:00
rcourtman ad7388b591 Expose canonical policy posture summary 2026-03-19 01:08:48 +00:00
rcourtman 771f2a3e41 Add recent changes to intelligence summary 2026-03-19 00:18:28 +00:00
rcourtman 12e705df1e Expose recent changes in resource intelligence 2026-03-19 00:16:14 +00:00
rcourtman eaf702c358 Surface canonical recent changes in intelligence context 2026-03-19 00:04:32 +00:00
rcourtman 2121e57d74 Use canonical resource timeline in intelligence summary 2026-03-19 00:00:26 +00:00
rcourtman 27f1a11acb feat: add AI Intelligence system with investigation and forecasting
Major new AI capabilities for infrastructure monitoring:

Investigation System:
- Autonomous finding investigation with configurable autonomy levels
- Investigation orchestrator with rate limiting and guardrails
- Safety checks for read-only mode enforcement
- Chat-based investigation with approval workflows

Forecasting & Remediation:
- Trend forecasting for resource capacity planning
- Remediation engine for generating fix proposals
- Circuit breaker for AI operation protection

Unified Findings:
- Unified store bridging alerts and AI findings
- Correlation and root cause analysis
- Incident coordinator with metrics recording

New Frontend:
- AI Intelligence page with patrol controls
- Investigation drawer for finding details
- Unified findings panel with actions

Supporting Infrastructure:
- Learning store for user preference tracking
- Proxmox event ingestion and correlation
- Enhanced patrol with investigation triggers
2026-01-24 22:41:43 +00:00
rcourtman 31c704c7a7 refactor: fix lint issues in internal/ai package
- Remove redundant nil checks before len() calls
- Mark unused parameters with underscore
- Convert if/else chains to switch statements for cleaner code
- Add test assertions to resolve unused write warnings in patrol_test.go
2026-01-02 19:53:01 +00:00
rcourtman c6bd8cb74c Improve internal package test coverage 2025-12-29 17:25:21 +00:00
rcourtman 417a523d85 feat(ai): add unified Intelligence orchestrator
- Create Intelligence struct that aggregates all AI subsystems
- Add /api/ai/intelligence endpoint for system-wide and per-resource insights
- Wire Intelligence into PatrolService as a facade (not replacement)
- Add TypeScript types and API client for frontend
- Add unit tests for Intelligence orchestrator
- Fix pre-existing test failures using diagnostic commands instead of actionable ones

The Intelligence orchestrator provides:
- System-wide health scoring (A-F grades)
- Aggregated findings, predictions, correlations
- Per-resource context generation for AI prompts
- Learning progress tracking

This unifies access to AI subsystems without replacing existing code paths.
2025-12-21 10:32:02 +00:00