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
Add Patrol runtime settings action to run history
rcourtmand891632bd632
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 05dba4a6cb..edf0885d3a 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -485,7 +485,7 @@ the canonical monitored-system blocked payload.and the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` card, so learned correlations and correlation context stay rendered through one governed frontend card instead of separate page-local list loopsand the same shared correlation card's ordering and truncation rule, so callers pass raw correlations instead of encoding their own top-N sort behaviorand the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` cards' infrastructure resource-link default, so the Patrol page, resource drawer, and problem-resource dashboard panels inherit the canonical resource-filter path construction instead of rebuilding infrastructure URLs inline- and the Patrol runtime-remediation destination shared with the AI settings endpoint, so summary actions and runtime-finding actions may reuse the governed provider-settings route while still presenting that destination to Patrol operators as Patrol provider configuration instead of generic `AI Settings` copy+ and the Patrol runtime-remediation destination shared with the AI settings endpoint, so summary actions, run-history runtime-failure actions, and runtime-finding actions may reuse the governed provider-settings route while still presenting that destination to Patrol operators as Patrol provider configuration instead of generic `AI Settings` copyand the Patrol route-shell destination itself, so the thin page shell at `frontend-modern/src/pages/AIIntelligence.tsx` may continue to bridge the shared AI-runtime payload boundary while exposing `/patrol` as the canonical product route and preserving `/ai` only as a compatibility redirectand the Patrol route-shell accessibility boundary, so brand icons in `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx` stay decorative when the same heading already exposes visible Patrol text, preventing duplicate accessible names such as `Pulse Patrol Patrol`9. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 951b90303d..ed0d0b8998 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -684,7 +684,8 @@ frontend primitive boundary.`frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`,`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`,`frontend-modern/src/features/patrol/patrolSupportingContextPresentation.ts`,- and `frontend-modern/src/components/patrol/PatrolStatusBar.tsx` must keep+ `frontend-modern/src/components/patrol/PatrolStatusBar.tsx`, and+ `frontend-modern/src/utils/patrolRuntimeActions.ts` must keepPatrol assessment, verification, and findings primary; surface recentchanges, learned correlations, and policy coverage only as explicitlysecondary supporting context when degraded or incomplete verification,@@ -2305,11 +2306,13 @@ controls, and `frontend-modern/src/components/patrol/PatrolStatusBar.tsx`should render compact activity breakdown and scoped-trigger-state copy from theshared transport rather than leaving busy Patrol periods as unexplained noise.That same Patrol-facing primitive vocabulary must stay product-first. Patrol-summary actions, runtime banners, circuit-breaker copy, and Patrol-configuration controls may point at the shared provider settings route or model-catalog, but they should describe those controls as Patrol/provider surfaces-rather than falling back to generic `AI Settings`, `AI Model`, or `AI circuit-breaker` copy inside the Patrol shell itself.+summary actions, runtime banners, run-history runtime-failure actions,+runtime-finding actions, circuit-breaker copy, and Patrol configuration controls+may point at the shared provider settings route or model catalog, but they+should describe those controls as Patrol/provider surfaces through+`frontend-modern/src/utils/patrolRuntimeActions.ts` rather than falling back to+generic `AI Settings`, `AI Model`, or `AI circuit breaker` copy inside the+Patrol shell itself.That same product-first naming rule also applies to the shared `system-ai`settings shell: `frontend-modern/src/components/Settings/AISettings.tsx`,`frontend-modern/src/components/Settings/settingsHeaderMeta.ts`,diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 28f4da9ec5..2e7d81d31f 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -45,8 +45,9 @@ Patrol-specific presentation helpers.22. `frontend-modern/src/utils/patrolRunPresentation.ts`23. `frontend-modern/src/utils/patrolSummaryPresentation.ts`24. `frontend-modern/src/utils/patrolRuntimePresentation.ts`-25. `frontend-modern/src/utils/textPresentation.ts`-26. `tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts`+25. `frontend-modern/src/utils/patrolRuntimeActions.ts`+26. `frontend-modern/src/utils/textPresentation.ts`+27. `tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts`## Shared Boundaries@@ -57,7 +58,7 @@ Patrol-specific presentation helpers.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` together2. Add or change Patrol findings, approvals, investigation, or run-history presentation through `frontend-modern/src/components/AI/FindingsPanel.tsx` and `frontend-modern/src/components/patrol/`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`+4. Add or change Patrol header, summary, status runtime-state presentation, or runtime provider action presentation through `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`, `frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx`, `frontend-modern/src/components/patrol/PatrolStatusBar.tsx`, `frontend-modern/src/utils/patrolRuntimePresentation.ts`, and `frontend-modern/src/utils/patrolRuntimeActions.ts`5. Add or change Patrol header schedule and runtime presentation through `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`, `frontend-modern/src/utils/aiPatrolSchedulePresentation.ts`, and `frontend-modern/src/utils/patrolRuntimePresentation.ts`.Patrol must not surface retired hosted-model credit badges or trial-like activation prompts in the normal self-hosted GA app, even when legacy transport fields are still present.6. Keep Patrol and chat identifier-label presentation aligned through the shared `frontend-modern/src/utils/textPresentation.ts`@@ -455,10 +456,10 @@ infrastructure severity chip like `warning` with a second Patrol-runtimelabel.Patrol run history must follow the same operator-facing runtime failurecontract. Expanded erroring runs should show the backend-provided-`error_summary` and bounded `error_detail` near the run narrative, so a-provider/model/tool failure remains actionable even when the operator starts-from the Runs tab rather than the synthetic runtime finding.-classification badge.+`error_summary`, bounded `error_detail`, and the shared direct `Open Patrol+provider settings` action near the run narrative, so a provider/model/tool+failure remains actionable even when the operator starts from the Runs tab+rather than the synthetic runtime finding.That same shared finding-presentation helper should also own Patrol findingsubject labels, so Patrol-owned synthetic service findings render as`Patrol runtime` rather than leaking backend resource internals likediff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 6c970b7bef..5b60c16f3f 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -4077,6 +4077,7 @@"frontend-modern/src/utils/patrolEmptyStatePresentation.ts","frontend-modern/src/utils/patrolFormat.ts","frontend-modern/src/utils/patrolRunPresentation.ts",+ "frontend-modern/src/utils/patrolRuntimeActions.ts","frontend-modern/src/utils/patrolRuntimePresentation.ts","frontend-modern/src/utils/patrolSummaryPresentation.ts","frontend-modern/src/utils/remediationPresentation.ts"@@ -4167,6 +4168,24 @@"frontend-modern/src/utils/__tests__/remediationPresentation.test.ts"]},+ {+ "id": "patrol-runtime-action-presentation",+ "label": "patrol runtime action presentation proof",+ "match_prefixes": [],+ "match_files": [+ "frontend-modern/src/utils/patrolRuntimeActions.ts"+ ],+ "allow_same_subsystem_tests": false,+ "test_prefixes": [],+ "exact_files": [+ "frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts",+ "frontend-modern/src/components/patrol/__tests__/RunHistoryEntry.test.tsx",+ "frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts",+ "frontend-modern/src/utils/__tests__/patrolRuntimeActions.test.ts",+ "frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts",+ "tests/integration/tests/18-patrol-runtime-state.spec.ts"+ ]+ },{"id": "patrol-history-and-summary","label": "patrol history and summary proof",diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.tsindex a58e75abaf..52b6a269cf 100644--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts@@ -35,6 +35,7 @@ import {getInvestigationStatusBadgeClasses,doesFindingNeedAttention,} from '@/utils/aiFindingPresentation';+import { PATROL_PROVIDER_SETTINGS_ACTION } from '@/utils/patrolRuntimeActions';const findingsPanelSource = readFileSync(resolve(__dirname, '..', 'FindingsPanel.tsx'), 'utf-8');const patrolWorkspaceSource = readFileSync(@@ -342,10 +343,7 @@ describe('aiFindingPresentation', () => {resourceName: 'Pulse Patrol Service',title: 'Pulse Patrol: Provider billing or quota issue',}),- ).toEqual({- label: 'Open Patrol provider settings',- href: '/settings/system-ai',- });+ ).toEqual(PATROL_PROVIDER_SETTINGS_ACTION);});it('does not expose Patrol provider settings as the primary action for infrastructure findings', () => {@@ -365,10 +363,7 @@ describe('aiFindingPresentation', () => {resourceName: 'Pulse Patrol Service',title: 'Provider billing or quota issue',}),- ).toEqual({- label: 'Open Patrol provider settings',- href: '/settings/system-ai',- });+ ).toEqual(PATROL_PROVIDER_SETTINGS_ACTION);});});diff --git a/frontend-modern/src/components/patrol/RunHistoryEntry.tsx b/frontend-modern/src/components/patrol/RunHistoryEntry.tsxindex 66f20914ad..5cd819767a 100644--- a/frontend-modern/src/components/patrol/RunHistoryEntry.tsx+++ b/frontend-modern/src/components/patrol/RunHistoryEntry.tsx@@ -17,6 +17,7 @@ import { formatRelativeTime } from '@/utils/format';import {getPatrolRunCoverageSummary,getPatrolRunResourcesHeading,+ getPatrolRunPrimaryActionPresentation,getPatrolRunStatusPresentation,isPatrolRunHealthy,} from '@/utils/patrolRunPresentation';@@ -41,6 +42,7 @@ import SparklesIcon from 'lucide-solid/icons/sparkles';import MailIcon from 'lucide-solid/icons/mail';import RefreshCwIcon from 'lucide-solid/icons/refresh-cw';import MessageSquareIcon from 'lucide-solid/icons/message-square';+import SettingsIcon from 'lucide-solid/icons/settings';interface PatrolStreamState {phase: Accessor<string>;@@ -163,6 +165,7 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {const runErrorSummary = String(run.error_summary || '').trim();const runErrorDetail = String(run.error_detail || '').trim();const hasRunErrorDetail = run.error_count > 0 && (runErrorSummary || runErrorDetail);+ const primaryAction = getPatrolRunPrimaryActionPresentation(run);const handleDiscussRun = (event: Event) => {event.stopPropagation();const handoff = buildPatrolRunAssistantHandoff(run);@@ -307,6 +310,17 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {{runErrorDetail}</p></Show>+ <Show when={primaryAction}>+ {(action) => (+ <a+ href={action().href}+ class="mt-2 inline-flex items-center gap-1.5 rounded-md border border-red-200 bg-white px-2.5 py-1.5 text-xs font-semibold text-red-800 transition-colors hover:bg-red-100 dark:border-red-800 dark:bg-red-950 dark:text-red-100 dark:hover:bg-red-900"+ >+ <SettingsIcon class="h-3.5 w-3.5" aria-hidden="true" />+ <span>{action().label}</span>+ </a>+ )}+ </Show></div></div></Show>diff --git a/frontend-modern/src/components/patrol/__tests__/RunHistoryEntry.test.tsx b/frontend-modern/src/components/patrol/__tests__/RunHistoryEntry.test.tsxindex b89e084415..272fd62616 100644--- a/frontend-modern/src/components/patrol/__tests__/RunHistoryEntry.test.tsx+++ b/frontend-modern/src/components/patrol/__tests__/RunHistoryEntry.test.tsx@@ -225,6 +225,29 @@ describe('RunHistoryEntry', () => {expect(screen.getByText('Selected model does not support Patrol tools')).toBeInTheDocument();expect(screen.getByText(/tool_choice/)).toBeInTheDocument();expect(screen.getByText('error')).toBeInTheDocument();+ expect(screen.getByRole('link', { name: 'Open Patrol provider settings' })).toHaveAttribute(+ 'href',+ '/settings/system-ai',+ );+ });++ it('does not show provider settings for healthy runs', () => {+ render(() => (+ <RunHistoryEntry+ run={{+ ...run,+ id: 'run-healthy',+ error_count: 0,+ status: 'healthy',+ }}+ isLive={false}+ patrolStream={patrolStream}+ selected={true}+ onSelect={vi.fn()}+ />+ ));++ expect(screen.queryByRole('link', { name: 'Open Patrol provider settings' })).toBeNull();});it('opens Assistant with structured run history context', () => {diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsxindex 74bbad138d..0d0d6d25bb 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx@@ -3,6 +3,7 @@ import ShieldAlertIcon from 'lucide-solid/icons/shield-alert';import SettingsIcon from 'lucide-solid/icons/settings';import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';import { formatRelativeTime } from '@/utils/format';+import { PATROL_PROVIDER_SETTINGS_ACTION } from '@/utils/patrolRuntimeActions';import type { PatrolIntelligenceState } from './usePatrolIntelligenceState';export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceState }) {@@ -44,8 +45,8 @@ export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceStat<div class="flex-shrink-0 bg-blue-50 dark:bg-blue-900 border-b border-blue-200 dark:border-blue-800 px-3 py-2"><div class="flex flex-wrap items-center justify-between gap-2"><p class="text-xs text-blue-700 dark:text-blue-300">- Safe remediation workflows and alert-triggered root-cause analysis are not enabled- on this plan.+ Safe remediation workflows and alert-triggered root-cause analysis are not enabled on+ this plan.</p></div></div>@@ -62,9 +63,7 @@ export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceStat<p class="text-sm font-semibold text-amber-900 dark:text-amber-100">Patrol paused</p>- <p class="text-xs text-amber-700 dark:text-amber-300">- {state.blockedReason()}- </p>+ <p class="text-xs text-amber-700 dark:text-amber-300">{state.blockedReason()}</p><Show when={state.blockedAt()}><p class="text-[10px] text-amber-700 dark:text-amber-300">Blocked {formatRelativeTime(state.blockedAt(), { compact: true })}@@ -74,11 +73,11 @@ export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceStat</div><div class="flex items-center gap-2"><a- href="/settings/system-ai"+ href={PATROL_PROVIDER_SETTINGS_ACTION.href}class="inline-flex items-center justify-center gap-2 px-3 py-1.5 text-xs font-semibold text-amber-900 dark:text-amber-100 bg-amber-100 dark:bg-amber-900 border border-amber-200 dark:border-amber-700 rounded-md hover:bg-amber-200 dark:hover:bg-amber-900 transition-colors"><SettingsIcon class="w-3.5 h-3.5" />- Open Patrol provider settings+ {PATROL_PROVIDER_SETTINGS_ACTION.label}</a></div></div>diff --git a/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.tsindex 01fa0ede6d..aa749b9e10 100644--- a/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts@@ -6,6 +6,7 @@ import {getPatrolLatestRunPresentation,getPatrolRunKindLabel,getPatrolRunCoverageSummary,+ getPatrolRunPrimaryActionPresentation,getPatrolRunResourcesHeading,getPatrolRunStatusPresentation,getPatrolTriggerStatusSummary,@@ -72,6 +73,33 @@ describe('patrolRunPresentation', () => {expect(isPatrolRunHealthy('healthy', 1)).toBe(false);});+ it('offers Patrol provider settings for runtime-failed runs only', () => {+ expect(+ getPatrolRunPrimaryActionPresentation({+ error_count: 1,+ error_summary: 'Selected model does not support Patrol tools',+ error_detail: 'Provider rejected tool_choice',+ }),+ ).toEqual({+ label: 'Open Patrol provider settings',+ href: '/settings/system-ai',+ });+ expect(+ getPatrolRunPrimaryActionPresentation({+ error_count: 0,+ error_summary: '',+ error_detail: '',+ }),+ ).toBeUndefined();+ expect(+ getPatrolRunPrimaryActionPresentation({+ error_count: 1,+ error_summary: '',+ error_detail: '',+ }),+ ).toBeUndefined();+ });+it('normalizes unknown status labels safely', () => {const presentation = getPatrolRunStatusPresentation(' Needs Review ');expect(presentation.label).toBe('needs review');diff --git a/frontend-modern/src/utils/__tests__/patrolRuntimeActions.test.ts b/frontend-modern/src/utils/__tests__/patrolRuntimeActions.test.tsnew file mode 100644index 0000000000..88a1e65746--- /dev/null+++ b/frontend-modern/src/utils/__tests__/patrolRuntimeActions.test.ts@@ -0,0 +1,18 @@+import { describe, expect, it } from 'vitest';+import {+ getPatrolProviderSettingsAction,+ PATROL_PROVIDER_SETTINGS_ACTION,+} from '@/utils/patrolRuntimeActions';++describe('patrolRuntimeActions', () => {+ it('centralizes the Patrol provider settings action', () => {+ expect(PATROL_PROVIDER_SETTINGS_ACTION).toEqual({+ label: 'Open Patrol provider settings',+ href: '/settings/system-ai',+ });++ const action = getPatrolProviderSettingsAction();+ expect(action).toEqual(PATROL_PROVIDER_SETTINGS_ACTION);+ expect(action).not.toBe(PATROL_PROVIDER_SETTINGS_ACTION);+ });+});diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.tsindex 674a5171f8..5c631ee149 100644--- a/frontend-modern/src/utils/aiFindingPresentation.ts+++ b/frontend-modern/src/utils/aiFindingPresentation.ts@@ -2,6 +2,7 @@ import type { UnifiedFinding } from '@/stores/aiIntelligence';import type { ApprovalRequest } from '@/api/ai';import type { InvestigationOutcome, InvestigationStatus } from '@/api/patrol';import { isLivePendingApproval } from '@/utils/approvalState';+import { getPatrolProviderSettingsAction } from '@/utils/patrolRuntimeActions';import { formatIdentifierLabel } from '@/utils/textPresentation';const DEFAULT_BADGE_CLASSES = 'border-border bg-surface-alt text-muted';@@ -443,10 +444,7 @@ export const getFindingPrimaryActionPresentation = (finding: Pick<UnifiedFinding, 'resourceId' | 'resourceName' | 'title'>,): FindingPrimaryActionPresentation | undefined => {if (isPatrolRuntimeFinding(finding)) {- return {- label: 'Open Patrol provider settings',- href: '/settings/system-ai',- };+ return getPatrolProviderSettingsAction();}return undefined;diff --git a/frontend-modern/src/utils/patrolRunPresentation.ts b/frontend-modern/src/utils/patrolRunPresentation.tsindex 5d17a81039..2ab499f832 100644--- a/frontend-modern/src/utils/patrolRunPresentation.ts+++ b/frontend-modern/src/utils/patrolRunPresentation.ts@@ -1,6 +1,10 @@import type { PatrolRunRecord, PatrolRunStatus, PatrolTriggerStatus } from '@/api/patrol';import { formatIdentifierLabel } from '@/utils/textPresentation';import { getCanonicalScopeResourceIds } from '@/utils/patrolFormat';+import {+ getPatrolProviderSettingsAction,+ type PatrolRuntimeActionPresentation,+} from '@/utils/patrolRuntimeActions';export interface PatrolRunStatusPresentation {badgeClass: string;@@ -26,6 +30,8 @@ export interface PatrolActivityBreakdown {newFindings: number;}+export type PatrolRunPrimaryActionPresentation = PatrolRuntimeActionPresentation;+function formatResourceCount(count: number, qualifier?: string): string {const normalized = Math.max(0, count || 0);const qualifierPrefix = qualifier ? `${qualifier} ` : '';@@ -75,6 +81,22 @@ export function isPatrolRunHealthy(return getEffectivePatrolRunStatus(status, errorCount) === 'healthy';}+export function getPatrolRunPrimaryActionPresentation(+ run: Pick<PatrolRunRecord, 'error_count' | 'error_summary' | 'error_detail'>,+): PatrolRunPrimaryActionPresentation | undefined {+ const hasRuntimeFailureDetail = Boolean(+ String(run.error_summary || '').trim() || String(run.error_detail || '').trim(),+ );+ if (Math.max(0, run.error_count || 0) <= 0) {+ return undefined;+ }+ if (!hasRuntimeFailureDetail) {+ return undefined;+ }++ return getPatrolProviderSettingsAction();+}+export function getPatrolRunStatusPresentation(status: PatrolRunStatus | string,errorCount: number = 0,diff --git a/frontend-modern/src/utils/patrolRuntimeActions.ts b/frontend-modern/src/utils/patrolRuntimeActions.tsnew file mode 100644index 0000000000..550c001acd--- /dev/null+++ b/frontend-modern/src/utils/patrolRuntimeActions.ts@@ -0,0 +1,13 @@+export interface PatrolRuntimeActionPresentation {+ label: string;+ href: string;+}++export const PATROL_PROVIDER_SETTINGS_ACTION: PatrolRuntimeActionPresentation = {+ label: 'Open Patrol provider settings',+ href: '/settings/system-ai',+};++export const getPatrolProviderSettingsAction = (): PatrolRuntimeActionPresentation => ({+ ...PATROL_PROVIDER_SETTINGS_ACTION,+});diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.tsindex de67fad25b..0d2c3e2db4 100644--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts@@ -9,6 +9,7 @@ import {formatPatrolActivityBreakdown,getPatrolActivityBreakdown,} from '@/utils/patrolRunPresentation';+import { getPatrolProviderSettingsAction } from '@/utils/patrolRuntimeActions';import type { SemanticTone } from '@/utils/semanticTonePresentation';import { getPatrolRuntimePresentation } from '@/utils/patrolRuntimePresentation';@@ -255,10 +256,7 @@ export function getPatrolAssessmentAction(args: {}): PatrolAssessmentAction | undefined {const classified = classifyActiveFindings(args.activeFindings);if (classified.infrastructureTotal === 0 && classified.runtimeTotal > 0) {- return {- label: 'Open Patrol provider settings',- href: '/settings/system-ai',- };+ return getPatrolProviderSettingsAction();}return undefined;diff --git a/tests/integration/tests/18-patrol-runtime-state.spec.ts b/tests/integration/tests/18-patrol-runtime-state.spec.tsindex ac400dc09f..b66826b662 100644--- a/tests/integration/tests/18-patrol-runtime-state.spec.ts+++ b/tests/integration/tests/18-patrol-runtime-state.spec.ts@@ -682,6 +682,9 @@ test.describe("Patrol runtime-state browser contract", () => {page.getByText("Selected model does not support Patrol tools"),).toBeVisible();await expect(page.getByText(/tool_choice/)).toBeVisible();+ await expect(+ page.getByRole("link", { name: "Open Patrol provider settings" }),+ ).toHaveAttribute("href", "/settings/system-ai");await page.getByTestId("patrol-run-assistant-button").click();const assistantContext = page.getByLabel("Assistant context");