Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(daemon): stop logging the WS-satisfied heartbeat tick (#11063)
Paul Philippovdb067676f6e8
diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 588bd2f929..41953ef4c0 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -4696,7 +4696,16 @@ func (d *Daemon) runHeartbeatTick(ctx context.Context, rid string) bool {// automatically on the next tick — that is the fallback the WS path// relies on.if d.wsHeartbeatRecentlyAcked(rid) {- d.logger.Debug("heartbeat: skipping HTTP tick, WS recently acked", "runtime_id", rid)+ // No log line here on purpose. This is the steady state for a healthy+ // daemon: every registered runtime takes this branch on every tick, so+ // logging it costs one line per runtime per interval — forever, and even+ // when the daemon is idle. With the handful of provider CLIs a typical+ // developer machine has installed that is a continuous ~1 line/s into+ // daemon.log, which dominated the file (~97% of its bytes) and kept+ // writing to disk around the clock for a condition that needs no+ // attention. The transition that actually matters — WS heartbeat going+ // quiet and HTTP taking over — is still observable via the "HTTP tick"+ // line below.return false}d.logger.Debug("heartbeat: HTTP tick", "runtime_id", rid)diff --git a/server/internal/daemon/wakeup_test.go b/server/internal/daemon/wakeup_test.goindex afad87faa7..c9a22db074 100644--- a/server/internal/daemon/wakeup_test.go+++ b/server/internal/daemon/wakeup_test.go@@ -1,6 +1,7 @@package daemonimport (+ "bytes""context""encoding/json""errors"@@ -196,6 +197,31 @@ func TestWSHeartbeatFreshnessSuppressesHTTP(t *testing.T) {}}+// TestHeartbeatSkipIsSilent pins that the WS-satisfied branch of the per-runtime+// heartbeat writes nothing to the log. It is the steady state of a healthy+// daemon, taken once per runtime per interval, so a line here grows daemon.log+// without bound and keeps an idle daemon writing to disk around the clock.+func TestHeartbeatSkipIsSilent(t *testing.T) {+ var logs bytes.Buffer+ d := New(Config{HeartbeatInterval: 15 * time.Second},+ slog.New(slog.NewTextHandler(&logs, &slog.HandlerOptions{Level: slog.LevelDebug})))++ d.recordWSHeartbeatAck("runtime-1")+ if !d.wsHeartbeatRecentlyAcked("runtime-1") {+ t.Fatalf("expected just-acked runtime to be fresh")+ }++ // The client is nil on purpose: a logging regression on this path is+ // caught by the assertion below, while a behavioural regression (the+ // branch letting the tick fall through to the HTTP call) panics here+ // instead of quietly passing.+ d.runHeartbeatTick(context.Background(), "runtime-1")++ if logs.Len() != 0 {+ t.Fatalf("WS-satisfied heartbeat tick must not log, got: %q", logs.String())+ }+}+func TestReadTaskWakeupMessagesAcceptsLargeRPCResponse(t *testing.T) {overrideTaskWakeupTimings(t, time.Second, 100*time.Millisecond, taskWakeupBackoffResetAfter)