Repository navigation
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 597771a2bc
ℹ️ 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".
| peer.stop.onAwait { | ||
| owner.cancelAndJoin() | ||
| if (outcome.isCompleted) outcome.await() else null |
There was a problem hiding this comment.
Treat requested stops as clean closures
When stop(peer) wins after the owner coroutine has started, cancelAndJoin() injects a CancellationException, which the owner's broad catch (Throwable) stores in outcome; the subsequent outcome.await() therefore publishes that exception as Closed.cause. Consequently, an intentional peer stop is indistinguishable from a connection failure (and differs from the stop-before-start path, which reports null), so session logic may incorrectly record or react to a routine retirement as an error.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cecc58a. The pool uses a dedicated cancellation marker for an intentional stop and reports a clean closure only for that marker without suppressed cleanup errors. Genuine connection failures remain errors. Added an active-peer stop regression: it failed before the change and passes after it, alongside the existing startup, failure-isolation, admission, and ownership tests. JVM tests and iOS compilation passed; the dependent session branch is running full JVM/iOS validation with this fix.
|
Superseded by #236 (V2 scheduling and download execution) in the consolidated eight-PR stack for #162. The replacement preserves this PR's code and subsequent fixes; its description links the original head and review discussions. The only additional consolidation fix is the CI-discovered listener cancellation regression, documented on the replacement. All eight replacements have passed their required CI checks. Closing without merging. This branch and its discussions remain available for reference. Review index: #162 (comment) |
A session needs one event stream for dynamically arriving and departing peer actors.
PeerV2Poolnow forwards each peer's ordered events through an admitted bounded queue, isolates connection failures, and supports nonblocking stop requests.A terminal event is published only after the peer actor and reader have joined. The session retires that exact event before capacity returns, so delayed events cannot retire a replacement connection. Attach transfers cleanup responsibility even if actor admission fails or shutdown precedes startup. Queued and canceled-send events release their buffers; already delivered events remain consumer-owned.
Stacked on #204; part of #162. Automatic session scheduling, discovery, complete hash serving, and production runtime registration remain outstanding.
Validation at
597771a2bc1404117edee817dcd77cc53e636c34: 482 JVM and 461 executed iOS simulator tests, zero failures/errors/skips; both pinned v1 conformance scenarios and native dependency guard passed. New tests cover dynamic capacity and stale retirement, stop before startup, malformed-peer isolation with a healthy peer's ordered acknowledgement/payload, actor admission failure cleanup, and shutdown across both queue layers plus blocked forwarders.Review follow-up
cecc58a2: intentional stops use a dedicated cancellation marker and report a clean closure when no cleanup errors accompany it. The active-peer regression failed before the fix and passed after it. The dependent session branch atfe5d73c57da3654ee46544abd891ffc951e2d073includes this fix and passed 489 JVM / 468 executed iOS tests, both pinned v1 conformance scenarios, and the native dependency guard.