Skip to content

fix(relay): share connection lifecycle across runtimes - #5761

Merged
kixelated merged 8 commits into
mainfrom
quest/m2/uring-connection-log
Oct 17, 2026
Merged

kixelated merged 8 commits into
mainfrom
quest/m2/uring-connection-log

Conversation

@kixelated

@kixelated kixelated commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The io_uring relay duplicates admission and supervision and logs under moq_relay::uring, outside the interop harness's connection filter. A supervision panic loses its close log entirely.

Approach

Use one private lifecycle owner (connection::Lifecycle) for admission (including LAN credentials and refusals), the connection span, negotiated logging, supervision and the close line. Carry that span across worker and shared-runtime tasks. Transport handshakes and request configuration remain with their concrete accept paths so the ring driver stays on its worker.

On the ring, the worker runs its half (handshake, admission on the shared runtime, session start) and logs the close itself only if that half fails or panics. Once the session starts, its supervision and its close move to the shared runtime, like the tokio path: a worker stopped at the end of a drain drops its tasks, so a close logged there could be lost.

Impact

  • Public API: unchanged.
  • Wire: unchanged.
  • Both relay runtimes log lifecycle events under moq_relay::connection in the same conn{id=N} span, and every close comes from Lifecycle.

Alternatives

  • A logging wrapper alone would preserve the duplicated admission paths and their drift.
  • Keeping the close on the worker task (the first revision) loses the close of a session still draining when the workers stop: the new ring log test failed 3 of 10 runs that way.

Iteration

Decisions settled by the iterating agent (recommended option taken):

  • Where a started ring session logs its close:
    • ✅ The shared runtime, through the same Lifecycle::run as the tokio path. Survives worker teardown.
    • Keep it on the worker and make worker stop wait for its connection tasks. Lets a stuck task hold up shutdown.
    • Log an "abandoned" close from a drop guard. Reports a made-up outcome for a session that ended cleanly.

Validation

On 857360d48:

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Implemented and validated on clean head 43e82582c82802c9db9037b992c8188d9062566d against integrated base 548b4ec1c4f8075bdc83c90ed4914f72681d21db.

Nix format/fix and strict full check passed. The strict real ring suite and supervision-panic regression passed 11/11; native interop and relay close accounting passed. Left as a draft for review. No public API or wire change.

(written by GPT-6)

kixelated and others added 2 commits October 16, 2026 22:44
…tion-log

# Conflicts:
#	quest/m2/uring-connection-log.md
A worker stopped at the end of a drain dropped the task that would log a
still-draining session's close. Hand supervision and its close to the
shared runtime once the worker's half starts the session, and cover a
drain with sessions open in the ring log test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review October 17, 2026 05:58
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da18a009-008f-4237-abf5-dfe756d20db3
📥 Commits

Reviewing files that changed from the base of the PR and between e93391d and d38a030.

📒 Files selected for processing: 8
  • quest/m2/README.md
  • quest/m2/uring-connection-log.md
  • rs/moq-relay/src/connection.rs
  • rs/moq-relay/src/uring.rs
  • rs/moq-relay/tests/integration/logs.rs
  • rs/moq-relay/tests/integration/main.rs
  • rs/moq-relay/tests/integration/runtime_uring.rs
  • rs/moq-relay/tests/integration/smoke.rs
💤 Files with no reviewable changes: 2
  • quest/m2/README.md
  • quest/m2/uring-connection-log.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

The change moves connection admission, supervision, and close logging into a shared Lifecycle owner. The io_uring worker now uses that owner for admission and supervision. New tests capture logs for raw QUIC and WebTransport sessions and check close logging after a supervision-task panic. Integration tests now use a shared log-capture helper. The m2 required-work entry and io_uring connection-logging design document are removed.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to d38a0

No change-introduced issue remains identified; the PR is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 61.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description clearly explains the shared lifecycle change, its io_uring supervision and close-logging behavior, impact, alternatives, iteration, and validation.
Title check Passed The title clearly and concisely identifies the main change: sharing the relay connection lifecycle across runtimes.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

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 ✅ Completed 2026-10-17T16:43:43.531027Z 857360d Draft marked ready
ℹ️ 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.

…tion-log

Route #5659's refusal accounting through the shared Lifecycle: cluster
admission records its own refusals, and Lifecycle::admit records the LAN
and drain refusals for both runtimes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as draft October 17, 2026 14:41
@kixelated
kixelated marked this pull request as ready for review October 17, 2026 14:41
@kixelated
kixelated enabled auto-merge October 17, 2026 14:45
@kixelated
kixelated added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 17, 2026
…tion-log

Thread the ring's Lifecycle through #5821's split handshake: serve_request
takes it in place of the connection id and returns the boxed supervision,
so both the moq-lite and moq-transport paths hand the close to the shared
runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as draft October 17, 2026 16:41
@kixelated
kixelated marked this pull request as ready for review October 17, 2026 16:41
@kixelated
kixelated enabled auto-merge October 17, 2026 16:44
@kixelated
kixelated added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit 67df700 Oct 17, 2026
11 of 12 checks passed
@kixelated
kixelated deleted the quest/m2/uring-connection-log branch October 17, 2026 17:04
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.

1 participant