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.

Hide stale quickstart exhaustion badge

rcourtman5b8b253d99e9
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 74bf4ba637..433d2d488c 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -132,7 +132,8 @@ Own canonical runtime payload shapes between backend and frontend.
11. Keep `internal/api/session_store.go` on a fail-closed auth-persistence boundary: persisted OIDC refresh tokens may only round-trip through encrypted-at-rest session payloads, and any missing-crypto or invalid-ciphertext path must drop the token instead of preserving plaintext-at-rest session state.
12. Keep tenant AI handler wiring on canonical provider ownership: `internal/api/ai_handlers.go` may wire tenant `ReadState` and tenant-scoped unified-resource providers into AI services, but it must not revive tenant snapshot-provider bridges once Patrol can initialize and verify from those canonical providers directly.
13. Keep Patrol status transport semantics explicit in that same AI handler layer: the Patrol status endpoint must carry machine-readable runtime availability such as blocked, running, disabled, active, or unavailable rather than asking frontend consumers to infer operator state from stale summaries or run history.
-14. Keep Pulse Mobile relay credential minting and permission ownership on backend ownership: `internal/api/router_routes_auth_security.go`, `internal/api/security_tokens.go`, `internal/api/auth.go`, `internal/api/router_routes_ai_relay.go`, and `frontend-modern/src/api/security.ts` may expose the canonical mobile runtime token creator and governed route gates, but browser callers must only consume that route and must not define the mobile runtime scope, compatibility gate list, or token-purpose metadata locally.
+14. Keep Patrol quickstart transport semantics explicit as well: zero remaining quickstart credits are inventory data, not a standalone runtime-state override, so frontend consumers may only present the exhausted quickstart warning when the payload still reports `using_quickstart` or a runtime state that is blocked by quickstart exhaustion.
+15. Keep Pulse Mobile relay credential minting and permission ownership on backend ownership: `internal/api/router_routes_auth_security.go`, `internal/api/security_tokens.go`, `internal/api/auth.go`, `internal/api/router_routes_ai_relay.go`, and `frontend-modern/src/api/security.ts` may expose the canonical mobile runtime token creator and governed route gates, but browser callers must only consume that route and must not define the mobile runtime scope, compatibility gate list, or token-purpose metadata locally.
## Forbidden Paths
@@ -1204,6 +1205,10 @@ contract data: the Patrol status endpoint must surface
`using_quickstart` directly from backend runtime state so the frontend can
render Patrol quickstart availability without local heuristics or shadow
derived state.
+That quickstart transport contract must also preserve the distinction between
+credit inventory and live runtime path: zero remaining credits alone must not
+force a blocked or exhausted operator presentation while Patrol is active on a
+configured non-quickstart provider path.
That same Patrol status contract now also carries a canonical `runtime_state`
field, so the frontend can distinguish blocked, running, disabled, active,
and unavailable Patrol runtime states without deriving operator status from
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index d4ab9242d9..de4e4c6701 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -178,6 +178,10 @@ also need to preserve route-owned page-health semantics when the owning surface
is REST-backed: operators should only see reconnect or disconnected shells when
the route's own data contract is unhealthy, not because a global websocket
singleton is transiently reconnecting.
+Those same feature-owned header badges must also stay aligned to the owning
+runtime state instead of surfacing stale auxiliary counters as primary status;
+an exhausted quickstart-credit badge cannot override an otherwise active Patrol
+runtime unless quickstart exhaustion is the active blocker.
`frontend-modern/src/components/shared/TagBadges.tsx` is now also the
canonical tag-badge primitive. Dashboard workload rows and the unified-resource
detail drawer must import that shared owner instead of keeping a dashboard-local
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 6f7455c6df..4eb9554723 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -59,6 +59,7 @@ Patrol-specific presentation helpers.
3. Keep remediation execution badge copy and severity styling aligned through `frontend-modern/src/components/patrol/RemediationStatus.tsx` and `frontend-modern/src/utils/remediationPresentation.ts`
4. Add or change Patrol header, summary, or status runtime-state presentation through `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`, `frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx`, `frontend-modern/src/components/patrol/PatrolStatusBar.tsx`, and `frontend-modern/src/utils/patrolRuntimePresentation.ts`
5. Add or change Patrol header quickstart-credit or schedule presentation through `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`, `frontend-modern/src/utils/aiQuickstartPresentation.ts`, and `frontend-modern/src/utils/aiPatrolSchedulePresentation.ts`
+ Patrol must not show the exhausted quickstart-credit warning while runtime state is active on a non-quickstart provider path; that warning belongs only to active quickstart usage or a blocked quickstart-exhausted runtime.
6. Keep Patrol and chat identifier-label presentation aligned through the shared `frontend-modern/src/utils/textPresentation.ts`
7. Keep Patrol and chat stream-matching / mention dedupe aligned through the shared `frontend-modern/src/utils/chatIdentifiers.ts`
8. Keep Patrol transport and payload changes aligned through the governed AI runtime and API contract transport surfaces
@@ -118,7 +119,12 @@ and `frontend-modern/src/utils/aiPatrolSchedulePresentation.ts` are the
canonical owners for quickstart-credit messaging and Patrol interval option
labeling used by `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`;
future Patrol header work should extend those helpers instead of rebuilding
-credit badges or schedule labels inline in the header shell.
+credit badges or schedule labels inline in the header shell. That same header
+surface must now gate exhausted-credit messaging on actual runtime usage:
+Patrol may only show the quickstart exhausted warning when `using_quickstart`
+is true or when the Patrol runtime is explicitly blocked by quickstart
+exhaustion, not merely because the stored credit counter reached zero while a
+configured provider path keeps Patrol active.
`frontend-modern/src/utils/remediationPresentation.ts` is now also the
canonical owner for remediation result badge copy and success/failure styling
used by `frontend-modern/src/components/patrol/RemediationStatus.tsx`, so
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
index 97fba0d34f..9dab683746 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
@@ -27,6 +27,16 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
const runtimePresentation = createMemo(() =>
getPatrolRuntimePresentation(state.runtimeState(), state.blockedReason()),
);
+ const showQuickstartStatus = createMemo(() => {
+ const patrolStatus = state.patrolStatus();
+ if (!patrolStatus) return false;
+ if (patrolStatus.using_quickstart) return true;
+ return (
+ state.runtimeState() === 'blocked' &&
+ (patrolStatus.quickstart_credits_total ?? 0) > 0 &&
+ (patrolStatus.quickstart_credits_remaining ?? 0) <= 0
+ );
+ });
const patrolModelStale = createMemo(() => {
const model = state.patrolModel();
const models = state.availableModels();
@@ -116,14 +126,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
<span class="text-sm font-medium text-base-content">{runtimePresentation().label}</span>
</div>
- <Show
- when={
- state.patrolStatus()?.using_quickstart ||
- (state.patrolStatus()?.quickstart_credits_total &&
- state.patrolStatus()!.quickstart_credits_total! > 0 &&
- state.patrolStatus()!.quickstart_credits_remaining !== undefined)
- }
- >
+ <Show when={showQuickstartStatus()}>
<div
class={`flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium ${quickstartPresentation().className}`}
title={quickstartPresentation().title}
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index accf6f3da2..e903587dc2 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -677,6 +677,57 @@ describe('AIIntelligence entitlement gating', () => {
expect(screen.queryByText(/Health A · 100\/100/)).not.toBeInTheDocument();
});
+ it('does not show the exhausted quickstart chip when patrol is active on a configured provider path', async () => {
+ hasFeatureMock.mockReturnValue(true);
+ licenseStatusMock.mockReturnValue({ subscription_state: 'active' });
+ getPatrolStatusMock.mockResolvedValue(
+ defaultPatrolStatus({
+ runtime_state: 'active',
+ using_quickstart: false,
+ quickstart_credits_total: 25,
+ quickstart_credits_remaining: 0,
+ last_patrol_at: '2026-03-12T09:57:00Z',
+ }),
+ );
+ intelligenceState.summary = {
+ timestamp: '2026-03-12T10:00:00Z',
+ overall_health: {
+ score: 100,
+ grade: 'A',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Infrastructure is healthy with no significant issues detected.',
+ },
+ findings_count: {
+ critical: 0,
+ warning: 0,
+ watch: 0,
+ info: 0,
+ total: 0,
+ },
+ predictions_count: 0,
+ recent_changes_count: 0,
+ learning: {
+ resources_with_knowledge: 0,
+ total_notes: 0,
+ resources_with_baselines: 0,
+ patterns_detected: 0,
+ correlations_learned: 0,
+ incidents_tracked: 0,
+ },
+ };
+
+ render(() => <AIIntelligence />);
+
+ await waitFor(() => {
+ expect(getPatrolStatusMock).toHaveBeenCalled();
+ expect(screen.getByText('Patrol Active')).toBeInTheDocument();
+ });
+
+ expect(screen.queryByText('Credits exhausted — connect API key')).not.toBeInTheDocument();
+ expect(screen.getByText(/Health A · 100\/100/)).toBeInTheDocument();
+ });
+
it('treats a selected zero-finding run as an empty snapshot and uses effective scope ids', async () => {
hasFeatureMock.mockReturnValue(true);
licenseStatusMock.mockReturnValue({ subscription_state: 'active' });