Repository navigation
fix(lifecycle): recheck host admission before queued dials - #1665
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 SummarySummary by CodeRabbit
Walkthrough
ChangesConnect admission rechecks
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant LifecycleRunLoop
participant wait_for_connect_admission
participant ConnectAdmission
LifecycleRunLoop->>ConnectAdmission: delay()
LifecycleRunLoop->>wait_for_connect_admission: initial delay and policy
wait_for_connect_admission->>ConnectAdmission: recheck() after delay
ConnectAdmission-->>wait_for_connect_admission: zero or extended delay
wait_for_connect_admission-->>LifecycleRunLoop: dialing allowed or wait again
Merge Risk: ⚪ Minimal · up to No merge-blocking risk was identified in the admission recheck change; normal validation can continue. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@coderabbitai review Please review the current head 3f01a56 while this PR remains a draft. In particular, check reservation compatibility, cancellation across repeated extensions, and the paused-time regression coverage. |
✅ Action performedReview finished.
|
|
📦 Binary size report
.text per crate
Baseline: |
|
Review follow-up for head 3f01a56: CodeRabbit approved with no actionable comments, and Greptile found no actionable issue. The docstring-coverage warning counts test functions/helpers along with the API. The new public Scope clarification: preserving timers on unrelated notifications and cancelling on pause/stop already existed in #1594. This PR preserves those properties across the new extension loop; it does not claim they were broken for the original one-shot wait. |
Merging this PR will degrade performance by 1.54%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | bench_session_with_self[false] |
1.2 µs | 1.3 µs | -8.22% |
| ❌ | Simulation | bench_session_with_self[true] |
1.2 µs | 1.3 µs | -8.21% |
| ⚡ | Simulation | bench_session_root_key_update |
460.9 ns | 406.7 ns | +13.32% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/1664-connect-admission-recheck (3f01a56) with main (7ed5b5d)
Footnotes
-
12 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Semver advisory triage for head 3f01a56: The informational semver job failed. The encompassing Supply Chain workflow reports success because this job has The unchanged xtask command checks only This job does not check |
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
|
CodSpeed advisory triage for 3f01a56 versus 7ed5b5d: The workflow passed, but its report flags CodSpeed attributes both benchmarks to an environment change from AMD EPYC 9V74 to EPYC 7763, with different CPU flags and linked-library metadata. For These are isolated |
Closes #1664. Follow-up to #1532 / #1594.
A cooldown learned while clients wait for reserved connection slots currently cannot postpone those dials. Add a provided
ConnectAdmission::recheck() -> Duration, called after the initial wait, including zero, and after every positive extension.delay()still reserves exactly once per attempt. Rechecks retain that reservation and its pause generation. The default returns zero, preserving existing delay-only policies, including the documented constant-positive-delay example.Extensions retain shutdown, supervision-stop and pause cancellation, do not count a dial or failure, and remain outside the transport timeout. Manual
connect()and WhatsApp reconnect backoff are unchanged. The API documents the remaining race: a host update after the final zero cannot revoke that permission.Regression evidence
The paused-time regression reserves t=10, then observes host cooldown updates at t=5 and t=29 that move admission to t=30 and t=40. It asserts no factory call before t=40 and exactly one reservation throughout.
Negative control on the candidate: replace only
delay = admission.recheck()withdelay = Duration::ZERO, leaving the new API and test intact.connect_admission_rechecks_cooldown_without_reserving_againthen fails at t=10 with actual dial count 1, expected 0, exit 101. Restore the call and all 17 public admission tests pass. This is an executable behavior failure, not a compilation failure.Other regressions cover initial zero, repeated extensions, legacy constant delays, shutdown during and inside rechecks, pause/resume including rapid toggles, normal/forced reconnects, transport timeout isolation, unrelated notifications and supervision stop. Standalone consumers exercise default and overridden methods through trait objects, including a local Rc policy on WASM.
Validation
Head
3f01a56dcab59ebae1e092a2eef8bfeaef8e55bb, pinned nightly-2026-06-16:cargo test -p whatsapp-rust --test connect_admission: 17 passed, including after restoring the negative control.cargo nextest run -p whatsapp-rust --lib: 2538 passed, 3 skipped on the final head.cargo clippy -p whatsapp-rust --all-targets -- -D warnings: passed.cargo test -p whatsapp-rust --doc: 50 passed, 15 ignored.src/request.rsandsrc/upload.rsremain; this is a build pass, not a warning-free WASM lint claim.CodeRabbit approved the published head; Greptile found no actionable issues. After marking the draft ready, Codex reviewed this same head and found no major issues. There are no open review threads. Rust CI, native/MSRV API consumers, WASM, E2E, Miri, CodSpeed, formatting and Cargo Deny completed successfully for this head. The all-features job includes 3181 passed, 6 skipped for the SDK shareable-feature test set. The separate advisory semver failure is explained below; this is not an all-green semver claim.
The binary-size gate passed against base
7ed5b5d1: stripped bytes +320 B,.text+320 B, allocated sections unchanged, dependencies unchanged.The informational semver job failed, despite its workflow-level success. It compares only unchanged
wacore,wacore-binaryandwaprotoagainst published 0.7.0, reporting 24/3/7 failing check categories. Their source trees and Cargo.lock are identical to the PR base. It does not check the changed SDK API; compatibility evidence for that is the default method and standalone consumers. Detailed triage. No override or unrelated version bump was made.CodeRabbit's advisory docstring-coverage warning includes regression helpers; the new public API is documented and Rustdoc passes. Review follow-up.
CodSpeed's workflow passed but its report flags two unchanged libsignal benchmarks across different CPU environments. Both have identical modeled instruction time between base and head; the reported delta is entirely modeled cache/memory cost. Exact comparison. No matched-hardware run or warning suppression was performed.
The additional Codex security review did not run because the payer reached usage limits. This is separate from the completed code review and is not presented as a security-review pass.
This changes host SDK admission, not wire behavior or generated protocol sources. No server-rate-limit assumptions or live authenticated WhatsApp session were needed.