From 16a9ad9e0b3b57818fb051a77470a057f3ed527b Mon Sep 17 00:00:00 2001 From: Petrus Pennanen Date: Tue, 15 Sep 2026 20:15:55 +0300 Subject: [PATCH] perf: room poll every 60 s by default, configurable via CARWATCH_POLL_SECONDS The agent polled the room every 20 s, 4,320 GroupMind requests a day from one car, billed per invocation on Vercel. It answers when addressed, so a 60 s cadence loses nothing a person notices and cuts the box to 1,440 a day. Petrus, 2026-09-15: "please make the changes immediately to reduce unnecessary polling." CARWATCH_POLL_SECONDS overrides it (floor 5 s) for a session that wants the old feel without a code change. Co-Authored-By: Claude Fable 5.1 --- carwatch/agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/carwatch/agent.py b/carwatch/agent.py index 7ff4ea0..cfac12c 100644 --- a/carwatch/agent.py +++ b/carwatch/agent.py @@ -86,7 +86,11 @@ def car_identity() -> dict: car.update({k: v for k, v in (cfg.get("car") or {}).items() if v}) return car STATE_PATH = os.path.expanduser("~/.carwatch/agent-state.json") -POLL_SECONDS = 20 +# Room poll cadence. Every tick is one GroupMind request, which is billed per +# invocation, and the car agent answers when spoken to, not on a stopwatch: +# 60 s keeps it responsive and cuts the box from 4,320 to 1,440 reads a day. +# Override with CARWATCH_POLL_SECONDS (minimum 5). +POLL_SECONDS = max(5, int(os.environ.get("CARWATCH_POLL_SECONDS", "60") or 60)) MAX_TOKENS = 400