docs(websocket): fix dead-socket watchdog anchor description - #393
Conversation
Reflects whatsapp-rust#995: the watchdog is armed on the first send since the last receive, not the most recent send.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
|
| Filename | Overview |
|---|---|
| advanced/websocket-handling.mdx | Updates 'Dead socket detection' section to describe the new first_send_since_recv_ms anchor, corrects DEAD_SOCKET_TIME description, and adds a detailed prose paragraph explaining the pre-fix vs post-fix behavior difference. |
| concepts/architecture.mdx | Adds first_send_since_recv_ms to the atomic-timestamps list and updates the dead-socket detection bullet to reference the new anchor and deadSocketTimer.onOrBefore, consistent with the websocket-handling.mdx update. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Keepalive tick]) --> B{anchor ==\nfirst_send_since_recv_ms}
B -->|anchor == 0| C[Watchdog NOT armed\nNothing sent since last receive]
B -->|anchor > 0| D{now - anchor\n>= 20s ?}
D -->|No| E[Watchdog running,\nstill within deadline]
D -->|Yes| F[DEAD SOCKET\nreconnect_immediately]
G([Frame received]) --> H[Reset anchor to 0\nWatchdog cancelled]
I([Frame sent]) --> J{anchor == 0 OR\nanchor <= last_recv ?}
J -->|Yes| K[Arm watchdog:\nanchor = now]
J -->|No| L[Anchor unchanged\nKeep earliest deadline]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A([Keepalive tick]) --> B{anchor ==\nfirst_send_since_recv_ms}
B -->|anchor == 0| C[Watchdog NOT armed\nNothing sent since last receive]
B -->|anchor > 0| D{now - anchor\n>= 20s ?}
D -->|No| E[Watchdog running,\nstill within deadline]
D -->|Yes| F[DEAD SOCKET\nreconnect_immediately]
G([Frame received]) --> H[Reset anchor to 0\nWatchdog cancelled]
I([Frame sent]) --> J{anchor == 0 OR\nanchor <= last_recv ?}
J -->|Yes| K[Arm watchdog:\nanchor = now]
J -->|No| L[Anchor unchanged\nKeep earliest deadline]
Reviews (3): Last reviewed commit: "docs(architecture): fix dangling modifie..." | Re-trigger Greptile
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 5/5
- In
advanced/websocket-handling.mdx, the dead-socket explanation appears to conflict with the architecture summary (including the watchdog anchor toSessionStats::first_send_since_recv_ms), which could confuse readers about the actual timeout behavior and lead to incorrect implementations — align the two docs’ watchdog description before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…v_ms anchor Addresses cubic-dev-ai review comment on PR #393 — the architecture summary still described the pre-#995 last_data_sent_ms/"20s after a send" model, contradicting the corrected websocket-handling.mdx page.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Good catch — Generated by Claude Code |
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
Addresses greptile-apps readability nit — "triggering immediate reconnection" now attaches to "Detects dead socket" instead of reading as attached to the "subsequent sends" clause.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Auto-approved: Documentation-only fixes correcting dead-socket watchdog anchor description. No code, config, or logic changes. Low impact and safe.
Re-trigger cubic
What
Updates the "Dead socket detection" section of
advanced/websocket-handling.mdxto reflect whatsapp-rust#995.Why
That PR fixed a bug where the dead-socket watchdog was anchored to the most recent send (
last_data_sent_ms), which let continued outgoing traffic (messages, receipts, presence) keep pushing the 20s deadline forward and mask a half-open socket indefinitely. The fix anchors the watchdog toSessionStats::first_send_since_recv_ms— the first send since the last receive — matching WA Web'sdeadSocketTimer.onOrBeforesemantics, which keep the earliest armed deadline rather than the most recent one.The docs previously described the pre-fix (buggy) behavior:
DEAD_SOCKET_TIME(20s) has elapsed since the last send with no receive"is_dead_socket(last_sent, last_recv)unconditionally each iteration"Changes
advanced/websocket-handling.mdx:DEAD_SOCKET_TIMEconstant description to describe the anchor (first send since last receive) rather than the last send.SessionStats::first_send_since_recv_msfield.deadSocketTimer.onOrBeforeand theis_dead_socket(first_send_since_recv, last_recv)call signature.No other docs needed updates — this PR is internal to the keepalive/reconnect implementation with no public API changes.
Generated by Claude Code
Summary by cubic
Fixes dead-socket detection docs to anchor the watchdog to the first send since the last receive, not the most recent send, matching WA Web’s
deadSocketTimer.onOrBefore. UpdatesDEAD_SOCKET_TIMEwording to keep the earliest deadline, alignsconcepts/architecture.mdxto referencefirst_send_since_recv_ms, and clarifies the dead-socket bullet so “triggering immediate reconnection” modifies the correct clause.Written for commit a1a3129. Summary will update on new commits.