Skip to content

fix(web-transport-moq): report a raw QUIC peer's close code - #11

Merged
kixelated merged 2 commits into
mainfrom
fix/raw-close-code
Sep 27, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/raw-close-code

Conversation

@kixelated

@kixelated kixelated commented Sep 26, 2026 •

Copy link
Copy Markdown

A raw QUIC session (Session::raw) closes with the application code as is (conn.close(code, ..)), but the peer decoded ApplicationClosed only through the HTTP/3 code space, so session_error() returned None for every raw close. A moq moqt:// client saw Transport("connection error: closed by peer: ...") instead of the server's code. Reported in moq-dev/moq#4249.

  • The session and its streams share a crate-private CloseReason that knows whether the session is raw. It replaces the Arc<OnceLock<SessionError>> and the three copies of its lookup.
  • A raw ApplicationClosed code that fits in a u32 decodes to WebTransportError::Closed, from closed(), close_reason(), accept, open, datagrams, and stream reads/writes.
  • close() after the connection already closed now records that reason, so a later closed() keeps the peer's code rather than LocallyClosed. HTTP/3 sessions keep their existing behavior.

Public API: none. Wire: none.

Upstream: none, web-transport-moq is fork-only.

Test: tests/raw_close.rs fails before the change (session_error() is None) and passes after.

Not changed here: raw sessions still map stream reset/stop codes through the HTTP/3 space on both ends, which round-trips between two web-transport-moq peers but not with other raw QUIC stacks.

(Written by Opus 5.5)

🤖 Generated with Claude Code

A raw QUIC session closes with the application code as is, but the peer
decoded ApplicationClosed only through the HTTP/3 code space, so
session_error() was None. The session and its streams now share a
CloseReason that knows the code space, and close() after the connection
already closed keeps that reason instead of recording LocallyClosed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 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-09-26T17:17:07.063183Z d26fded PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e0687cf1-5cc3-45c0-9457-fafce5ac0330

📥 Commits

Reviewing files that changed from the base of the PR and between d26fded and e82e02a.

📒 Files selected for processing (1)
  • web-transport-moq/tests/raw_close.rs

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: 215e2f96-c23d-4a0c-b503-f626248b54c7

📥 Commits

Reviewing files that changed from the base of the PR and between ff9d2ab and d26fded.

📒 Files selected for processing (5)
  • web-transport-moq/src/error.rs
  • web-transport-moq/src/recv.rs
  • web-transport-moq/src/send.rs
  • web-transport-moq/src/session.rs
  • web-transport-moq/tests/raw_close.rs

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


Walkthrough

The change adds shared CloseReason state for sessions and streams. Session receive and close paths record close reasons, and session and stream error paths use them when mapping errors. Raw QUIC application-close codes that fit in u32 map to WebTransportError::Closed with the peer’s reason. A new raw QUIC test checks the peer close code and reason across session and stream error paths, including after a later local close.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to d26fd

The identified wrong-code case predates this change, so it does not prevent this PR from merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to d26fd

The change is confined to how a session reports closure to its callers. The review found no new privilege or cross-session access path, but concurrent close behavior and production use of the reported errors are not fully evidenced.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The observed propagation is bounded to the affected session and its stream wrappers. No cross-session state or new privileged operation appears in the inspected path.

Trust Boundaries and Controls

  • inferred — The inspected peer-controlled input crosses from QUIC closure into an existing public error value, not into an observed authorization decision or sensitive sink. Downstream application use of that value is not established by the available evidence.

Resilience and Maintainability Implications

  • observed — OnceLock prevents a later close-state write from replacing the recorded reason. The inspected raw-session test specifically checks peer-code attribution after a later local close.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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.
Title check ✅ Passed The title clearly identifies the primary change: reporting a raw QUIC peer's close code in web-transport-moq.
Description check ✅ Passed The description provides a clear summary, implementation details, API and wire impact, test coverage, known limitations, and issue context. It does not use the template headings or include the require…
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Author

Merging: CI green, Codex found nothing, no other review feedback. Lands the raw QUIC close-code fix for the 1.3.2 release.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit 4b3a5e6 into main Sep 27, 2026
2 checks passed
kixelated added a commit to moq-dev/moq that referenced this pull request Sep 28, 2026
1.3.2 carries moq-dev/noq#12 (BBR responds to CE in Startup and ProbeUp)
and moq-dev/noq#11 (raw QUIC peers report their application close code).
Completes the bbr-classic-ecn quest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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