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.

fix(api): validate Docker update agent running health readback

pulse-triage[bot]135abb541439
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 675be4e0b7..ffb8e6c262 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -2877,6 +2877,22 @@ traverse an agent.
## Completion Obligations
+### Docker update readback is not mutation history
+
+The agent's post-update inspect can observe a running replacement whose health
+has not settled or has deteriorated after module success. The API must retain
+the completed mutation as execution history without treating replacement
+identity alone as confirmed running health. Agent-attested verification requires
+running state and healthy or explicit no-healthcheck evidence for running
+replacements; unknown health remains inconclusive. This does not trigger an
+automatic resend or rollback and preserves deliberately stopped updates.
+
+Verification: `TestDockerContainerUpdateAgentReadbackMustSupportRunningClaim`
+asserts both verification outcomes and unchanged successful execution.
+`TestDockerContainerActionExecutorDispatchesTypedUpdate` retains typed-only
+dispatch with explicit no-healthcheck readback evidence.
+
+
Command-capable agent completion must prove more than fresh telemetry. The
dedicated agent listener must admit the full bootstrap/report/WebSocket
lifecycle, command sessions must be keyed by organization plus canonical bound
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index c1b52037f3..8b399d0ca9 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -3581,6 +3581,22 @@ counters exist to measure.
## Completion Obligations
+### Docker update agent-attested running verification
+
+In `internal/api/docker_container_action_result.go`, a matching replacement
+container ID is insufficient to confirm a running agent readback. A running
+replacement must report state `running` and health `healthy` or explicit
+`none`. Known unsuitable health or lifecycle states contradict verification;
+missing or unrecognised running health yields `inconclusive` with
+`container_health_unknown`. This does not change execution or compensation
+history, introduce a wire field, or require stopped replacements to run.
+
+Verification: `TestDockerContainerUpdateAgentReadbackMustSupportRunningClaim`
+in `internal/api/docker_container_action_result_test.go` covers healthy,
+no-healthcheck, stopped, unhealthy, starting, restarting and unknown-health
+readbacks. The typed-dispatch fixture supplies explicit no-healthcheck evidence.
+
+
The public connection ledger and action APIs must project telemetry liveness
and command admission independently. An agent may be adapter-healthy while
remote control is `disconnected`; in that state command policy is blocked and
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index c946cfb22a..c22a78f81f 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -2114,6 +2114,22 @@ take a correctness dependency on its contents.
## Completion Obligations
+### Recovered Docker update evidence preserves health uncertainty
+
+The shared API action-result boundary must not turn a matching replacement ID
+into confirmed running health when the agent readback reports unhealthy,
+health-check starting or restarting. Unknown running health remains
+inconclusive, while the recorded completed execution and compensation facts
+remain unchanged. This rule does not settle missing receipts, prove intended
+stopped state, or authorise redispatch of a recovered update.
+
+Verification: `TestDockerContainerUpdateAgentReadbackMustSupportRunningClaim`
+in `internal/api/docker_container_action_result_test.go` pins these result
+distinctions. Existing `TestIssue1649StrandedDockerUpdateReconcilesWithoutRedispatch`
+and `TestRouterRecoverExecutingDockerUpdateAfterCapabilityDisappears` exercise
+reconciliation without treating the verification correction as a new mutation.
+
+
Coverage rows reconcile replacement recovery-model snapshots by their logical
`key` before windowing. Refreshed names must render without discarding expanded
restore evidence or keyboard focus on a surviving row. Verify with
diff --git a/internal/api/docker_container_action_executor_test.go b/internal/api/docker_container_action_executor_test.go
index 6f41024b79..63de8eb8a7 100644
--- a/internal/api/docker_container_action_executor_test.go
+++ b/internal/api/docker_container_action_executor_test.go
@@ -120,7 +120,7 @@ func (f *fakeDockerActionAgentCommander) ExecuteDockerContainerUpdate(_ context.
OldImageDigest: "sha256:1111111111111111111111111111111111111111111111111111111111111111",
NewImageDigest: "sha256:2222222222222222222222222222222222222222222222222222222222222222",
BackupCreated: true, BackupContainer: "api_pulse_backup_20260714_000000",
- After: agentexec.DockerContainerLifecycleSnapshot{ContainerID: newID, State: "running", Running: true, StartedAt: now, ObservedAt: now},
+ After: agentexec.DockerContainerLifecycleSnapshot{ContainerID: newID, State: "running", Running: true, Health: agentexec.DockerContainerHealthNone, StartedAt: now, ObservedAt: now},
}, nil
}
diff --git a/internal/api/docker_container_action_result.go b/internal/api/docker_container_action_result.go
index e8253d456d..7d67f9e2a0 100644
--- a/internal/api/docker_container_action_result.go
+++ b/internal/api/docker_container_action_result.go
@@ -115,7 +115,15 @@ func dockerContainerUpdateExecutionResult(resourceID, agentID string, facts agen
}
status := unified.ActionVerificationContradicted
reason := "postcondition_contradicted"
- if dockerUpdateFactsMatch(facts, facts.After.ContainerID) {
+ // A running replacement must also have a usable running/health
+ // readback; identity alone must not confirm an unhealthy update.
+ // Preserve updates of containers intentionally left stopped.
+ if facts.After.Running && !agentexec.IsDockerContainerHealth(facts.After.Health) {
+ status = unified.ActionVerificationInconclusive
+ reason = "container_health_unknown"
+ } else if dockerUpdateFactsMatch(facts, facts.After.ContainerID) &&
+ (!facts.After.Running || (facts.After.State == "running" &&
+ agentexec.DockerContainerHealthAllowsVerifiedRunningState(facts.After.Health))) {
status = unified.ActionVerificationConfirmed
reason = ""
}
diff --git a/internal/api/docker_container_action_result_test.go b/internal/api/docker_container_action_result_test.go
index f2eafee243..b0365279ea 100644
--- a/internal/api/docker_container_action_result_test.go
+++ b/internal/api/docker_container_action_result_test.go
@@ -106,7 +106,7 @@ func TestDockerContainerUpdateExecutionResultClampsBoundedPositiveAgentClockSkew
facts := agentexec.DockerContainerUpdateResultPayload{
Operation: agentexec.DockerContainerOperationUpdate, ActionID: "action-update", ExecutionPhase: agentexec.DockerContainerPhaseComplete,
MutationStarted: true, MutationCompleted: true, ReadbackRan: true, NewContainerID: dockerLifecycleTestID,
- After: agentexec.DockerContainerLifecycleSnapshot{ContainerID: dockerLifecycleTestID, State: "running", Running: true, ObservedAt: observedAt},
+ After: agentexec.DockerContainerLifecycleSnapshot{ContainerID: dockerLifecycleTestID, State: "running", Running: true, Health: agentexec.DockerContainerHealthHealthy, ObservedAt: observedAt},
}
result, err := dockerContainerUpdateExecutionResult("app-container:fixture", "agent-1", facts, nil, receivedAt)
if err != nil {
@@ -244,3 +244,38 @@ func TestDockerContainerUpdateIndependentObservationMustMatchState(t *testing.T)
})
}
}
+
+func TestDockerContainerUpdateAgentReadbackMustSupportRunningClaim(t *testing.T) {
+ now := time.Now().UTC()
+ for _, tc := range []struct {
+ name, state, health string
+ running bool
+ want unified.ActionVerificationStatus
+ }{
+ {"healthy", "running", "healthy", true, unified.ActionVerificationConfirmed},
+ {"no healthcheck", "running", "none", true, unified.ActionVerificationConfirmed},
+ {"stopped preserved", "created", "none", false, unified.ActionVerificationConfirmed},
+ {"unhealthy", "running", "unhealthy", true, unified.ActionVerificationContradicted},
+ {"starting", "running", "starting", true, unified.ActionVerificationContradicted},
+ {"restarting", "restarting", "healthy", true, unified.ActionVerificationContradicted},
+ {"unknown health", "running", "", true, unified.ActionVerificationInconclusive},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ facts := agentexec.DockerContainerUpdateResultPayload{
+ Operation: agentexec.DockerContainerOperationUpdate, ActionID: "action-update", ExecutionPhase: agentexec.DockerContainerPhaseComplete,
+ MutationStarted: true, MutationCompleted: true, ReadbackRan: true, NewContainerID: dockerLifecycleTestID,
+ After: agentexec.DockerContainerLifecycleSnapshot{ContainerID: dockerLifecycleTestID, State: tc.state, Running: tc.running, Health: tc.health, ObservedAt: now},
+ }
+ result, err := dockerContainerUpdateExecutionResult("app-container:fixture", "agent-1", facts, nil, now)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := result.ActionResultV2.Verification; got.Status != tc.want || got.EvidenceClass != unified.ActionEvidenceAgentAttested {
+ t.Fatalf("verification = %+v, want %s / agent_attested", got, tc.want)
+ }
+ if result.ActionResultV2.Execution.Status != unified.ActionExecutionSucceeded {
+ t.Fatal("readback changed execution history")
+ }
+ })
+ }
+}