From abccbcafb6c1956e9548e7c5057e4bf634c4ac06 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 3 Jan 2026 19:05:18 +0000 Subject: [PATCH] fix: Container update command incorrectly removes Docker host and revokes token When a container update command completed successfully, the server was incorrectly returning shouldRemove=true, which caused the Docker host to be removed and its API token revoked. This caused 401 Unauthorized errors for subsequent agent reports. The fix ensures shouldRemove is only true for "stop" commands, not for "update_container" or "check_updates" commands. Related to #1020 --- internal/monitoring/docker_commands.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/monitoring/docker_commands.go b/internal/monitoring/docker_commands.go index f7d869e41..f9d35c371 100644 --- a/internal/monitoring/docker_commands.go +++ b/internal/monitoring/docker_commands.go @@ -362,7 +362,11 @@ func (m *Monitor) acknowledgeDockerCommand(commandID, hostID, status, message st case DockerCommandStatusCompleted: cmd.markAcknowledged(message) cmd.markCompleted(message) - shouldRemove = true + // Only remove the Docker host if this was a "stop" command. + // Other commands (update_container, check_updates) should not remove the host. + if cmd.status.Type == DockerCommandTypeStop { + shouldRemove = true + } case DockerCommandStatusFailed: cmd.markFailed(message) m.state.SetDockerHostPendingUninstall(resolvedHostID, false)