perf: room poll every 60 s by default, configurable via CARWATCH_POLL_SECONDS - #58
ThinkOffApp wants to merge 1 commit into
Conversation
…_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 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16a9ad9e0b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # 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)) |
There was a problem hiding this comment.
Prevent the longer poll from dropping busy-room messages
When an idle room receives more than 20 messages during this new 60-second interval, the agent silently misses the older messages—including any question addressed to the car—because _fetch_messages() still requests only 20 entries, and RoomClient.fetch() documents that the server returns newest-first (carwatch/room.py:59-66). The loop then advances last_seen through those newest entries, so omitted messages are never recovered. The previous cadence could keep up with roughly three times the sustained traffic; increase the fetch capacity or paginate from last_seen before lengthening the interval.
Useful? React with 👍 / 👎.
Why
carwatch.agentpolled the room every 20 s: 4,320 GroupMind requests a day from one car, billed per invocation on Vercel. The agent answers when addressed, so a faster tick buys nothing a person notices. Measured on the VTA today alongside a second local room agent at 15 s; Petrus asked for the polling cut immediately (thinkoff-development, 2026-09-15 17:10Z).Change
POLL_SECONDSdefaults to 60 (was 20) and readsCARWATCH_POLL_SECONDSfrom the environment, floor 5 s.Effect
4,320 → 1,440 requests a day per car at the default. Set
CARWATCH_POLL_SECONDS=20in the unit'sEnvironment=to keep the old cadence on a box that wants it.Deploy
After merge:
git pullon the VTA andsystemctl restart carwatch-agent.service. The VTA's other poller (vta-room-agent.py, a local script) was moved from 15 s to 60 s directly, backup kept.🤖 Generated with Claude Code