mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-21 18:53:37 +00:00
add1096ec8
The Verify Patrol button reset its result to empty on every page load — the operator had to re-click to see the verified state, even though nothing had changed. This commit adds the observability layer of the auto-preflight plan: every RunPatrolToolPreflight result is now cached on the AI Service and surfaced through /api/settings/ai as patrol_preflight, so the inline result panel rehydrates on page load with the most-recent outcome and a "last verified Xs ago" indicator. Backend: patrolPreflightCache (mutex-guarded) on Service with defensive-copy CachedPatrolPreflight() accessor; every RunPatrolToolPreflight branch (success, soft warning, classified failure, validation early-return) records into the cache. PatrolPreflightSnapshot projects the cached result onto the AI settings response. Tests cover both success-then-failure supersession and the defensive-copy invariant. Frontend: PatrolPreflightSnapshot type mirrors the wire shape; hydratePatrolPreflightFromSettings(data) projects the snapshot into the same response shape the manual button writes; loadSettings and updateSettings flows call it. The result panel renders a "last verified Xs ago" line under the provider/model row when recorded_at_unix is present. End-to-end smoke verified against deepseek-v4-flash: panel rehydrates as green "Tool calling verified · last verified just now" after page reload. Auto-preflight on save (the trigger half of the resilience plan) follows in the next commit. Contracts: ai-runtime, api-contracts, agent-lifecycle (dep), storage-recovery (dep), frontend-primitives all updated to reflect the new patrol_preflight surface and hydration contract. Verification artifacts: settingsArchitecture + patrolPreflight client tests.