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.

Show Patrol open work in navigation

rcourtman7449d14ef724
diff --git a/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md b/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md
index 60d5e7be63..47c3b7c470 100644
--- a/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md
+++ b/docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md
@@ -108,6 +108,10 @@ loop, and routes the operator from real findings/evidence to safe action.
useful row-level step by Patrol mode: review evidence in Watch only, approve
changes in Ask first, inspect safe fixes or automatic actions in higher
modes, and review verification results without adding a separate proof strip.
+- 2026-06-25: Added a shell-level Patrol open-work count for desktop and mobile
+ navigation. The visible destination remains `Patrol`; the count is secondary
+ current-work signaling driven by active Patrol findings and live Patrol
+ approvals, not a renamed `Needs Attention` route or a generic Home queue.
## Evidence
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 9553050d77..75a0b25d7e 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -30,6 +30,11 @@ contracts. The subsystem also owns AI orchestration, runtime cost control,
shared AI transport surfaces, and browser-visible Assistant transcript actions
that define what visible operator/model text can leave the transcript without
exposing hidden provider/tool metadata.
+App-shell Patrol chrome may expose only content-free current-work pressure, such
+as an open-work count on the stable `Patrol` tab, from Patrol-owned findings and
+approval read models. It must not rename the destination, create a second
+findings queue, expose finding or approval identity in shell chrome, or turn
+platform pages into Patrol summaries.
When backend Patrol summaries or Assistant handoffs expose run coverage to the
browser, they translate internal full-run, scoped-run, and verification
precision into plain operator check language rather than activation-loop,
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index cf1be858c3..c201ab1d5a 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -268,6 +268,13 @@ finding or approval is handled. Browser presentation labels the route `Patrol`
and may label the default queue `Open work`, but those labels are chrome over
this existing status/finding/approval contract; they are not new API fields,
prompt payloads, or alternate current-work schemas.
+Shell navigation may derive a content-free `Patrol` open-work count from the
+existing Patrol findings endpoint plus live investigation-fix approvals,
+de-duplicated by finding/approval target id. That shell count is not a new API
+route or status field, must not include finding IDs, approval IDs, resource
+names, commands, prompt text, or model output in visible chrome, and must not
+replace the detail-owning Patrol findings, approval, run-history, or status
+routes.
The authenticated `GET /api/agent/patrol-control/status` projection exposes the same content-free starter evidence as count-only fields
(`operationsLoopStarterCount`, `assistantOperationsLoopStarterCount`,
`patrolOperationsLoopStarterCount`,
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index adecf8e28d..0bf74b6825 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -822,7 +822,10 @@ or other self-hosted uncapped continuity plans.
counts rather than duplicating branded SVG titles. The Patrol-owned utility
destination remains `Patrol` over the same `/patrol` route; it must not
alter hosted org bootstrap, entitlement loading, or commercial posture
- loading.
+ loading. A Patrol open-work badge in that shell may consume only the
+ existing Patrol findings and live-approval read model after authentication;
+ it must not read hosted billing state, trigger commercial-posture loading,
+ affect organization visibility, or become an upgrade/acquisition cue.
The same AppLayout shell may contextualize the closed Pulse Assistant
launcher around the current monitoring, Patrol, Alerts, or Settings route,
but that launcher must remain a local product affordance. It must not read
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 53b5218bf3..781a437d2e 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -597,6 +597,11 @@ generic: `AppLayout.tsx` and the command palette may expose a compact launcher,
but that launcher must attach current-view context before opening the drawer
and label the action around the current monitoring, Patrol, Alerts, or Settings
view.
+The app shell may surface Patrol current-work pressure as a secondary count on
+the `Patrol` navigation tab, but it must not rename that tab to `Needs
+Attention`, create a Home-like action queue, or route the operator away from the
+Patrol route. Desktop and mobile accessible names should combine the stable
+`Patrol` label with concise open-work count context when a count is present.
SSO provider settings changes must preserve the shared Community-tier action
path: SAML and OIDC provider creation stay on the same settings-shell control
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 9ceb671bd2..71c43d0bc5 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -62,6 +62,11 @@ Open work descriptions are Patrol-owned operator guidance. They may mention the
visible next step, approvals, and verification results when those words help the
operator understand what to do next, but they must not become a separate proof
strip, backend accounting summary, or generic all-mode capability sentence.
+Shell-level Patrol open-work counts are also Patrol-owned read-model
+projections. They may de-duplicate active Patrol findings and live Patrol
+approval targets so the stable `Patrol` tab shows that work exists, but they
+must not become a second queue model, a renamed `Needs Attention` destination,
+or historical proof/counting for resolved-only work.
1. Add or change Patrol page orchestration through `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, keep `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` as the canonical investigation-context derivation owner, keep `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx` as the feature shell, keep the Patrol-owned section files under `frontend-modern/src/features/patrol/` as the heavy render owners, keep `frontend-modern/src/pages/AIIntelligence.tsx` as the route shell, keep `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` as the canonical AI summary normalization owner, and update `frontend-modern/src/stores/aiIntelligence.ts` together
The default Patrol workspace is the current-issues list. It must not add a
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 449fcd0ea6..d56f3c2220 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -550,6 +550,12 @@ dashboard-specific overview, trend, or summary transport.
`/patrol` is canonical and retired `/ai` browser entry points must stay
unregistered rather than mounting a second Patrol shell or duplicate app
bootstrap work.
+ The shell-level Patrol open-work badge may refresh active Patrol findings
+ and live approvals from `frontend-modern/src/useAppRuntimeState.ts` after
+ authentication on a bounded 30-second interval, but it must stay on those
+ existing content-safe endpoints, avoid resolved-history expansion, avoid
+ resource or chart hydration, and avoid adding another route preload or
+ commercial/bootstrap fetch to ordinary monitoring sessions.
The same rule now applies to the retired `/operations` surface:
`/operations/*` browser entry points must stay unregistered rather than
mounting a second diagnostics/reporting shell or paying extra bootstrap
diff --git a/frontend-modern/src/AppLayout.tsx b/frontend-modern/src/AppLayout.tsx
index d3bb19ce66..195cce1b8a 100644
--- a/frontend-modern/src/AppLayout.tsx
+++ b/frontend-modern/src/AppLayout.tsx
@@ -41,6 +41,7 @@ import {
import { getKioskModePreference, setKioskMode } from '@/utils/url';
import { updateStore } from '@/stores/updates';
import { aiChatStore } from '@/stores/aiChat';
+import { aiIntelligenceStore } from '@/stores/aiIntelligence';
import { isPro } from '@/stores/licenseCommercial';
import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
import { getAssistantPageContext } from '@/utils/assistantPageContext';
@@ -60,11 +61,12 @@ const AI_CHAT_LAUNCHER_BUTTON_CLASS =
'fixed right-4 bottom-[calc(5rem+env(safe-area-inset-bottom,0px))] z-40 flex h-11 w-11 items-center justify-center rounded-full border border-border bg-surface text-blue-600 shadow-lg transition-colors duration-200 hover:bg-surface-hover hover:text-blue-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 dark:text-blue-400 dark:hover:text-blue-300 lg:right-0 lg:top-1/2 lg:bottom-auto lg:h-auto lg:w-auto lg:min-h-9 lg:min-w-10 lg:-translate-y-1/2 lg:rounded-l-lg lg:rounded-r-none lg:border-r-0 lg:px-2.5 lg:py-2.5 lg:shadow-none';
function getDesktopUtilityTabAriaLabel(tab: UtilityTab): string {
- if (tab.id === 'alerts') {
- const count = tab.count ?? 0;
- if (count > 0) {
+ const count = tab.count ?? 0;
+ if (count > 0) {
+ if (tab.id === 'alerts') {
return `${count} ${tab.label}`;
}
+ return `${tab.label}: ${tab.countLabel ?? `${count} items`}`;
}
return tab.label;
}
@@ -315,6 +317,12 @@ export function AppLayout(props: AppLayoutProps) {
const getActiveTabDesktop = () => getActiveTabForPath(location.pathname);
const getActiveTabMobile = () => getActiveTabForPath(location.pathname);
const assistantPageContext = createMemo(() => getAssistantPageContext(location.pathname));
+ const patrolOpenWorkCount = createMemo(() => aiIntelligenceStore.patrolOpenWorkCount);
+ const patrolOpenWorkCountLabel = createMemo(() => {
+ const count = patrolOpenWorkCount();
+ if (count <= 0) return undefined;
+ return `${count} open work ${count === 1 ? 'item' : 'items'}`;
+ });
// Platform/runtime nav is resource-admitted. A platform or runtime lens only
// appears when the support manifest says the surface is supported and the
@@ -433,7 +441,8 @@ export function AppLayout(props: AppLayoutProps) {
route: '/patrol',
tooltip: 'Review Patrol checks, findings, and approvals',
badge: null,
- count: undefined,
+ count: patrolOpenWorkCount() > 0 ? patrolOpenWorkCount() : undefined,
+ countLabel: patrolOpenWorkCountLabel(),
breakdown: undefined,
icon: PulsePatrolLogo,
},
@@ -778,12 +787,12 @@ export function AppLayout(props: AppLayoutProps) {
<span class="flex items-center gap-1">
<span class="hidden xs:inline">{tab.label}</span>
<span class="xs:hidden">{tab.label.charAt(0)}</span>
- {tab.id === 'alerts' &&
- (() => {
- const total = tab.count ?? 0;
- if (total <= 0) {
- return null;
- }
+ {(() => {
+ const total = tab.count ?? 0;
+ if (total <= 0) {
+ return null;
+ }
+ if (tab.id === 'alerts') {
return (
<span class="inline-flex items-center gap-1">
{tab.breakdown && tab.breakdown.critical > 0 && (
@@ -798,7 +807,13 @@ export function AppLayout(props: AppLayoutProps) {
)}
</span>
);
- })()}
+ }
+ return (
+ <span class="inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 text-[10px] font-semibold text-amber-900 dark:text-amber-100 bg-amber-200 dark:bg-amber-500 rounded-full">
+ {total}
+ </span>
+ );
+ })()}
</span>
<Show when={tab.badge === 'update'}>
<span class="ml-1 flex items-center">
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 1268946cc5..c3dc6b5fc0 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -284,6 +284,9 @@ describe('App architecture', () => {
expect(appLayoutSource).toContain("route: '/patrol',");
expect(appLayoutSource).toContain("label: 'Patrol'");
expect(appLayoutSource).toContain("tooltip: 'Review Patrol checks, findings, and approvals'");
+ expect(appLayoutSource).toContain('const patrolOpenWorkCount = createMemo(');
+ expect(appLayoutSource).toContain('countLabel: patrolOpenWorkCountLabel()');
+ expect(appLayoutSource).not.toContain("label: 'Needs Attention'");
expect(appLayoutSource).not.toContain("route: '/operations',");
expect(appLayoutSource).not.toContain('props.connected()');
expect(appLayoutSource).toContain('const utilityTabs = createMemo(() =>');
@@ -379,6 +382,9 @@ describe('App architecture', () => {
'if (isPreAuthLoginBootstrapPath(window.location.pathname) && !hasLocalAuthBootstrapHint()) {',
);
expect(appRuntimeStateSource).toContain('aiChatStore.setEnabled(');
+ expect(appRuntimeStateSource).toContain('aiIntelligenceStore.loadPatrolFindings()');
+ expect(appRuntimeStateSource).toContain('aiIntelligenceStore.loadPendingApprovals()');
+ expect(appRuntimeStateSource).toContain('window.setInterval(refreshPatrolOpenWork, 30000)');
expect(appRuntimeStateSource).toContain(
"eventBus.on('theme_changed', handleRemoteThemeChange);",
);
diff --git a/frontend-modern/src/__tests__/AppLayout.test.tsx b/frontend-modern/src/__tests__/AppLayout.test.tsx
index 7da8791950..4b33f84280 100644
--- a/frontend-modern/src/__tests__/AppLayout.test.tsx
+++ b/frontend-modern/src/__tests__/AppLayout.test.tsx
@@ -8,9 +8,22 @@ import { aiChatStore } from '@/stores/aiChat';
HTMLElement.prototype.scrollIntoView = vi.fn();
+const aiIntelligenceMockState = vi.hoisted(() => ({
+ patrolOpenWorkCount: 0,
+}));
+
+vi.mock('@/stores/aiIntelligence', () => ({
+ aiIntelligenceStore: {
+ get patrolOpenWorkCount() {
+ return aiIntelligenceMockState.patrolOpenWorkCount;
+ },
+ },
+}));
+
describe('AppLayout navigation icons', () => {
beforeEach(() => {
window.history.replaceState({}, '', '/settings/infrastructure');
+ aiIntelligenceMockState.patrolOpenWorkCount = 0;
aiChatStore.close();
aiChatStore.setEnabled(true);
});
@@ -119,6 +132,30 @@ describe('AppLayout navigation icons', () => {
expect(container).toHaveTextContent('Infrastructure body');
});
+ it('surfaces Patrol open work as a count without renaming Patrol', () => {
+ aiIntelligenceMockState.patrolOpenWorkCount = 2;
+ renderLayout();
+
+ const desktopNav = screen.getByRole('tablist', { name: 'Primary navigation' });
+ const systemGroup = desktopNav.querySelector('[aria-label="System"]');
+ expect(systemGroup).toBeTruthy();
+
+ const desktopPatrolTab = within(systemGroup as HTMLElement).getByRole('tab', {
+ name: 'Patrol: 2 open work items',
+ });
+ expect(desktopPatrolTab).toHaveTextContent('Patrol');
+ expect(desktopPatrolTab).toHaveTextContent('2');
+ expect(within(systemGroup as HTMLElement).queryByText('Needs Attention')).toBeNull();
+
+ const mobileTablist = screen.getByRole('tablist', { name: 'Mobile navigation' });
+ const mobilePatrolTab = within(mobileTablist).getByRole('button', {
+ name: 'Patrol: 2 open work items',
+ });
+ expect(mobilePatrolTab).toHaveTextContent('Patrol');
+ expect(mobilePatrolTab).toHaveTextContent('2');
+ expect(within(mobileTablist).queryByText('Needs Attention')).toBeNull();
+ });
+
it('shows platform and runtime lens tabs with supported infrastructure evidence', () => {
renderLayout([
makeResource({ id: 'agent-1', type: 'agent', platformType: 'agent' }),
diff --git a/frontend-modern/src/components/shared/MobileNavBar.tsx b/frontend-modern/src/components/shared/MobileNavBar.tsx
index fa657a6b40..50ce6e1913 100644
--- a/frontend-modern/src/components/shared/MobileNavBar.tsx
+++ b/frontend-modern/src/components/shared/MobileNavBar.tsx
@@ -63,6 +63,8 @@ export function MobileNavBar(props: MobileNavBarProps) {
<For each={mobileNav.orderedUtilityTabs()}>
{(tab) => {
const alertBadges = () => getMobileNavAlertBadgeCounts(tab);
+ const genericCount = () =>
+ tab.id === 'alerts' || !tab.count || tab.count <= 0 ? null : tab.count;
const Icon = tab.icon;
return (
@@ -99,6 +101,16 @@ export function MobileNavBar(props: MobileNavBarProps) {
</span>
)}
</Show>
+ <Show when={genericCount()}>
+ {(count) => (
+ <span
+ aria-hidden="true"
+ class="absolute -right-2 -top-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-amber-200 px-1 text-[10px] font-semibold text-amber-900"
+ >
+ {count()}
+ </span>
+ )}
+ </Show>
</span>
<span class="whitespace-nowrap">{tab.label}</span>
<Show when={tab.badge === 'update'}>
diff --git a/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx b/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx
index 89692f44a1..02dff22f1b 100644
--- a/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx
@@ -83,6 +83,40 @@ describe('MobileNavBar', () => {
expect(within(navList).queryByRole('button', { name: 'Pulse Patrol Patrol' })).toBeNull();
});
+ it('renders Patrol open-work counts without renaming the mobile tab', () => {
+ render(() => (
+ <MobileNavBar
+ activeTab={() => 'ai'}
+ primaryTabs={() => []}
+ utilityTabs={() => [
+ {
+ id: 'ai',
+ label: 'Patrol',
+ route: '/patrol',
+ tooltip: 'Review Patrol checks, findings, and approvals',
+ badge: null,
+ count: 2,
+ countLabel: '2 open work items',
+ breakdown: undefined,
+ icon: PatrolIcon,
+ },
+ ]}
+ onPrimaryClick={() => {}}
+ onUtilityClick={() => {}}
+ />
+ ));
+
+ const navList = screen.getByRole('tablist', { name: 'Mobile navigation' });
+ const patrolButton = within(navList).getByRole('button', {
+ name: 'Patrol: 2 open work items',
+ });
+
+ expect(patrolButton).toHaveAttribute('data-tab-id', 'ai');
+ expect(within(patrolButton).getByText('Patrol')).toBeInTheDocument();
+ expect(within(patrolButton).getByText('2')).toBeInTheDocument();
+ expect(within(navList).queryByText('Needs Attention')).toBeNull();
+ });
+
it('allows inactive platform tabs to render without an active mobile tab', () => {
const { container } = render(() => (
<MobileNavBar
diff --git a/frontend-modern/src/components/shared/mobileNavBarModel.ts b/frontend-modern/src/components/shared/mobileNavBarModel.ts
index 085e79e231..a43e39ecab 100644
--- a/frontend-modern/src/components/shared/mobileNavBarModel.ts
+++ b/frontend-modern/src/components/shared/mobileNavBarModel.ts
@@ -22,6 +22,7 @@ export type MobileNavBarUtilityTab = {
tooltip: string;
badge: 'update' | 'pro' | null;
count: number | undefined;
+ countLabel?: string;
breakdown: { warning: number; critical: number } | undefined;
icon: MobileNavBarIcon;
};
@@ -91,7 +92,12 @@ export function getMobileNavAlertBadgeCounts(
export function getMobileNavTabAriaLabel(tab: MobileNavBarUtilityTab): string {
const badges = getMobileNavAlertBadgeCounts(tab);
- if (!badges) return tab.label;
+ if (!badges) {
+ if (tab.count && tab.count > 0) {
+ return `${tab.label}: ${tab.countLabel ?? `${tab.count} items`}`;
+ }
+ return tab.label;
+ }
const parts: string[] = [];
if (badges.critical > 0) {
parts.push(`${badges.critical} critical`);
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
index 9d9bed07ab..e0e4e27e13 100644
--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
@@ -143,6 +143,106 @@ describe('aiIntelligenceStore', () => {
});
});
+ it('counts open Patrol work from active findings and live Patrol approvals once', async () => {
+ vi.mocked(getPatrolFindings).mockResolvedValueOnce([
+ {
+ id: 'finding-active',
+ severity: 'warning',
+ category: 'reliability',
+ resource_id: 'instance:node:100',
+ resource_name: 'node-100',
+ resource_type: 'host',
+ title: 'Active Patrol issue',
+ description: 'Patrol found an active issue.',
+ detected_at: '2026-03-01T00:00:00Z',
+ last_seen_at: '2026-03-01T00:05:00Z',
+ auto_resolved: false,
+ times_raised: 1,
+ suppressed: false,
+ investigation_attempts: 0,
+ },
+ {
+ id: 'finding-approval',
+ severity: 'warning',
+ category: 'reliability',
+ resource_id: 'instance:node:101',
+ resource_name: 'node-101',
+ resource_type: 'host',
+ title: 'Queued Patrol fix',
+ description: 'Patrol needs approval.',
+ detected_at: '2026-03-01T00:00:00Z',
+ last_seen_at: '2026-03-01T00:05:00Z',
+ auto_resolved: false,
+ times_raised: 1,
+ suppressed: false,
+ investigation_attempts: 0,
+ },
+ {
+ id: 'finding-resolved',
+ severity: 'info',
+ category: 'reliability',
+ resource_id: 'instance:node:102',
+ resource_name: 'node-102',
+ resource_type: 'host',
+ title: 'Resolved Patrol issue',
+ description: 'Patrol already handled this issue.',
+ detected_at: '2026-03-01T00:00:00Z',
+ last_seen_at: '2026-03-01T00:05:00Z',
+ resolved_at: '2026-03-01T00:10:00Z',
+ auto_resolved: true,
+ times_raised: 1,
+ suppressed: false,
+ investigation_attempts: 1,
+ },
+ ]);
+ vi.mocked(AIAPI.getPendingApprovals).mockResolvedValueOnce([
+ {
+ id: 'approval-existing-finding',
+ toolId: 'investigation_fix',
+ command: 'systemctl restart pulse-agent',
+ targetType: 'host',
+ targetId: 'finding-approval',
+ targetName: 'node-101',
+ context: 'Restart the agent',
+ riskLevel: 'medium',
+ status: 'pending',
+ requestedAt: '2026-03-01T00:01:00Z',
+ expiresAt: approvalExpiryInMinutes(6),
+ },
+ {
+ id: 'approval-not-yet-loaded',
+ toolId: 'investigation_fix',
+ command: 'systemctl restart another-service',
+ targetType: 'host',
+ targetId: 'finding-approval-only',
+ targetName: 'node-103',
+ context: 'Restart another service',
+ riskLevel: 'medium',
+ status: 'pending',
+ requestedAt: '2026-03-01T00:01:00Z',
+ expiresAt: approvalExpiryInMinutes(6),
+ },
+ {
+ id: 'assistant-approval',
+ toolId: 'run_command',
+ command: 'apt upgrade',
+ targetType: 'host',
+ targetId: 'host-1',
+ targetName: 'node-1',
+ context: 'Assistant chat command',
+ riskLevel: 'high',
+ status: 'pending',
+ requestedAt: '2026-03-01T00:01:00Z',
+ expiresAt: approvalExpiryInMinutes(6),
+ },
+ ]);
+
+ await aiIntelligenceStore.loadPatrolFindings();
+ await aiIntelligenceStore.loadPendingApprovals();
+
+ expect(aiIntelligenceStore.patrolOpenWorkCount).toBe(3);
+ });
+
it('promotes auto_resolved to camelCase autoResolved on the unified-finding store record', async () => {
// The store-level UnifiedFinding is what render code reads when it asks
// "who closed this loop?" If the normalizer drops auto_resolved, the
diff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.ts
index 8a02f1af79..aeb1e6c56f 100644
--- a/frontend-modern/src/stores/aiIntelligence.ts
+++ b/frontend-modern/src/stores/aiIntelligence.ts
@@ -386,6 +386,20 @@ function getFindingsNeedingAttentionFor(findings: UnifiedFinding[]) {
);
}
+function getPatrolOpenWorkCount(): number {
+ const activeFindingIds = new Set(
+ patrolFindings()
+ .filter((finding) => finding.status === 'active')
+ .map((finding) => finding.id),
+ );
+ for (const approval of getLivePatrolPendingApprovals()) {
+ if (approval.targetId) {
+ activeFindingIds.add(approval.targetId);
+ }
+ }
+ return activeFindingIds.size;
+}
+
// ============================================
// Circuit Breaker
// ============================================
@@ -655,6 +669,9 @@ export const aiIntelligenceStore = {
get patrolNeedsAttentionCount() {
return this.patrolFindingsNeedingAttention.length;
},
+ get patrolOpenWorkCount() {
+ return getPatrolOpenWorkCount();
+ },
async loadPendingApprovals() {
setApprovalsError(null);
diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.ts
index c3403f3489..8a36a332c5 100644
--- a/frontend-modern/src/useAppRuntimeState.ts
+++ b/frontend-modern/src/useAppRuntimeState.ts
@@ -26,6 +26,7 @@ import { eventBus } from '@/stores/events';
import { showToast } from '@/utils/toast';
import { updateStore } from '@/stores/updates';
import { useAlertsActivation } from '@/stores/alertsActivation';
+import { aiIntelligenceStore } from '@/stores/aiIntelligence';
import {
applyThemeClass,
computeIsDark,
@@ -480,6 +481,24 @@ export const useAppRuntimeState = () => {
}
});
+ createEffect(() => {
+ const ready = !isLoading() && !needsAuth();
+ if (!ready) return;
+
+ const refreshPatrolOpenWork = () => {
+ void Promise.allSettled([
+ aiIntelligenceStore.loadPatrolFindings(),
+ aiIntelligenceStore.loadPendingApprovals(),
+ ]);
+ };
+
+ refreshPatrolOpenWork();
+ const interval = window.setInterval(refreshPatrolOpenWork, 30000);
+ onCleanup(() => {
+ window.clearInterval(interval);
+ });
+ });
+
createEffect(() => {
if (!hasAuth()) {
setBackendHealthy(false);
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index d0d7a7472a..93620a3147 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -2916,7 +2916,7 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 1067,
+ "line": 1074,
"heading_line": 136,
}
],