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.

Group Patrol work signals in the workbench

rcourtman9ba5cf1e0f39
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 a664165a26..76f6eb73cf 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
@@ -116,6 +116,12 @@ loop, and routes the operator from real findings/evidence to safe action.
alert cards now lead with `Have Patrol investigate`, which starts the scoped
manual Patrol check, while Assistant stays available as the secondary
read-only explanation path with the alert context attached.
+- 2026-06-30: Added Patrol-owned work grouping inside the `Open work` workspace
+ for current signals that are not captured by a single finding title:
+ approvals awaiting decisions, failed governed actions, failed latest checks,
+ recurring active issues, and overdue scheduled protection. The grouping stays
+ inside Patrol and does not replace issue rows, approvals, verification, or
+ contextual Assistant handoffs.
## Evidence
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index b8fcf36396..3a22fa2710 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -1809,6 +1809,11 @@ a new API state machine, queue contract, or verification-accounting field.
instance-scoped style.
8. Route unified-agent installer and binary download headers through `internal/api/unified_agent.go` and `internal/api/contract_test.go` together. Unified-agent BINARY downloads must keep the canonical `X-Checksum-Sha256` plus `X-Signature-Ed25519` contract for updater clients whether the binary is served locally or proxied from the matching GitHub release, instead of leaving callers to infer trust from source location alone. The served install-script endpoints (GET /install.sh and /install.ps1) are governed differently and have NO GitHub fallback at all: they serve the locally bundled AGENT installer or fail closed with 503. The agent installer is a per-build artifact bundled into every release tarball and Docker image, not a release asset, so the endpoint must never fetch the top-level GitHub install.sh release asset (the SERVER installer, which rejects the agent wizard's --url / --token-file, issue #1470). It attaches the base64-encoded `X-Signature-SSHSIG` header when the local detached signatures are present and omits it when they are not; a present-but-unsigned local agent installer is still served, because the agent install path (curl piped into bash) does not verify these headers, so correctness of the served script outranks signature presence.
9. Route canonical AI intelligence summary and resource-intelligence reads through `frontend-modern/src/api/ai.ts`, `frontend-modern/src/stores/aiIntelligence.ts`, `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts`, `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx`, the Patrol-owned section files under `frontend-modern/src/features/patrol/`, `frontend-modern/src/pages/AIIntelligence.tsx`, `internal/api/ai_handlers.go`, and `internal/api/contract_test.go` together so the store normalization owner, runtime hook, feature shell, Current work workspace, section owners, route shell, and backend payload stay aligned on one governed surface, including the canonical recent-changes slice
+ and the Patrol work-group inputs, where the browser may group current
+ approvals, failed actions, failed checks, recurring active issues, and
+ overdue scheduled protection only from API-owned Patrol status, run history,
+ approval state, and finding-composition facts rather than page-local
+ inference
while keeping the learning counters backend-only coverage, so Patrol keeps health and findings primary and renders timeline, correlation, and policy-posture data as selected-item investigation context rather than as a separate headline product metric
and that secondary investigation context remains explanatory API evidence,
not a default workspace mode: the Patrol page may expand recent-change,
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 4abfe020d0..93d4afa210 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -90,7 +90,7 @@ work extends shared components instead of creating new local variants.
59b. `frontend-modern/src/components/shared/FilterBar/useSavedViews.ts`
59c. `frontend-modern/src/components/shared/FilterBar/filterOptionPresentation.tsx`
60. `frontend-modern/src/components/shared/TypeColumn.guardrails.test.ts`
-61. `frontend-modern/src/features/` (including Patrol presentation, where Patrol control starter counts are context only even when mirrored through `patrolAutonomy*` compatibility fields, successful direct Patrol control saves may record the content-free `patrol_control` starter only when paid control is available and the effective control posture changes and must then refresh Patrol status, findings, approvals, and run history before the operator waits for polling, legacy `proActivation*` starter aliases must not render a separate proof strip by themselves, Patrol control completed/resolved counts may only project backend-owned terminal proof, current active findings and pending approvals outrank historical completion proof in the primary operator state, selected run history must read as a Patrol run record rather than a findings filter or snapshot workflow, terminal verified/rejected outcomes with no active finding or pending approval must stay history detail without rendering a no-op proof strip, resolved-only issue history must not be promoted into current-work copy or actions, compact recurrence/trust counters must read as historical evidence rather than current issue state, Patrol-owned status/history evidence must keep the assessment visible when the broader intelligence summary is missing, the Patrol route and page title must lead with Patrol while the default workspace underneath may use Open work and run history stays a deliberate secondary review surface, setup-only Patrol runtime failures must instead use `Fix Patrol setup` framing with a dedicated setup task and direct provider-settings action while suppressing generic issue-row chips and filter chrome, Patrol must not expose a generic Details/supporting-context panel for nearby activity, related patterns, or policy limits, locked-control copy must state the watch-only boundary in positive capability language by saying Patrol checks infrastructure and shows current issues, avoid repeating the same sentence across the header and control, and avoid repeatedly restating infrastructure-unchanged caveats or relying on disabled controls, compact Pro badges, Limits controls, or manual-review framing, `patrolControlValueState` decides whether a terminal decision is partial review context or verified value proof while `patrolAutonomyValueState` remains a compatibility mirror, legacy `proActivation*` fields are compatibility fallback only, native Patrol state must not load the operations-loop status projection to decide current work, local Patrol state must expose issue-backed `patrolWork*` evidence rather than legacy proof naming, Patrol mode labels remain domain copy that must describe backend-owned risk policy without creating page-local safety thresholds, the Patrol schedule and model drawer must stay separate from the always-visible Patrol mode selector instead of duplicating the four control choices or reintroducing save/apply configuration framing, and Patrol header refresh controls must call an explicit operator-refresh handler whose spinning/disabled state is separate from background polling and initial data loads)
+61. `frontend-modern/src/features/` (including Patrol presentation, where Patrol control starter counts are context only even when mirrored through `patrolAutonomy*` compatibility fields, successful direct Patrol control saves may record the content-free `patrol_control` starter only when paid control is available and the effective control posture changes and must then refresh Patrol status, findings, approvals, and run history before the operator waits for polling, legacy `proActivation*` starter aliases must not render a separate proof strip by themselves, Patrol control completed/resolved counts may only project backend-owned terminal proof, current active findings and pending approvals outrank historical completion proof in the primary operator state, selected run history must read as a Patrol run record rather than a findings filter or snapshot workflow, terminal verified/rejected outcomes with no active finding or pending approval must stay history detail without rendering a no-op proof strip, resolved-only issue history must not be promoted into current-work copy or actions, compact recurrence/trust counters must read as historical evidence rather than current issue state, Patrol-owned status/history evidence must keep the assessment visible when the broader intelligence summary is missing, Patrol work-group chips may group current approvals, failed actions, failed checks, recurring active issues, and stale scheduled protection but must not become a separate status/trust/proof strip, the Patrol route and page title must lead with Patrol while the default workspace underneath may use Open work and run history stays a deliberate secondary review surface, setup-only Patrol runtime failures must instead use `Fix Patrol setup` framing with a dedicated setup task and direct provider-settings action while suppressing generic issue-row chips and filter chrome, Patrol must not expose a generic Details/supporting-context panel for nearby activity, related patterns, or policy limits, locked-control copy must state the watch-only boundary in positive capability language by saying Patrol checks infrastructure and shows current issues, avoid repeating the same sentence across the header and control, and avoid repeatedly restating infrastructure-unchanged caveats or relying on disabled controls, compact Pro badges, Limits controls, or manual-review framing, `patrolControlValueState` decides whether a terminal decision is partial review context or verified value proof while `patrolAutonomyValueState` remains a compatibility mirror, legacy `proActivation*` fields are compatibility fallback only, native Patrol state must not load the operations-loop status projection to decide current work, local Patrol state must expose issue-backed `patrolWork*` evidence rather than legacy proof naming, Patrol mode labels remain domain copy that must describe backend-owned risk policy without creating page-local safety thresholds, the Patrol schedule and model drawer must stay separate from the always-visible Patrol mode selector instead of duplicating the four control choices or reintroducing save/apply configuration framing, and Patrol header refresh controls must call an explicit operator-refresh handler whose spinning/disabled state is separate from background polling and initial data loads)
62. `frontend-modern/src/components/SetupWizard/SetupWizard.tsx`
63. `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`
64. `frontend-modern/src/components/SetupWizard/SetupCompletionPreview.tsx`
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 6ea9849cdb..1da070d3cd 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -81,6 +81,14 @@ or historical proof/counting for resolved-only work.
surface before the drawer opens; it must not include finding IDs, prompt
text, resource context, model output, or direct-action payloads in that
marker.
+ A compact Patrol work-group row may appear above the list only when it adds
+ cross-source current-work grouping that the row title alone cannot express:
+ pending approvals, failed governed actions, a failed/latest Patrol check,
+ recurring active issues, or overdue scheduled protection. It must be
+ data-only presentation from Patrol status, run history, approval state, and
+ current finding composition; it must not become a status strip, trust strip,
+ health summary, generic proof counter, or replacement for the issue row's
+ action, evidence, approval, verification, and Assistant handoff controls.
Runtime/setup findings are still active Patrol work, but setup-only runtime
failures must read as one setup task rather than an infrastructure issue
queue. The header may suppress run and schedule/model controls while setup is
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
index 21480eddf5..612e0ac72e 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
@@ -1,4 +1,4 @@
-import { createMemo, Show } from 'solid-js';
+import { createMemo, For, Show } from 'solid-js';
import HistoryIcon from 'lucide-solid/icons/history';
import SettingsIcon from 'lucide-solid/icons/settings';
import { FindingsPanel } from '@/components/AI/FindingsPanel';
@@ -25,6 +25,7 @@ import {
getPatrolProInvestigationHandoff,
getPatrolQueueBadgeLabel,
getPatrolQueueWorkspaceDescription,
+ getPatrolWorkspaceWorkGroups,
getPatrolSetupIssueReason,
PATROL_WORKSPACE_HISTORY_DESCRIPTION,
PATROL_WORKSPACE_QUEUE_TITLE,
@@ -118,6 +119,17 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt
const run = state.selectedRun();
return run ? getPatrolRunRecordSummaryPresentation(run) : null;
};
+ const latestCompletedRun = createMemo(() => state.patrolRunHistory.value()?.[0] ?? null);
+ const workGroupSummaries = createMemo(() =>
+ getPatrolWorkspaceWorkGroups({
+ latestRun: latestCompletedRun(),
+ patrolStatus: state.patrolStatus(),
+ pendingApprovalCount: state.patrolPendingApprovalCount(),
+ workTypeComposition: workTypeComposition(),
+ }),
+ );
+ const shouldShowWorkGroups = () =>
+ !isHistoryOpen() && !isSetupOnly() && !state.selectedRun() && workGroupSummaries().length > 0;
return (
<>
@@ -172,6 +184,30 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt
</Show>
</div>
+ <Show when={shouldShowWorkGroups()}>
+ <div
+ role="list"
+ aria-label="Patrol work groups"
+ class="grid gap-2 sm:grid-cols-2 xl:grid-cols-3"
+ >
+ <For each={workGroupSummaries()}>
+ {(group) => (
+ <div
+ role="listitem"
+ class="rounded-md border border-border-subtle bg-surface-alt/60 px-3 py-2"
+ >
+ <div class="flex min-w-0 flex-wrap items-center gap-2">
+ <MetadataBadge tone={group.tone} size="xs" shape="rounded">
+ {group.label}
+ </MetadataBadge>
+ </div>
+ <p class="mt-1 text-xs leading-5 text-muted">{group.detail}</p>
+ </div>
+ )}
+ </For>
+ </div>
+ </Show>
+
<Show when={state.activeTab() === 'findings'}>
<Show when={state.selectedRun()}>
{(run) => (
diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts
index 56f643bf04..1e7086d66e 100644
--- a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts
@@ -50,6 +50,8 @@ describe('PatrolIntelligenceWorkspace trust strip', () => {
expect(workspaceSource).toContain('affectedResourceCount: queueAffectedResourceCount()');
expect(workspaceSource).toContain('findingCount: queueIssueCount()');
expect(workspaceSource).toContain('getPatrolQueueWorkspaceDescription');
+ expect(workspaceSource).toContain('getPatrolWorkspaceWorkGroups');
+ expect(workspaceSource).toContain('Patrol work groups');
expect(workspaceSource).toContain('autonomyLevel: state.autonomyLevel()');
expect(workspaceSource).toContain('autonomyLocked: state.autoFixLocked()');
expect(workspaceSource).toContain('Boolean(queueBadgeLabel())');
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolControlPresentation.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolControlPresentation.test.ts
index b8cf8ee374..0c423520f2 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolControlPresentation.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolControlPresentation.test.ts
@@ -7,6 +7,7 @@ import {
getPatrolQueueWorkspaceDescription,
getPatrolReadyWorkDetail,
getPatrolSetupIssueReason,
+ getPatrolWorkspaceWorkGroups,
PATROL_AUTONOMY_POLICY_PRESENTATION,
PATROL_WORKSPACE_QUEUE_TITLE,
} from '../patrolControlPresentation';
@@ -170,6 +171,102 @@ describe('patrolControlPresentation', () => {
);
});
+ it('does not add work-group chrome for ordinary active findings alone', () => {
+ expect(
+ getPatrolWorkspaceWorkGroups({
+ workTypeComposition: {
+ total: 1,
+ approval: 0,
+ failed: 0,
+ inProgress: 0,
+ recurring: 0,
+ newIssues: 1,
+ },
+ }),
+ ).toEqual([]);
+ });
+
+ it('groups approvals, failed checks, recurring issues, and stale protection as Patrol work', () => {
+ expect(
+ getPatrolWorkspaceWorkGroups({
+ latestRun: {
+ error_count: 1,
+ resources_checked: 4,
+ status: 'error',
+ },
+ nowMs: Date.parse('2026-06-30T15:00:00Z'),
+ patrolStatus: {
+ error_count: 1,
+ next_patrol_at: '2026-06-30T14:05:00Z',
+ running: false,
+ },
+ pendingApprovalCount: 2,
+ workTypeComposition: {
+ total: 3,
+ approval: 1,
+ failed: 1,
+ inProgress: 0,
+ recurring: 1,
+ newIssues: 1,
+ },
+ }),
+ ).toEqual([
+ {
+ detail: 'Approve or reject requested fixes from the issue rows.',
+ id: 'approvals',
+ label: '2 approvals waiting',
+ tone: 'warning',
+ },
+ {
+ detail: 'Review the failed action and verification state in the affected issue row.',
+ id: 'failed-actions',
+ label: '1 failed action',
+ tone: 'danger',
+ },
+ {
+ detail: 'Patrol checked 4 resources but ended with runtime issues.',
+ id: 'failed-check',
+ label: 'Latest check needs review',
+ tone: 'danger',
+ },
+ {
+ detail: 'Current work includes issues that reappeared after earlier resolution.',
+ id: 'recurring',
+ label: '1 recurring issue',
+ tone: 'warning',
+ },
+ {
+ detail: 'The next scheduled Patrol check is overdue; run Patrol when the system is ready.',
+ id: 'stale-protection',
+ label: 'Check overdue',
+ tone: 'warning',
+ },
+ ]);
+ });
+
+ it('does not call future or running scheduled checks stale protection', () => {
+ expect(
+ getPatrolWorkspaceWorkGroups({
+ nowMs: Date.parse('2026-06-30T13:00:00Z'),
+ patrolStatus: {
+ error_count: 0,
+ next_patrol_at: '2026-06-30T14:05:00Z',
+ running: false,
+ },
+ }),
+ ).toEqual([]);
+ expect(
+ getPatrolWorkspaceWorkGroups({
+ nowMs: Date.parse('2026-06-30T15:00:00Z'),
+ patrolStatus: {
+ error_count: 0,
+ next_patrol_at: '2026-06-30T14:05:00Z',
+ running: true,
+ },
+ }),
+ ).toEqual([]);
+ });
+
it('keeps setup-only issue reasons short and actionable', () => {
expect(
getPatrolSetupIssueReason({
diff --git a/frontend-modern/src/features/patrol/patrolControlPresentation.ts b/frontend-modern/src/features/patrol/patrolControlPresentation.ts
index 8fe1f82790..fdec4785c8 100644
--- a/frontend-modern/src/features/patrol/patrolControlPresentation.ts
+++ b/frontend-modern/src/features/patrol/patrolControlPresentation.ts
@@ -1,4 +1,5 @@
-import type { PatrolAutonomyLevel } from '@/api/patrol';
+import type { PatrolAutonomyLevel, PatrolRunRecord, PatrolStatus } from '@/api/patrol';
+import type { MetadataBadgeTone } from '@/components/shared/MetadataBadge';
import {
getPatrolFindingIssueCountLabel,
getPatrolWorkTypeCompositionClause,
@@ -57,6 +58,21 @@ interface PatrolQueueCountInput {
workTypeComposition?: PatrolWorkTypeComposition;
}
+export interface PatrolWorkspaceWorkGroupSummary {
+ detail: string;
+ id: 'approvals' | 'failed-actions' | 'failed-check' | 'recurring' | 'stale-protection';
+ label: string;
+ tone: MetadataBadgeTone;
+}
+
+interface PatrolWorkspaceWorkGroupsInput {
+ latestRun?: Pick<PatrolRunRecord, 'error_count' | 'resources_checked' | 'status'> | null;
+ nowMs?: number;
+ patrolStatus?: Pick<PatrolStatus, 'error_count' | 'next_patrol_at' | 'running'> | null;
+ pendingApprovalCount?: number;
+ workTypeComposition?: PatrolWorkTypeComposition;
+}
+
interface PatrolSetupIssueReasonInput {
setupFindingTitle?: string;
readinessSummary?: string;
@@ -79,6 +95,29 @@ function formatCount(count: number, singular: string, plural = `${singular}s`):
return `${count} ${count === 1 ? singular : plural}`;
}
+function normalizeStatus(value: string | undefined): string {
+ return String(value || '')
+ .trim()
+ .toLowerCase()
+ .replace(/\s+/g, '_');
+}
+
+function hasFailedPatrolCheck(
+ run: Pick<PatrolRunRecord, 'error_count' | 'status'> | null | undefined,
+): boolean {
+ if (!run) return false;
+ return normalizeCount(run.error_count) > 0 || normalizeStatus(run.status) === 'error';
+}
+
+function isScheduledPatrolOverdue(
+ status: Pick<PatrolStatus, 'next_patrol_at' | 'running'> | null | undefined,
+ nowMs: number,
+): boolean {
+ if (!status || status.running || !status.next_patrol_at) return false;
+ const nextPatrolAt = Date.parse(status.next_patrol_at);
+ return Number.isFinite(nextPatrolAt) && nextPatrolAt < nowMs;
+}
+
function getPatrolQueueActionDetail(input: PatrolControlCopyInput): string {
if (input.autonomyLocked) {
return 'Open a row to review evidence and record the outcome.';
@@ -177,6 +216,70 @@ export function getPatrolQueueWorkspaceDescription(
}
}
+export function getPatrolWorkspaceWorkGroups(
+ input: PatrolWorkspaceWorkGroupsInput,
+): PatrolWorkspaceWorkGroupSummary[] {
+ const groups: PatrolWorkspaceWorkGroupSummary[] = [];
+ const composition = input.workTypeComposition;
+ const pendingApprovalCount = normalizeCount(input.pendingApprovalCount);
+ const failedActionCount = normalizeCount(composition?.failed);
+ const recurringIssueCount = normalizeCount(composition?.recurring);
+ const latestRun = input.latestRun ?? null;
+ const latestRunFailed = hasFailedPatrolCheck(latestRun);
+ const statusErrorCount = normalizeCount(input.patrolStatus?.error_count);
+
+ if (pendingApprovalCount > 0) {
+ groups.push({
+ id: 'approvals',
+ label: `${formatCount(pendingApprovalCount, 'approval')} waiting`,
+ detail: 'Approve or reject requested fixes from the issue rows.',
+ tone: 'warning',
+ });
+ }
+
+ if (failedActionCount > 0) {
+ groups.push({
+ id: 'failed-actions',
+ label: `${formatCount(failedActionCount, 'failed action')}`,
+ detail: 'Review the failed action and verification state in the affected issue row.',
+ tone: 'danger',
+ });
+ }
+
+ if (latestRunFailed || statusErrorCount > 0) {
+ const checkedResources = normalizeCount(latestRun?.resources_checked);
+ groups.push({
+ id: 'failed-check',
+ label: 'Latest check needs review',
+ detail:
+ checkedResources > 0
+ ? `Patrol checked ${formatCount(checkedResources, 'resource')} but ended with runtime issues.`
+ : 'The last Patrol check ended with runtime issues.',
+ tone: 'danger',
+ });
+ }
+
+ if (recurringIssueCount > 0) {
+ groups.push({
+ id: 'recurring',
+ label: `${formatCount(recurringIssueCount, 'recurring issue')}`,
+ detail: 'Current work includes issues that reappeared after earlier resolution.',
+ tone: 'warning',
+ });
+ }
+
+ if (isScheduledPatrolOverdue(input.patrolStatus, input.nowMs ?? Date.now())) {
+ groups.push({
+ id: 'stale-protection',
+ label: 'Check overdue',
+ detail: 'The next scheduled Patrol check is overdue; run Patrol when the system is ready.',
+ tone: 'warning',
+ });
+ }
+
+ return groups;
+}
+
const PATROL_PRO_HANDOFF_ACTIONABLE_SEVERITIES = new Set(['critical', 'warning']);
export interface PatrolProInvestigationHandoff {
diff --git a/tests/integration/tests/78-monitor-first-patrol-workbench.spec.ts b/tests/integration/tests/78-monitor-first-patrol-workbench.spec.ts
index 2f91b98766..9f65bf66e5 100644
--- a/tests/integration/tests/78-monitor-first-patrol-workbench.spec.ts
+++ b/tests/integration/tests/78-monitor-first-patrol-workbench.spec.ts
@@ -13,8 +13,10 @@ type WorkerFixtures = {
type PatrolWorkbenchFixtureOptions = {
findingCount?: number;
+ pendingApprovalCount?: number;
+ runErrorCount?: number;
resourcesChecked?: number;
- runStatus?: "healthy" | "issues_found";
+ runStatus?: "healthy" | "issues_found" | "error";
};
const test = base.extend<{}, WorkerFixtures>({
@@ -136,7 +138,7 @@ const buildRunHistory = (options: Required<PatrolWorkbenchFixtureOptions>) => [
findings_summary:
options.findingCount > 0 ? "1 active finding" : "No active findings",
finding_ids: options.findingCount > 0 ? ["finding-active-work"] : [],
- error_count: 0,
+ error_count: options.runErrorCount,
status: options.runStatus,
triage_flags: 0,
tool_call_count: 1,
@@ -154,8 +156,8 @@ const buildPatrolStatus = (
last_duration_ms: 42_000,
resources_checked: options.resourcesChecked,
findings_count: options.findingCount,
- error_count: 0,
- healthy: options.findingCount === 0,
+ error_count: options.runErrorCount,
+ healthy: options.findingCount === 0 && options.runErrorCount === 0,
interval_ms: 21_600_000,
fixed_count: 0,
blocked_reason: "",
@@ -229,6 +231,10 @@ const buildPatrolFindingsResponse = (
times_raised: 1,
suppressed: false,
investigation_attempts: 0,
+ investigation_status:
+ options.pendingApprovalCount > 0 ? "needs_attention" : undefined,
+ investigation_outcome:
+ options.pendingApprovalCount > 0 ? "fix_queued" : undefined,
},
],
count: 1,
@@ -247,6 +253,9 @@ async function mockMonitorFirstPatrolWorkbench(
const resolved = {
findingCount: options.findingCount ?? 0,
resourcesChecked: options.resourcesChecked ?? 1,
+ pendingApprovalCount: options.pendingApprovalCount ?? 0,
+ runErrorCount:
+ options.runErrorCount ?? (options.runStatus === "error" ? 1 : 0),
runStatus:
options.runStatus ?? (options.findingCount ? "issues_found" : "healthy"),
} satisfies Required<PatrolWorkbenchFixtureOptions>;
@@ -397,10 +406,29 @@ async function mockMonitorFirstPatrolWorkbench(
});
await page.route("**/api/ai/approvals", async (route) => {
+ const approvals =
+ resolved.pendingApprovalCount > 0
+ ? [
+ {
+ id: "approval-finding-active-work",
+ toolId: "investigation_fix",
+ command: "systemctl restart pulse-agent",
+ targetType: "agent",
+ targetId: "finding-active-work",
+ targetName: "pve-main",
+ context:
+ "Restart Pulse Agent on pve-main to clear the sustained pressure finding.",
+ riskLevel: "medium",
+ status: "pending",
+ requestedAt: "2026-06-30T08:06:00Z",
+ expiresAt: "2099-06-30T08:11:00Z",
+ },
+ ]
+ : [];
await route.fulfill({
status: 200,
contentType: "application/json",
- body: JSON.stringify({ approvals: [] }),
+ body: JSON.stringify({ approvals }),
});
});
@@ -511,4 +539,46 @@ test.describe("Monitor-first Patrol workbench browser contract", () => {
).toBeVisible();
await expect(page.getByText(/Nothing needs attention/i)).toHaveCount(0);
});
+
+ test("Patrol groups approvals and failed checks inside the Patrol workbench", async ({
+ page,
+ }, testInfo) => {
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop workbench routing proof",
+ );
+
+ await mockMonitorFirstPatrolWorkbench(page, {
+ findingCount: 1,
+ pendingApprovalCount: 1,
+ resourcesChecked: 4,
+ runErrorCount: 1,
+ runStatus: "error",
+ });
+ await page.goto("/infrastructure", { waitUntil: "domcontentloaded" });
+
+ await expect(page).toHaveURL(/\/proxmox\/overview$/, { timeout: 30_000 });
+ await expect(page.getByText("Latest check needs review")).toHaveCount(0);
+ await expect(page.getByText("1 approval waiting")).toHaveCount(0);
+
+ await page.getByRole("tab", { name: /Patrol/ }).click();
+ await expect(page).toHaveURL(/\/patrol$/);
+ await expect(
+ page.getByRole("heading", { level: 2, name: "Open work" }),
+ ).toBeVisible();
+ const workGroups = page.getByRole("list", { name: "Patrol work groups" });
+ await expect(workGroups).toBeVisible();
+ await expect(workGroups.getByText("1 approval waiting")).toBeVisible();
+ await expect(
+ workGroups.getByText("Latest check needs review"),
+ ).toBeVisible();
+ await expect(
+ workGroups.getByText(
+ "Patrol checked 4 resources but ended with runtime issues.",
+ ),
+ ).toBeVisible();
+ await expect(
+ page.getByRole("heading", { name: /^Pulse Assistant$/ }),
+ ).toHaveCount(0);
+ });
});