Compare commits

..

1 Commits

Author SHA1 Message Date
wmantly 847438177e 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.
2026-08-04 18:53:04 -04:00
4 changed files with 1 additions and 33 deletions
-5
View File
@@ -5,11 +5,6 @@ All notable changes to the `theta-agent` daemon will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.3.0] - 2026-08-04
### Fixed
- **Silently ignore `heartbeat_ack`** — the server replies to the agent's own periodic 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. Heartbeat acks are fire-and-forget; the agent now ignores them silently.
## [v1.2.0] - 2026-08-03
### Added
Binary file not shown.
+1 -5
View File
@@ -139,11 +139,7 @@ func connectWebSocket(cm *ConfigManager, exec Executor) {
func handleCommand(cm *ConfigManager, msg WSMessage, c MessageWriter, exec Executor) {
cfg := cm.Get()
// Don't log the server's fire-and-forget heartbeat ack — it arrives every
// 60s and is not a command to act on; logging it is pure per-minute noise.
if msg.Type != "heartbeat_ack" {
log.Printf("Received command: %s", msg.Type)
}
log.Printf("Received command: %s", msg.Type)
sendResponse := func(status string, message string) {
resp, _ := json.Marshal(map[string]string{"status": status, "message": message})
-23
View File
@@ -51,9 +51,6 @@ func TestHandleCommand(t *testing.T) {
expectedCmd []string
expectedFile string
expectedFileCont string
// heartbeat_ack (and any fire-and-forget ack) must be silently ignored —
// no response message, no command, no log noise.
expectedNoResponse bool
}{
{
name: "config command success",
@@ -178,16 +175,6 @@ func TestHandleCommand(t *testing.T) {
expectedStatus: "error",
expectedCmd: nil,
},
{
name: "heartbeat_ack is silently ignored",
cfg: &Config{
Capabilities: Capabilities{},
},
msg: WSMessage{
Type: "heartbeat_ack",
},
expectedNoResponse: true,
},
{
name: "unknown command",
cfg: &Config{
@@ -207,16 +194,6 @@ func TestHandleCommand(t *testing.T) {
cm := &ConfigManager{current: tc.cfg}
handleCommand(cm, tc.msg, mockConn, mockExec)
if tc.expectedNoResponse {
if len(mockConn.Messages) != 0 {
t.Fatalf("expected no response message, got %d: %v", len(mockConn.Messages), mockConn.Messages)
}
if len(mockExec.ExecutedCommands) > 0 {
t.Errorf("expected no commands to be executed, but got %v", mockExec.ExecutedCommands)
}
return
}
if len(mockConn.Messages) != 1 {
t.Fatalf("expected 1 response message, got %d", len(mockConn.Messages))
}