fix: silently ignore heartbeat_ack instead of logging 'Unknown command type' (v1.3.0)

The server replies to the agent's own heartbeat with heartbeat_ack; the agent
had no case for it, so it fell through to the unknown-command handler, logged
'Unknown command type: heartbeat_ack' every minute, and answered with a spurious
error response. heartbeats are fire-and-forget acks — nothing to run, nothing to
reply.
This commit is contained in:
2026-08-04 18:53:04 -04:00
parent 6500fadafb
commit 847438177e
+7
View File
@@ -311,6 +311,13 @@ func handleCommand(cm *ConfigManager, msg WSMessage, c MessageWriter, exec Execu
respPayload, _ := json.Marshal(resp) respPayload, _ := json.Marshal(resp)
c.WriteMessage(websocket.TextMessage, respPayload) c.WriteMessage(websocket.TextMessage, respPayload)
return return
// heartbeat_ack is the server's acknowledgement of the agent's own periodic
// heartbeat (the agent sends `heartbeat`, the server answers `heartbeat_ack`).
// There is nothing to do with it -- it is not a command to run, and answering
// an ack with an error response would inject spurious errors into the
// command-response channel every minute. Silently ignore.
case "heartbeat_ack":
return
default: default:
log.Printf("Unknown command type: %s", msg.Type) log.Printf("Unknown command type: %s", msg.Type)
sendResponse("error", "unknown command type") sendResponse("error", "unknown command type")