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.

Keep governed Docker updates pending until their action outcome is known

pulse-triage[bot]dcb9399cecc1
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index a4c192aae8..5e59ab13b5 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -4533,6 +4533,14 @@ and button lifecycle, and
and button tooltip formatting, class selection, and label/state presentation.
Future container-update work should extend those owners instead of pushing
store wiring, settings reads, or mutation flow back into the shared shell.
+For governed container updates, the row's current-session pending state is
+bound to the action ID. A changed registry update badge, a legacy command for
+the same container, or elapsed time cannot turn an unconfirmed action green or
+offer a fresh plan. The row reopens that action with a read-only action GET;
+only its recorded completed outcome earns the transient completed state.
+Operator-closed unknown outcomes remain reviewable and must not be presented
+as failed. A browser reload loses this row-local shortcut, not the durable
+Actions audit; the audit remains the authority before any later retry.
The shared web interface URL field now follows that same owner split.
`frontend-modern/src/components/shared/WebInterfaceUrlField.tsx` stays the
render shell, `frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts`
diff --git a/frontend-modern/browser-tests/update-action-receipt.cjs b/frontend-modern/browser-tests/update-action-receipt.cjs
new file mode 100644
index 0000000000..aa1be43d12
--- /dev/null
+++ b/frontend-modern/browser-tests/update-action-receipt.cjs
@@ -0,0 +1,103 @@
+// Offline browser proof: a changed registry badge cannot complete an unknown action.
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const path = require('node:path');
+const { chromium } = require('playwright');
+
+(async () => {
+ const root = '/workspace/frontend-modern';
+ const artifacts = path.join(root, 'browser-tests', 'update-action-receipt-proof');
+ fs.mkdirSync(artifacts, { recursive: true });
+ process.chdir(root);
+ const { createServer } = await import(path.join(root, 'node_modules/vite/dist/node/index.js'));
+ const server = await createServer({
+ root,
+ configFile: path.join(root, 'vite.config.ts'),
+ server: { host: '127.0.0.1', port: 5207, strictPort: true },
+ });
+ let browser;
+ try {
+ await server.listen();
+ browser = await chromium.launch({ headless: true, channel: 'chromium', args: ['--no-sandbox'] });
+ const results = [];
+ for (const width of [1365, 390]) {
+ let mode = 'pending';
+ const page = await browser.newPage({ viewport: { width, height: width === 390 ? 844 : 900 } });
+ const pageErrors = [];
+ const actionRequests = [];
+ page.on('pageerror', (error) => pageErrors.push(error.message));
+ await page.route('**/*', (route) => {
+ const url = new URL(route.request().url());
+ if (url.origin !== 'http://127.0.0.1:5207') return route.abort();
+ if (url.pathname === '/api/security/status') {
+ return route.fulfill({ json: {
+ hasAuthentication: true, requiresAuth: true,
+ settingsCapabilities: { authenticationWrite: true },
+ } });
+ }
+ if (url.pathname === '/api/actions/action-fixture-1') {
+ actionRequests.push(route.request().method());
+ return route.fulfill({ json: {
+ audit: {
+ id: 'action-fixture-1', createdAt: new Date().toISOString(),
+ updatedAt: new Date().toISOString(), state: mode === 'pending' ? 'executing' : 'completed',
+ decisionRevision: 1,
+ request: { requestId: 'request-fixture-1', resourceId: 'docker:container:edge',
+ capabilityName: 'update', reason: 'Update edge.', requestedBy: 'operator' },
+ plan: { actionId: 'action-fixture-1', requestId: 'request-fixture-1', allowed: true,
+ requiresApproval: false, approvalPolicy: 'none', rollbackAvailable: false,
+ expiresAt: new Date(Date.now() + 30 * 60_000).toISOString(),
+ planHash: 'sha256:fixture-plan', policyDecision: { status: 'resolved', authorities: [] } },
+ verificationOutcome: { status: mode === 'pending' ? 'unknown' : 'verified' },
+ ...(mode === 'complete' ? { result: { success: true,
+ actionResultV2: { execution: { status: 'succeeded' },
+ verification: { status: 'verified', evidenceClass: 'agent' },
+ compensation: { status: 'not_attempted', support: 'unavailable' } } } } : {}),
+ },
+ events: [],
+ attempt: { id: 'attempt-fixture-1', actionId: 'action-fixture-1',
+ state: mode === 'pending' ? 'receipt_pending' : 'receipt_recorded',
+ createdAt: new Date(Date.now() - 5 * 60_000).toISOString(),
+ updatedAt: new Date(Date.now() - 5 * 60_000).toISOString(), dispatchCount: 1 },
+ } });
+ }
+ if (url.pathname.startsWith('/api/')) return route.abort();
+ return route.continue();
+ });
+ await page.goto('http://127.0.0.1:5207/browser-tests/update-action-receipt.html', {
+ waitUntil: 'domcontentloaded', timeout: 120_000,
+ });
+ const review = page.getByRole('button', { name: /outcome not yet known/i });
+ await review.waitFor();
+ assert.equal(await page.getByText('Current', { exact: true }).count(), 0);
+ assert.equal(await page.getByText('Completed', { exact: true }).count(), 0);
+ await page.screenshot({ path: path.join(artifacts, `pending-${width}.png`) });
+
+ await review.click();
+ await page.getByText('Receipt pending', { exact: true }).waitFor();
+ assert.equal(actionRequests.length, 1);
+ await page.waitForTimeout(400); // Let the dialog entrance finish before capture.
+ await page.screenshot({ path: path.join(artifacts, `review-${width}.png`) });
+
+ mode = 'complete';
+ await page.getByRole('button', { name: 'Check for receipt' }).click();
+ await page.getByText('Completed', { exact: true }).first().waitFor();
+ assert.equal(actionRequests.length, 2);
+ assert.ok(actionRequests.every((method) => method === 'GET'), JSON.stringify(actionRequests));
+ assert.deepEqual(pageErrors, []);
+ const dimensions = await page.evaluate(() => ({ scroll: document.documentElement.scrollWidth, inner: innerWidth }));
+ assert.ok(dimensions.scroll <= dimensions.inner + 1, JSON.stringify(dimensions));
+ await page.waitForTimeout(400);
+ await page.screenshot({ path: path.join(artifacts, `completed-${width}.png`) });
+ results.push({ width, actionRequests, pageErrors, dimensions });
+ await page.close();
+ }
+ console.log(JSON.stringify({ result: 'passed', browser: browser.version(), playwright: '1.56.1', results }));
+ } finally {
+ if (browser) await browser.close();
+ await server.close();
+ }
+})().catch((error) => {
+ console.error(error);
+ process.exitCode = 1;
+});
diff --git a/frontend-modern/browser-tests/update-action-receipt.html b/frontend-modern/browser-tests/update-action-receipt.html
new file mode 100644
index 0000000000..f58f61dece
--- /dev/null
+++ b/frontend-modern/browser-tests/update-action-receipt.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/browser-tests/update-action-receipt.tsx"></script>
+ </body>
+</html>
diff --git a/frontend-modern/browser-tests/update-action-receipt.tsx b/frontend-modern/browser-tests/update-action-receipt.tsx
new file mode 100644
index 0000000000..0ee9f9a6fe
--- /dev/null
+++ b/frontend-modern/browser-tests/update-action-receipt.tsx
@@ -0,0 +1,29 @@
+// Exercise the production Docker update button with an unresolved governed action.
+import { render } from 'solid-js/web';
+import { UpdateButton } from '../src/components/shared/ContainerUpdateBadge';
+import { markContainerQueued } from '../src/stores/containerUpdates';
+import { markSystemSettingsLoadedWithDefaults } from '../src/stores/systemSettings';
+import '../src/index.css';
+
+markSystemSettingsLoadedWithDefaults();
+markContainerQueued('agent-fixture-1', 'container-fixture-1', 'action-fixture-1');
+
+render(
+ () => (
+ <main class="mx-auto max-w-lg p-6">
+ <h1 class="mb-4 text-lg font-semibold">Container update receipt</h1>
+ <UpdateButton
+ agentId="agent-fixture-1"
+ containerId="container-fixture-1"
+ containerName="edge"
+ resourceId="docker:container:edge"
+ updateStatus={{
+ updateAvailable: false,
+ currentDigest: 'sha256:current',
+ lastChecked: Date.now(),
+ }}
+ />
+ </main>
+ ),
+ document.getElementById('root')!,
+);
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 11d01597ee..971e11f167 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,16 +1,22 @@
{
"version": 1,
- "base_sha": "fbf17b271abe70ad3e12042506b52f85b6cbc484",
- "verified_at": "2026-09-29T19:50:45Z",
+ "base_sha": "91d8822d76c5a7214995c0e370be637b6e6336e3",
+ "verified_at": "2026-09-29T22:13:56Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/pages/Actions.tsx"
+ "frontend-modern/src/components/shared/ContainerUpdateBadge.tsx",
+ "frontend-modern/src/components/shared/containerUpdateBadgeModel.ts",
+ "frontend-modern/src/components/shared/useContainerUpdateButtonState.ts",
+ "frontend-modern/src/stores/containerUpdates.ts"
],
"content_sha256": {
- "frontend-modern/src/pages/Actions.tsx": "30e862ecc5125f07cf93f0c1e0b5f58efa023f5fdb56fe4b01721bf9a453e7ce"
+ "frontend-modern/src/components/shared/ContainerUpdateBadge.tsx": "fd88f3e3e275926572126f43cce7296e7361b5e527868dd3c59c7eb951e9f5c9",
+ "frontend-modern/src/components/shared/containerUpdateBadgeModel.ts": "10bc488cb82ae84c6ae46d77ec672d34df2a1b3c28e138ae0f3b4214cccbe37e",
+ "frontend-modern/src/components/shared/useContainerUpdateButtonState.ts": "4b9dd4a42549b0433a1afa56f26183fe721c80626f823fb3c8489934721267c5",
+ "frontend-modern/src/stores/containerUpdates.ts": "b5d47132f7daf7f14bcc38462043288fc211344410af622ada7728694bcd514d"
},
"routes": [
- "/browser-tests/action-review-navigation.html (production Actions page with scripted action reads)"
+ "/browser-tests/update-action-receipt.html (production Docker update button with scripted action reads)"
],
"viewports": [
{
@@ -23,24 +29,71 @@
}
],
"states": [
- "detail for edge-a held while edge-b is selected and rendered",
- "late edge-a response cannot replace edge-b review or URL",
- "pending receipt re-read finishes after edge-b review closes"
+ "governed update receipt pending after registry updateAvailable becomes false",
+ "existing action re-opened by GET with no second plan or execute",
+ "recorded completed action after a second GET changes the displayed outcome"
],
"interactions": [
- "select edge-a then edge-b before the first detail response arrives",
- "release older response and inspect current review at desktop and phone widths",
- "start same-action receipt GET, close review, release response; no dialog reopens",
- "assert all scripted API requests are GET and no horizontal overflow or page errors"
+ "inspect pending button and absence of a Current or Completed claim",
+ "select Review action and inspect receipt-pending dialog",
+ "select Check for receipt and inspect recorded completion",
+ "assert both action requests are GET; no page errors or horizontal overflow"
],
- "command": "pulse-worker-browser frontend-modern/browser-tests/action-review-navigation.cjs from assigned workspace root; Vite 6.4.3, Chromium 141.0.7390.37, Playwright 1.56.1",
+ "command": "pulse-worker-browser frontend-modern/browser-tests/update-action-receipt.cjs from assigned workspace root; Vite 6.4.3, Chromium 141.0.7390.37, Playwright 1.56.1",
"artifacts": [
- "/var/lib/pulse-maintainer/worker-outputs/web-product-rkmwqerp/action-review-navigation-browser.log",
- "/var/lib/pulse-maintainer/worker-outputs/web-product-rkmwqerp/action-review-navigation-proof/newest-review-1365.png",
- "/var/lib/pulse-maintainer/worker-outputs/web-product-rkmwqerp/action-review-navigation-proof/newest-review-390.png"
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-browser-final.log",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-proof-final/pending-1365.png",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-proof-final/review-1365.png",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-proof-final/completed-1365.png",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-proof-final/pending-390.png",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-proof-final/review-390.png",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-ahrmjhme/update-action-receipt-proof-final/completed-390.png"
],
- "notes": "Mock-backed navigation proof of production Actions page; screenshots inspected. No update was executed, no installed or reporter result established.",
+ "notes": "Mock-backed UI proof; six screenshots inspected, including pending and completed phone states. This does not establish installed behaviour or resolve #1891.",
"prior_verifications": [
+ {
+ "version": 1,
+ "base_sha": "fbf17b271abe70ad3e12042506b52f85b6cbc484",
+ "verified_at": "2026-09-29T19:50:45Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/pages/Actions.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/pages/Actions.tsx": "30e862ecc5125f07cf93f0c1e0b5f58efa023f5fdb56fe4b01721bf9a453e7ce"
+ },
+ "routes": [
+ "/browser-tests/action-review-navigation.html (production Actions page with scripted action reads)"
+ ],
+ "viewports": [
+ {
+ "width": 1365,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "detail for edge-a held while edge-b is selected and rendered",
+ "late edge-a response cannot replace edge-b review or URL",
+ "pending receipt re-read finishes after edge-b review closes"
+ ],
+ "interactions": [
+ "select edge-a then edge-b before the first detail response arrives",
+ "release older response and inspect current review at desktop and phone widths",
+ "start same-action receipt GET, close review, release response; no dialog reopens",
+ "assert all scripted API requests are GET and no horizontal overflow or page errors"
+ ],
+ "command": "pulse-worker-browser frontend-modern/browser-tests/action-review-navigation.cjs from assigned workspace root; Vite 6.4.3, Chromium 141.0.7390.37, Playwright 1.56.1",
+ "artifacts": [
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-rkmwqerp/action-review-navigation-browser.log",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-rkmwqerp/action-review-navigation-proof/newest-review-1365.png",
+ "/var/lib/pulse-maintainer/worker-outputs/web-product-rkmwqerp/action-review-navigation-proof/newest-review-390.png"
+ ],
+ "notes": "Mock-backed navigation proof of production Actions page; screenshots inspected. No update was executed, no installed or reporter result established."
+ },
{
"version": 1,
"base_sha": "c2f7aa8b471d6cbb858e8ec71b4e664fded6549c",
diff --git a/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx b/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx
index 490371e5b6..08a7b57ba0 100644
--- a/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx
+++ b/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx
@@ -255,6 +255,13 @@ export const UpdateButton: Component<UpdateButtonProps> = (props) => {
<Match when={state.currentState() === 'updating'}>
<SpinnerIcon class="w-3 h-3 animate-spin" />
</Match>
+ <Match
+ when={
+ state.currentState() === 'queued' || state.currentState() === 'inconclusive'
+ }
+ >
+ <ErrorIndicatorIcon class="w-3 h-3" />
+ </Match>
<Match when={state.currentState() === 'success'}>
<CheckIcon class="w-3 h-3" />
</Match>
diff --git a/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx b/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx
index d2c6ca3443..835787083b 100644
--- a/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx
@@ -1,10 +1,17 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { cleanup, render, screen } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import containerUpdateBadgeSource from '@/components/shared/ContainerUpdateBadge.tsx?raw';
import containerUpdateBadgeModelSource from '@/components/shared/containerUpdateBadgeModel.ts?raw';
import containerUpdateButtonStateSource from '@/components/shared/useContainerUpdateButtonState.ts?raw';
import { ContainerUpdateBadge, UpdateButton } from '@/components/shared/ContainerUpdateBadge';
import { getUpdatePlanErrorMessage } from '@/components/shared/containerUpdateBadgeModel';
+import { ResourceActionsAPI } from '@/api/resourceActions';
+import {
+ getContainerUpdateState,
+ markContainerUpdateError,
+ markContainerUpdateInconclusive,
+ markContainerUpdateSuccess,
+} from '@/stores/containerUpdates';
vi.mock('@/api/monitoring', () => ({
MonitoringAPI: {},
@@ -15,16 +22,31 @@ vi.mock('@/stores/containerUpdates', () => ({
getContainerUpdateState: vi.fn(() => undefined),
markContainerQueued: vi.fn(),
markContainerUpdateError: vi.fn(),
+ markContainerUpdateInconclusive: vi.fn(),
markContainerUpdateSuccess: vi.fn(),
updateStates: vi.fn(() => ({})),
}));
+vi.mock('@/api/resourceActions', () => ({
+ ResourceActionsAPI: { getAction: vi.fn(), planAction: vi.fn() },
+}));
+
+vi.mock('@/features/actions/ActionReviewDialog', () => ({
+ ActionReviewDialog: (props: { detail: { audit: { id: string } } | null }) => (
+ <div data-testid="action-review-fixture">{props.detail?.audit.id}</div>
+ ),
+}));
+
vi.mock('@/stores/systemSettings', () => ({
areSystemSettingsLoaded: () => true,
shouldHideDockerUpdateActions: () => false,
}));
-afterEach(cleanup);
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+ vi.mocked(getContainerUpdateState).mockReturnValue(undefined);
+});
describe('ContainerUpdateBadge', () => {
it('keeps the badge on shell, runtime, and model owners', () => {
@@ -203,6 +225,104 @@ describe('ContainerUpdateBadge', () => {
expect(screen.getByText('Check failed')).toBeInTheDocument();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
+
+ it('keeps an audited update pending when the registry check no longer shows an update', async () => {
+ vi.mocked(getContainerUpdateState).mockReturnValue({
+ state: 'queued',
+ startedAt: Date.now() - 60_000,
+ actionId: 'action-pending-1',
+ });
+ vi.mocked(ResourceActionsAPI.getAction).mockResolvedValue({
+ audit: { id: 'action-pending-1', state: 'executing' },
+ } as never);
+ render(() => (
+ <UpdateButton
+ agentId="agent-1"
+ containerId="container-1"
+ containerName="web"
+ resourceId="resource-1"
+ updateStatus={{ updateAvailable: false, currentDigest: 'sha256:current', lastChecked: 1 }}
+ />
+ ));
+
+ const review = screen.getByRole('button', { name: /outcome not yet known/i });
+ expect(review).toBeEnabled();
+ expect(screen.getByText('Review action')).toBeVisible();
+ expect(screen.queryByText('Current')).not.toBeInTheDocument();
+ expect(markContainerUpdateSuccess).not.toHaveBeenCalled();
+
+ fireEvent.click(review);
+ await waitFor(() =>
+ expect(ResourceActionsAPI.getAction).toHaveBeenCalledWith('action-pending-1'),
+ );
+ expect(await screen.findByTestId('action-review-fixture')).toHaveTextContent(
+ 'action-pending-1',
+ );
+ expect(ResourceActionsAPI.planAction).not.toHaveBeenCalled();
+ expect(markContainerUpdateSuccess).not.toHaveBeenCalled();
+ });
+
+ it('keeps an inconclusive audit reviewable instead of offering another update', async () => {
+ vi.mocked(getContainerUpdateState).mockReturnValue({
+ state: 'inconclusive',
+ startedAt: Date.now() - 3600_000,
+ actionId: 'action-unknown-1',
+ });
+ vi.mocked(ResourceActionsAPI.getAction).mockRejectedValueOnce(new Error('offline'));
+ render(() => (
+ <UpdateButton
+ agentId="agent-1"
+ containerId="container-1"
+ containerName="web"
+ resourceId="resource-1"
+ updateStatus={{ updateAvailable: true, lastChecked: 1 }}
+ />
+ ));
+
+ const review = screen.getByRole('button', { name: /outcome unknown/i });
+ fireEvent.click(review);
+ await waitFor(() =>
+ expect(ResourceActionsAPI.getAction).toHaveBeenCalledWith('action-unknown-1'),
+ );
+ expect(ResourceActionsAPI.planAction).not.toHaveBeenCalled();
+ expect(screen.getByText('Review action')).toBeVisible();
+ expect(screen.getByRole('button', { name: /Could not re-read the action/i })).toBeVisible();
+ });
+
+ it('keeps an operator-closed audit outcome unknown rather than showing an update failure', async () => {
+ vi.mocked(getContainerUpdateState).mockReturnValue({
+ state: 'queued',
+ startedAt: Date.now() - 60_000,
+ actionId: 'action-pending-1',
+ });
+ vi.mocked(ResourceActionsAPI.getAction).mockResolvedValueOnce({
+ audit: {
+ id: 'action-pending-1',
+ state: 'failed',
+ result: { actionResultV2: { execution: { reasonCode: 'operator_force_failed' } } },
+ },
+ } as never);
+ render(() => (
+ <UpdateButton
+ agentId="agent-1"
+ containerId="container-1"
+ containerName="web"
+ resourceId="resource-1"
+ updateStatus={{ updateAvailable: true, lastChecked: 1 }}
+ />
+ ));
+
+ fireEvent.click(screen.getByRole('button', { name: /outcome not yet known/i }));
+ await waitFor(() =>
+ expect(markContainerUpdateInconclusive).toHaveBeenCalledWith(
+ 'agent-1',
+ 'container-1',
+ 'action-pending-1',
+ ),
+ );
+ expect(markContainerUpdateError).not.toHaveBeenCalled();
+ expect(ResourceActionsAPI.planAction).not.toHaveBeenCalled();
+ });
});
describe('getUpdatePlanErrorMessage', () => {
diff --git a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts
index 1edd90d741..7a982d0049 100644
--- a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts
@@ -284,8 +284,13 @@ describe('containerUpdateBadgeModel.branchcov', () => {
expect(getUpdateButtonLabel('updating', true)).toBe('Updating...');
});
- it('returns "Queued!" for the success arm', () => {
- expect(getUpdateButtonLabel('success', true)).toBe('Queued!');
+ it('returns "Completed" for the success arm', () => {
+ expect(getUpdateButtonLabel('success', true)).toBe('Completed');
+ });
+
+ it('keeps unknown governed outcomes in review rather than offering Update', () => {
+ expect(getUpdateButtonLabel('queued', true)).toBe('Review action');
+ expect(getUpdateButtonLabel('inconclusive', true)).toBe('Review action');
});
it('returns "Failed" for the error arm', () => {
@@ -303,11 +308,18 @@ describe('containerUpdateBadgeModel.branchcov', () => {
describe('success state', () => {
it('returns the static success message', () => {
expect(getUpdateButtonTooltip({ state: 'success' })).toBe(
- '✓ Update completed successfully!',
+ 'Update action completed. Check the running container and image.',
);
});
});
+ describe('unknown governed outcomes', () => {
+ it('does not call a missing receipt or an inconclusive audit a failed update', () => {
+ expect(getUpdateButtonTooltip({ state: 'queued' })).toContain('Outcome not yet known');
+ expect(getUpdateButtonTooltip({ state: 'inconclusive' })).toContain('outcome unknown');
+ });
+ });
+
describe('updating state', () => {
it('reports 0s elapsed with the default step when storeState is absent (elapsed=0, <=60 arm)', () => {
expect(getUpdateButtonTooltip({ state: 'updating', now: 100000 })).toBe(
diff --git a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts
index 1179911b14..007801ec57 100644
--- a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts
@@ -106,7 +106,7 @@ describe('containerUpdateBadgeModel.branchcov2', () => {
describe('getUpdateButtonTooltip', () => {
it('returns the success message for the "success" state', () => {
expect(getUpdateButtonTooltip({ state: 'success', now: 1000 })).toBe(
- '✓ Update completed successfully!',
+ 'Update action completed. Check the running container and image.',
);
});
@@ -234,8 +234,8 @@ describe('containerUpdateBadgeModel.branchcov2', () => {
expect(getUpdateButtonLabel('updating', true)).toBe('Updating...');
});
- it('returns "Queued!" for the success state', () => {
- expect(getUpdateButtonLabel('success', true)).toBe('Queued!');
+ it('returns "Completed" for the success state', () => {
+ expect(getUpdateButtonLabel('success', true)).toBe('Completed');
});
it('returns "Failed" for the error state', () => {
diff --git a/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts b/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts
index 99e3f090ea..2cd18b0cd0 100644
--- a/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts
+++ b/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts
@@ -30,7 +30,7 @@ export interface UpdateButtonProps {
// The update click plans a governed action and opens the review dialog, which
// is the confirmation surface; there is no separate in-row confirming state.
-export type UpdateState = 'idle' | 'updating' | 'success' | 'error';
+export type UpdateState = 'idle' | 'queued' | 'updating' | 'success' | 'error' | 'inconclusive';
export interface ContainerUpdateButtonStoreState {
startedAt: number;
@@ -103,6 +103,9 @@ export function getUpdateButtonClass(state: UpdateState, unavailable = false): s
switch (state) {
case 'updating':
return `${UPDATE_BUTTON_BASE_CLASS} bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300 cursor-wait`;
+ case 'queued':
+ case 'inconclusive':
+ return `${UPDATE_BUTTON_BASE_CLASS} bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200 cursor-pointer hover:bg-amber-200 dark:hover:bg-amber-800`;
case 'success':
return `${UPDATE_BUTTON_BASE_CLASS} bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300`;
case 'error':
@@ -118,8 +121,11 @@ export function getUpdateButtonLabel(state: UpdateState, settingsLoaded: boolean
switch (state) {
case 'updating':
return 'Updating...';
+ case 'queued':
+ case 'inconclusive':
+ return 'Review action';
case 'success':
- return 'Queued!';
+ return 'Completed';
case 'error':
return 'Failed';
default:
@@ -137,6 +143,10 @@ export function getUpdateButtonTooltip(options: {
const now = options.now ?? Date.now();
switch (options.state) {
+ case 'queued':
+ return 'Action sent. Outcome not yet known. Select to check its receipt. Do not start another update.';
+ case 'inconclusive':
+ return 'Action outcome unknown. Check the running container and image before any retry. Select to review the audit.';
case 'updating': {
const elapsed = options.storeState
? Math.round((now - options.storeState.startedAt) / 1000)
@@ -148,7 +158,7 @@ export function getUpdateButtonTooltip(options: {
return `${step} (${elapsed}s)`;
}
case 'success':
- return '✓ Update completed successfully!';
+ return 'Update action completed. Check the running container and image.';
case 'error':
return `✗ Update failed: ${options.storeState?.message || options.errorMessage || 'Unknown error'}`;
default:
diff --git a/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts b/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts
index be2b908742..facab5ad26 100644
--- a/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts
+++ b/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts
@@ -1,9 +1,10 @@
-import { createEffect, createMemo, createSignal } from 'solid-js';
+import { createMemo, createSignal } from 'solid-js';
import { ResourceActionsAPI } from '@/api/resourceActions';
import {
getContainerUpdateState,
markContainerQueued,
markContainerUpdateError,
+ markContainerUpdateInconclusive,
markContainerUpdateSuccess,
updateStates,
} from '@/stores/containerUpdates';
@@ -47,12 +48,15 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {
if (stored) {
switch (stored.state) {
case 'queued':
+ return 'queued';
case 'updating':
return 'updating';
case 'success':
return 'success';
case 'error':
return 'error';
+ case 'inconclusive':
+ return 'inconclusive';
}
}
@@ -62,15 +66,6 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {
return local === 'planning' ? 'updating' : local;
};
- createEffect(() => {
- const stored = storeState();
- if (stored && (stored.state === 'queued' || stored.state === 'updating')) {
- if (props.updateStatus?.updateAvailable === false) {
- markContainerUpdateSuccess(props.agentId, props.containerId);
- }
- }
- });
-
const hasUpdate = () =>
hasContainerUpdate(props.updateStatus) ||
hasContainerUpdateError(props.updateStatus) ||
@@ -90,17 +85,25 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {
const isUpdateUnavailable = () => Boolean(updateUnavailableReason());
const isButtonDisabled = () =>
- currentState() === 'updating' || !settingsLoaded() || isUpdateUnavailable();
+ currentState() === 'updating' ||
+ ((currentState() === 'queued' || currentState() === 'inconclusive') &&
+ !storeState()?.actionId) ||
+ !settingsLoaded() ||
+ isUpdateUnavailable();
const buttonTooltip = () => {
if (!settingsLoaded()) return 'Loading settings...';
const refusal = updateUnavailableReason();
if (refusal) return `Update unavailable: ${refusal}`;
- return getUpdateButtonTooltip({
- state: currentState(),
+ const state = currentState();
+ const tooltip = getUpdateButtonTooltip({
+ state,
updateStatus: props.updateStatus,
storeState: storeState(),
errorMessage: errorMessage(),
});
+ return (state === 'queued' || state === 'inconclusive') && errorMessage()
+ ? `${errorMessage()} ${tooltip}`
+ : tooltip;
};
const buttonLabel = () => getUpdateButtonLabel(currentState(), settingsLoaded());
@@ -145,6 +148,19 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {
event.preventDefault();
const state = currentState();
+ if (state === 'queued' || state === 'inconclusive') {
+ const actionId = storeState()?.actionId;
+ if (!actionId) return;
+ try {
+ const detail = await ResourceActionsAPI.getAction(actionId);
+ setReviewDetail(detail);
+ handleReviewChanged(detail);
+ setErrorMessage('');
+ } catch {
+ setErrorMessage('Could not re-read the action. No new update was sent.');
+ }
+ return;
+ }
if (state === 'updating' || state === 'success' || state === 'error') return;
if (isUpdateUnavailable()) return;
@@ -161,15 +177,19 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {
setReviewDetail(detail);
const state = detail.audit.state;
if (state === 'executing') {
- markContainerQueued(props.agentId, props.containerId);
+ markContainerQueued(props.agentId, props.containerId, detail.audit.id);
props.onUpdateTriggered?.();
return;
}
if (!ACTION_TERMINAL_STATES.includes(state)) return;
if (state === 'completed') {
- markContainerQueued(props.agentId, props.containerId);
+ markContainerUpdateSuccess(props.agentId, props.containerId);
props.onUpdateTriggered?.();
} else if (state === 'failed') {
+ if (detail.audit.result?.actionResultV2?.execution.reasonCode === 'operator_force_failed') {
+ markContainerUpdateInconclusive(props.agentId, props.containerId, detail.audit.id);
+ return;
+ }
const message = 'The update action failed. Open Actions for the audit trail.';
setErrorMessage(message);
markContainerUpdateError(props.agentId, props.containerId, message);
diff --git a/frontend-modern/src/stores/__tests__/containerUpdates.test.ts b/frontend-modern/src/stores/__tests__/containerUpdates.test.ts
index 06bbbc2643..4bba01c620 100644
--- a/frontend-modern/src/stores/__tests__/containerUpdates.test.ts
+++ b/frontend-modern/src/stores/__tests__/containerUpdates.test.ts
@@ -55,4 +55,30 @@ describe('containerUpdates store lifecycle', () => {
expect(store.getContainerUpdateState('agent-1', 'container-1')?.state).toBe('queued');
});
+
+ it('does not turn a governed pending audit into success from a legacy command or elapsed time', async () => {
+ const store = await loadStore();
+ store.markContainerQueued('agent-1', 'container-1', 'action-1');
+ store.syncWithAgentCommand('agent-1', {
+ id: 'command:container-1',
+ type: 'update_container',
+ status: 'completed',
+ } as never);
+ vi.advanceTimersByTime(6 * 60_000);
+ expect(store.getContainerUpdateState('agent-1', 'container-1')).toMatchObject({
+ state: 'queued',
+ actionId: 'action-1',
+ });
+ });
+
+ it('keeps an operator-closed unknown outcome reviewable without presenting it as failed', async () => {
+ const store = await loadStore();
+ store.markContainerQueued('agent-1', 'container-1', 'action-1');
+ store.markContainerUpdateInconclusive('agent-1', 'container-1', 'action-1');
+ vi.advanceTimersByTime(6 * 60_000);
+ expect(store.getContainerUpdateState('agent-1', 'container-1')).toMatchObject({
+ state: 'inconclusive',
+ actionId: 'action-1',
+ });
+ });
});
diff --git a/frontend-modern/src/stores/containerUpdates.ts b/frontend-modern/src/stores/containerUpdates.ts
index 11498913a7..6d31dead1d 100644
--- a/frontend-modern/src/stores/containerUpdates.ts
+++ b/frontend-modern/src/stores/containerUpdates.ts
@@ -7,13 +7,16 @@
import { createSignal } from 'solid-js';
import type { DockerRuntimeCommand } from '@/types/api';
-export type ContainerUpdateState = 'queued' | 'updating' | 'success' | 'error';
+export type ContainerUpdateState = 'queued' | 'updating' | 'success' | 'error' | 'inconclusive';
interface UpdateEntry {
state: ContainerUpdateState;
startedAt: number;
message?: string;
commandId?: string;
+ // A governed action must be reconciled from its audit, not inferred from an
+ // unrelated image-registry check or a legacy command on the same container.
+ actionId?: string;
// Real-time progress from backend
backendStatus?: string;
acknowledgedAt?: number;
@@ -104,11 +107,7 @@ export function markContainerUpdating(
/**
* Mark a container update as queued (command sent, waiting for agent)
*/
-export function markContainerQueued(
- agentId: string,
- containerId: string,
- commandId?: string,
-): void {
+export function markContainerQueued(agentId: string, containerId: string, actionId?: string): void {
const key = `${agentId}:${containerId}`;
clearPendingAutoClearTimer(key);
setUpdateStates((prev) => ({
@@ -116,11 +115,24 @@ export function markContainerQueued(
[key]: {
state: 'queued',
startedAt: Date.now(),
- commandId,
+ actionId,
},
}));
}
+export function markContainerUpdateInconclusive(
+ agentId: string,
+ containerId: string,
+ actionId: string,
+): void {
+ const key = `${agentId}:${containerId}`;
+ clearPendingAutoClearTimer(key);
+ setUpdateStates((prev) => ({
+ ...prev,
+ [key]: { state: 'inconclusive', startedAt: prev[key]?.startedAt || Date.now(), actionId },
+ }));
+}
+
/**
* Sync container update state with backend command status from WebSocket.
* This provides real-time progress tracking.
@@ -140,6 +152,7 @@ export function syncWithAgentCommand(
// Check if we're tracking this update
const existing = updateStates()[key];
if (!existing) return;
+ if (existing.actionId) return;
// Update based on backend status
if (command.status === 'completed' || command.completedAt) {
@@ -225,7 +238,12 @@ export function cleanupStaleUpdates(): void {
setUpdateStates((prev) => {
const next: Record<string, UpdateEntry> = {};
for (const [key, entry] of Object.entries(prev)) {
- if (now - entry.startedAt < STALE_THRESHOLD_MS) {
+ // Keep an unresolved governed action reviewable until its audit has a
+ // known outcome. Time passing is not an execution result.
+ if (
+ (entry.actionId && (entry.state === 'queued' || entry.state === 'inconclusive')) ||
+ now - entry.startedAt < STALE_THRESHOLD_MS
+ ) {
next[key] = entry;
} else {
clearPendingAutoClearTimer(key);