Skip to content

Fixes #4777: broadcast presence heartbeats on HEARTBEAT_INTERVAL - #4778

Merged
dezren39 merged 1 commit into
mainfrom
queue/6781-4777-heartbeat-interval
Nov 3, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6781-4777-heartbeat-interval

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Fixes #4777

HEARTBEAT_INTERVAL (25s) in pkgs/id/src/chat_presence.rs was defined and documented — "two to three heartbeats land inside one TTL window, so a single dropped gossip message never flickers a live node stale" — but had no use site anywhere in the repo. serve broadcast its only presence heartbeat inside the peer-announcement task, timed by ANNOUNCE_INTERVAL (30s), so heartbeats actually went out every 30s against the 75s TTL: one dropped broadcast was tolerated, not the documented margin.

Change (pkgs/id/src/commands/serve.rs only)

  • The announce task now runs two independent timers via tokio::select!: peer announcements keep ANNOUNCE_INTERVAL; presence heartbeats get their own timer driven by presence_heartbeat_period().
  • presence_heartbeat_period() returns HEARTBEAT_INTERVAL as the single source for the cadence.
  • New pinning test presence_heartbeat_period_is_the_documented_interval: asserts the gossip-loop period equals HEARTBEAT_INTERVAL, differs from ANNOUNCE_INTERVAL, and that two heartbeats land inside one PRESENCE_TTL_SECS window — so the constant cannot silently go dead again.

Untouched per the packet scope: PresenceTable semantics, ANNOUNCE_INTERVAL itself, presence scoping (#4363) and the table node bound (#4004).

Verification

CI-first per repo policy: targeted tests (cargo test --lib chat_presence plus the new serve wiring test) run in GitHub Actions on this PR; no local build was run. Queue task 6781.

serve broadcast presence only inside the peer-announcement task, so heartbeats went out every ANNOUNCE_INTERVAL (30s) while chat_presence documented HEARTBEAT_INTERVAL (25s) and the TTL drop-resilience it implies. HEARTBEAT_INTERVAL had no use site anywhere in the repo.

Give the announce task two independent timers via tokio::select!: announcements keep ANNOUNCE_INTERVAL, presence heartbeats get their own timer driven by presence_heartbeat_period(), which returns HEARTBEAT_INTERVAL as the single source. A unit test pins that wiring (period == HEARTBEAT_INTERVAL, != ANNOUNCE_INTERVAL, two heartbeats inside one PRESENCE_TTL_SECS window) so the constant cannot silently go dead again.

Fixes #4777
@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 06:39
@chatgpt-codex-connector

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 ⚠️ Failed 2026-11-03T06:39:04.718471Z
We couldn’t complete this review. Comment @codex review to try again.
95f053c 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.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fdddba33-3351-4e69-a3ce-40f27a8d2e55
Commits

Reviewing files that changed from the base of the PR and between c128305 and 95f053c.

Files selected for processing: 1
  • pkgs/id/src/commands/serve.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Codex findings disposition (task 6781): the Codex code review on commit 95f053c did not complete — the connector reported "We couldn't complete this review" and a follow-up that Codex usage limits for code reviews were reached. No inline findings, review bodies, or suggestions were posted (verified: zero PR review comments), so there are no Codex findings to fix or rebut on this PR. CodeRabbit likewise hit its free review limit without posting findings.

Verification instead: targeted tests on the laptop — cargo test --lib -- presence in pkgs/id: 65 passed, 0 failed, including the new presence_heartbeat_period_is_the_documented_interval pinning test and all chat_presence tests. (The repo's id/nix CI workflows are currently disabled_manually, so PR checks here are the line-limit check only.)

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.

id(chat-presence): HEARTBEAT_INTERVAL (25s) is defined and documented but never used — serve broadcasts presence on the 30s announcement cadence

1 participant