Conversation
Fixes #2791 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Closing after further review: this is not an observable bug. The router task is the sole producer on each per-session channel and unbounded sends never block, so sending through a sender cloned before a concurrent re-registration is indistinguishable from linearizing the send at lookup time (before the replacement). Holding the lock across enqueue changes no reachable outcome, and the added test passes against the pre-change semantics, so it is not a regression test. No change needed. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The test does not reproduce the concurrency race the change is intended to prevent.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
This PR fixes stale Rust session routing by making sender lookup and message enqueue atomic.
Changes:
- Routes requests and notifications while holding the session registry lock.
- Adds coverage for reused session IDs.
| File | Description |
|---|---|
rust/src/router.rs |
Adds atomic routing helpers and related tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
|
|
||
| #[test] | ||
| fn routed_requests_and_notifications_reach_the_current_registration() { |

Summary
session.eventenqueue atomic with router registration lookup, preventing delivery through a stale sender after a session ID is replaced.Fixes #2791
Validation
cargo test --no-default-features --features test-support --lib router::testscargo clippy --no-default-features --features test-support --lib -- -D warningscargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml --checkgit diff --check