Skip to content

perf: room poll every 60 s by default, configurable via CARWATCH_POLL_SECONDS - #58

Closed
ThinkOffApp wants to merge 1 commit into
mainfrom
perf/agent-poll-interval
Closed

ThinkOffApp wants to merge 1 commit into
mainfrom
perf/agent-poll-interval

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

Why

carwatch.agent polled 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_SECONDS defaults to 60 (was 20) and reads CARWATCH_POLL_SECONDS from the environment, floor 5 s.
  • One line, no behaviour change other than cadence.

Effect

4,320 → 1,440 requests a day per car at the default. Set CARWATCH_POLL_SECONDS=20 in the unit's Environment= to keep the old cadence on a box that wants it.

Deploy

After merge: git pull on the VTA and systemctl 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

…_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>
@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
carwatch-dev Ready Ready Preview Sep 15, 2026 5:16pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-15T17:19:02.449767Z 16a9ad9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThinkOffApp

Copy link
Copy Markdown
Owner Author

Duplicate of #57, which was opened four minutes earlier and also covers the dash idle back-off. Closing this one; the CARWATCH_POLL_SECONDS override idea is the only thing not in #57, take it or leave it there.

@ThinkOffApp
ThinkOffApp deleted the perf/agent-poll-interval branch September 15, 2026 17:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread carwatch/agent.py
# 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))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant