From 9081ac3bcae1021a4e700235286262c294c00c9c Mon Sep 17 00:00:00 2001 From: John Fawcett Date: Sat, 21 Mar 2026 15:52:16 +0000 Subject: [PATCH] fix: skip container_status events for running containers Filter out 'running' status in the alarm pre-phase before calling upsertContainerStatus(). Running is the steady-state for healthy agents and a no-op in applyEvent(), so recording it just bloats the event table (~720 events/hour/agent). Non-running statuses (stopped, error, unknown) still get inserted for reconciler detection. --- cloudflare-gastown/src/dos/Town.do.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cloudflare-gastown/src/dos/Town.do.ts b/cloudflare-gastown/src/dos/Town.do.ts index 0cf7c974a7..37c48c2645 100644 --- a/cloudflare-gastown/src/dos/Town.do.ts +++ b/cloudflare-gastown/src/dos/Town.do.ts @@ -2891,10 +2891,16 @@ export class TownDO extends DurableObject { townId, row.bead_id ); - events.upsertContainerStatus(this.sql, row.bead_id, { - status: containerInfo.status, - exit_reason: containerInfo.exitReason, - }); + // Skip inserting events for 'running' — it's the steady-state and + // a no-op in applyEvent, so recording it just bloats the event table + // (~720 events/hour/agent). Non-running statuses (stopped, error, + // unknown) still get inserted so the reconciler can detect and handle them. + if (containerInfo.status !== 'running') { + events.upsertContainerStatus(this.sql, row.bead_id, { + status: containerInfo.status, + exit_reason: containerInfo.exitReason, + }); + } } catch (err) { console.warn( `${TOWN_LOG} alarm: container status check failed for agent=${row.bead_id}`,