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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Load the Patrol setup panel only when setup is needed
rcourtman3d0ce604637a
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 7cc1cc44a4..230e3ed2a2 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -30,6 +30,8 @@ only when the cost model slows the untouched default), `POST/api/ai/patrol/model-guidance`, `GET /api/ai/patrol/cost-preview` and `POST/api/ai/patrol/readiness`, with the same meanings Provider & Models andPatrol settings rely on.+The panel loads on demand, so none of these requests is made until Patrol is+blocked and the operator starts setup.### Patrol autonomy reports the Pro defaultdiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex b257a2718b..a63101efec 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -27,6 +27,8 @@`InlineNotice`, and actions from `Button`. It adds no shared primitive; atphone width the cards stack two per row and the action buttons keep 44pxtargets.+The workspace mounts it through `lazy` and `Suspense` with no fallback, so the+setup card shows the panel once its chunk loads.### Patrol header default-mode notice uses existing primitivesdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 16f97b5eee..509844aef4 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -46,6 +46,9 @@ also routes the setup action to Provider & Models instead of the model check.`frontend-modern/src/features/patrol/__tests__/PatrolSetupPanel.render.test.tsx`,`frontend-modern/src/features/patrol/__tests__/patrolControlPresentation.test.ts`and `frontend-modern/src/utils/__tests__/patrolRuntimeActions.test.ts`.+The workspace loads `PatrolSetupPanel.tsx` lazily, passing the readiness+provider as `readinessProvider`, so the panel's AI settings, provider and cost+code stays out of the `AIIntelligence` chunk and its bundle budget.### Pro default notice and the not-running headerdiff --git a/frontend-modern/browser-verification/5d8bee2727a5ddd6.json b/frontend-modern/browser-verification/5d8bee2727a5ddd6.jsonnew file mode 100644index 0000000000..0941fcb5d7--- /dev/null+++ b/frontend-modern/browser-verification/5d8bee2727a5ddd6.json@@ -0,0 +1,41 @@+{+ "version": 1,+ "base_sha": "159db4ba3cb17533e18ff96d0a1202746948c0bc",+ "verified_at": "2026-10-12T22:10:00Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx",+ "frontend-modern/src/features/patrol/PatrolSetupPanel.tsx"+ ],+ "content_sha256": {+ "frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx": "ef823bc4eb881408bf70e77d97f94996d07c4f98b99cff19ab7133b7a15a0df5",+ "frontend-modern/src/features/patrol/PatrolSetupPanel.tsx": "2125b7ce81958de98ebd46a8e7db19fdaf28d6c85cd0f724238c5b42b3b5fc55"+ },+ "routes": [+ "/patrol"+ ],+ "viewports": [+ {+ "width": 1280,+ "height": 900+ },+ {+ "width": 375,+ "height": 812+ }+ ],+ "states": [+ "Fresh Pro install, no provider: the lazily loaded setup panel renders inside the setup card with Anthropic preselected and 'About $7.62 a month ... every 12 hours' from the live cost preview",+ "Refused Gemini test key saved, then reload (readiness cause provider_auth, provider gemini): panel renders with Gemini preselected from the readiness provider, label 'Google Gemini API key', subtitle 'Your AI provider refused Patrol's connection. Reconnect it so Patrol can run.', cost 'About $5.11 a month ... every 6 hours'",+ "Phone width: no horizontal overflow, Connect and check 44px"+ ],+ "interactions": [+ "Gemini card, invalid test key, Connect and check: 'Google Gemini did not accept the connection: ... Check the API key and connect again.'",+ "Reload re-mounts the lazy panel from the readiness provider"+ ],+ "browser": {+ "client": "Claude desktop browser pane",+ "engine": "Chromium"+ },+ "scope": "Dev server on the PR branch plus this change, proxied to a private non-mock pulse-enterprise stack on :7681 with a dev Pro licence. Bundle split checked separately with a production build on pulse-dev: AIIntelligence 70.38 kB gzip (main 69.89 kB, max 70.86 kB)."+}diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsxindex b4eca86920..e45988ff4f 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx@@ -1,4 +1,4 @@-import { createMemo, createSignal, For, Show } from 'solid-js';+import { createMemo, createSignal, For, lazy, Show, Suspense } from 'solid-js';import HistoryIcon from 'lucide-solid/icons/history';import SettingsIcon from 'lucide-solid/icons/settings';import ShieldAlertIcon from 'lucide-solid/icons/shield-alert';@@ -27,8 +27,7 @@ import {getPatrolSetupHint,isPatrolConnectCause,} from '@/utils/patrolRuntimeActions';-import { PatrolSetupPanel } from './PatrolSetupPanel';-import { getPatrolSetupInitialProvider } from './patrolSetupModel';+import {getPatrolProInvestigationHandoff,getPatrolWatchOnlyInvestigationNudge,@@ -54,6 +53,11 @@ import {presentationPolicyHidesUpgradePrompts,} from '@/stores/sessionPresentationPolicy';+// Only an install that cannot run Patrol needs the setup panel and the AI+// settings, provider and cost code it brings, so it loads on demand and stays+// out of the Patrol page chunk.+const PatrolSetupPanel = lazy(() => import('./PatrolSetupPanel'));+export function PatrolIntelligenceWorkspace(props: {state: PatrolIntelligenceState;findingResourceId?: string;@@ -353,21 +357,21 @@ export function PatrolIntelligenceWorkspace(props: {}><div class="mt-4">- <PatrolSetupPanel- initialProvider={getPatrolSetupInitialProvider(- state.patrolReadiness()?.provider,- )}- onStart={() => setSetupPanelActive(true)}- onDone={() => {- setSetupPanelActive(false);- void state.handleRefreshPatrol();- }}- onRunPatrol={() => {- setSetupPanelActive(false);- // Readiness must be re-read before the run gate opens.- void state.handleRefreshPatrol().then(() => state.handleRunPatrol());- }}- />+ <Suspense fallback={null}>+ <PatrolSetupPanel+ readinessProvider={state.patrolReadiness()?.provider}+ onStart={() => setSetupPanelActive(true)}+ onDone={() => {+ setSetupPanelActive(false);+ void state.handleRefreshPatrol();+ }}+ onRunPatrol={() => {+ setSetupPanelActive(false);+ // Readiness must be re-read before the run gate opens.+ void state.handleRefreshPatrol().then(() => state.handleRunPatrol());+ }}+ />+ </Suspense></div></Show></div>diff --git a/frontend-modern/src/features/patrol/PatrolSetupPanel.tsx b/frontend-modern/src/features/patrol/PatrolSetupPanel.tsxindex 31ed544d93..f67a3dba9e 100644--- a/frontend-modern/src/features/patrol/PatrolSetupPanel.tsx+++ b/frontend-modern/src/features/patrol/PatrolSetupPanel.tsx@@ -20,6 +20,7 @@ import {buildPatrolSetupModelRequest,getPatrolSetupCheckVerdict,getPatrolSetupCostLine,+ getPatrolSetupInitialProvider,getPatrolSetupIntervalAdjust,getPatrolSetupNoModelMessage,getPatrolSetupOllamaHint,@@ -37,8 +38,8 @@ const errorText = (error: unknown, fallback: string) =>error instanceof Error && error.message.trim() ? error.message.trim() : fallback;export function PatrolSetupPanel(props: {- /** Provider to start on, such as the one whose key was refused. */- initialProvider?: PatrolSetupProvider;+ /** Provider Patrol readiness names, such as the one whose key was refused. */+ readinessProvider?: string;/** Keep the panel mounted while setup runs, whatever polling reports. */onStart: () => void;/** Re-read Patrol state once setup is finished. */@@ -47,7 +48,7 @@ export function PatrolSetupPanel(props: {onRunPatrol: () => void;}) {const [provider, setProvider] = createSignal<PatrolSetupProvider>(- props.initialProvider ?? 'anthropic',+ getPatrolSetupInitialProvider(props.readinessProvider),);const [apiKey, setApiKey] = createSignal('');const [ollamaUrl, setOllamaUrl] = createSignal(PATROL_SETUP_DEFAULT_OLLAMA_URL);@@ -298,3 +299,5 @@ export function PatrolSetupPanel(props: {</div>);}++export default PatrolSetupPanel;diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.tsindex 430eba5e6e..a680b778ff 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts@@ -32,7 +32,10 @@ describe('PatrolIntelligenceWorkspace trust strip', () => {'when={setupPanelActive() || isPatrolConnectCause(setupCause())}',);expect(workspaceSource).toContain('<PatrolSetupPanel');- expect(workspaceSource).toContain('getPatrolSetupInitialProvider(');+ expect(workspaceSource).toContain(+ "const PatrolSetupPanel = lazy(() => import('./PatrolSetupPanel'));",+ );+ expect(workspaceSource).toContain('readinessProvider={state.patrolReadiness()?.provider}');expect(workspaceSource).toContain('(state.shouldShowPatrolSetupOnly() || setupPanelActive())');// The first run waits for readiness to be re-read, or the run gate stays shut.expect(workspaceSource).toContain(diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolSetupPanel.render.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolSetupPanel.render.test.tsxindex 62b5ad1d19..e2d5631480 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolSetupPanel.render.test.tsx+++ b/frontend-modern/src/features/patrol/__tests__/PatrolSetupPanel.render.test.tsx@@ -50,9 +50,9 @@ const haikuProjection = {const settings = (overrides: Partial<AISettings> = {}) =>({ enabled: true, model: '', patrol_interval_minutes: 360, ...overrides }) as AISettings;-const renderPanel = () => {+const renderPanel = (readinessProvider?: string) => {const props = { onStart: vi.fn(), onDone: vi.fn(), onRunPatrol: vi.fn() };- render(() => <PatrolSetupPanel {...props} />);+ render(() => <PatrolSetupPanel readinessProvider={readinessProvider} {...props} />);return props;};@@ -94,6 +94,15 @@ describe('PatrolSetupPanel', () => {expect(mocks.updateSettings).not.toHaveBeenCalled();});+ it('starts on the provider Patrol readiness names, such as the one whose key was refused', async () => {+ renderPanel('gemini');+ expect(await screen.findByRole('button', { name: /Gemini/ })).toHaveAttribute(+ 'aria-pressed',+ 'true',+ );+ expect(screen.getByLabelText('Google Gemini API key')).toBeInTheDocument();+ });+it('connects, picks and saves the guided model, checks it, and offers the first run', async () => {mocks.updateSettings.mockResolvedValueOnce(settings())