Skip to content

fix(tokio): honor durations set on parsed configs - #5493

Merged
kixelated merged 7 commits into
mainfrom
quest/m1/cli-duration-defaults
Oct 15, 2026
Merged

kixelated merged 7 commits into
mainfrom
quest/m1/cli-duration-defaults

Conversation

@kixelated

@kixelated kixelated commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Ten moq-tokio duration fields ignored values set in code after CLI parsing or a settings merge. Usage stored each parser default as if the flag had been given, so it beat the typed field, and a parse left the skipped typed field at Duration::ZERO, which could not be told apart from unset.

Approach

The typed fields become Option<Duration>. Each knob resolves the flag or environment value actually given, then the typed field, then the default. The fallback/resolve/explicit machinery in cli::Duration loses its callers and is deleted, leaving it the humantime parser. One test macro covers the precedence for all eleven duration knobs (the ten here plus #5350's backoff timeout): parsed, merged round-trip, zero and nonzero, a given flag still winning, and a config built in code.

Since the flags have no parser default, --help no longer printed [default: X] for them. Each flag now carries a one-line help that states its default, which also gives these flags a description they never had.

Public API

Breaking, Rust only (moq-tokio):

Field Before After
connect::Config::race Duration Option<Duration>
connect::Config::resolution_delay Duration Option<Duration>
connect::Config::timeout Duration Option<Duration>
listen::Config::timeout Duration Option<Duration>
quic::Config::idle_timeout Duration Option<Duration>
quic::Config::keep_alive Duration Option<Duration>
Backoff::initial Duration Option<Duration>
Backoff::max Duration Option<Duration>
connection::Goaway::handover Duration Option<Duration>
websocket::Config::delay Duration Option<Duration>

Default still holds Some(default) for each, matching #5350's Backoff::timeout. None uses the default; Some(Duration::ZERO) keeps each knob's zero behavior. The Resolved structs (connect, quic, websocket) and listen::Config::resolved_timeout keep their types.

Unchanged: CLI flag names, environment variables, TOML keys, the C ABI (moq.h), moq-ffi records, hand-written bindings, and the wire.

Rebased on #5484

#5484 removed the WebSocket-to-QUIC upgrade and reworked client.rs, connection.rs, and websocket.rs. Merged main in and re-checked each knob:

  • No knob was removed: all ten still exist and are still read.
  • race is the Happy Eyeballs stagger between resolved addresses; fix(tokio)!: keep the transport that won the connect race #5484 did not touch it.
  • WebSocket delay is still QUIC's head start, skipped while a server is remembered as a WebSocket win. fix(tokio)!: keep the transport that won the connect race #5484 moved the forget on a QUIC win into the race itself; zero still means no head start.
  • GOAWAY handover now caps only a peer GOAWAY handover. The client-initiated upgrade handover that also read it is gone.
  • Connect timeout bounds the dial and handshake only, since no upgrade outlives the attempt anymore.

The only conflict was in upgrade tests #5484 deleted; its new quic_winning_cancels_the_websocket_dial test now sets websocket.delay = Some(Duration::ZERO). The doc/setup/upgrade.md entry still holds against main: #5350 is unreleased, so backoff.timeout stays in the list.

Decisions

Picked by the iterating agent, without a prompt:

  • Help text for the eleven flags:
  • Merge main rather than rewrite the branch: ✅ the change re-derives cleanly; squash merge flattens it.

Validation

Final head e9cb3ceb294f7725c669218eee079253648a5cc9, merged with main at 20ca8a651.

  • just check origin/main: every Rust test passed in at least one of two runs. Each run stopped on a tracked load flake, never in code this PR touches: run one on the uring teardown close (passed alone), run two on the auth-refresh clock tests (passed in run one).
  • The modules just check runs after Rust passed when run directly: bench, quest, drill sensitivity, Python, Kotlin, Go, Dart, C++, shell, TOML, and GitHub lint.
  • moq-relay --help shows each duration flag's description and default.
  • CI passed on the final head, including TS validation.

Follow-ups

None from this PR.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

@kixelated

Copy link
Copy Markdown
Collaborator Author

Duration implementation is complete at e7e3eb1c440073c5b43df1fbe2aaad534f4e2f46; no API or scope decisions remain. Leaving this PR draft because the final strict run hit the existing auth-refresh clock failures and final interop hit the existing browser refusal-close failure. Both are linked in the PR description. The identical native source previously passed all 3,975 Rust tests and full interop; that does not establish either existing failure as fixed. Recommended follow-up is the existing controlled-clock and browser close-code quest work, without widening bounds or retrying to obtain green. No merge or subsequent PR monitoring was performed.

(Written by GPT-6)

kixelated and others added 2 commits October 14, 2026 09:42
# Conflicts:
#	rs/moq-tokio/src/connection.rs
The flags lost their parser defaults, and with them the [default: X] line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review October 14, 2026 17:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-15T00:42:15.299384Z b6e9a5b New commits
ℹ️ 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 Oct 14, 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: 45a8053b-20f5-4507-aa23-84dbc1301370
📥 Commits

Reviewing files that changed from the base of the PR and between b6e9a5b and b160a03.

📒 Files selected for processing: 4
  • quest/m1/README.md
  • rs/moq-relay/src/web.rs
  • rs/moq-relay/tests/auth_lifetime.rs
  • rs/moq-tokio/src/websocket.rs
💤 Files with no reviewable changes: 1
  • quest/m1/README.md

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

Walkthrough

Selected moq-tokio duration configuration fields now use Option<Duration>. Resolution prefers parsed CLI or environment values, then configured values, then defaults. Optional serialization omits unset fields. C ABI, FFI, GStreamer, relay, and integration-test callers now use optional values. Tests cover precedence, zero values, defaults, validation, and resolved settings. Upgrade documentation records the behavior.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b160a

The reviewed changes update duration configuration and affected fixtures; no actionable merge-blocking risk is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 78.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 27 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: making parsed configuration durations honor values set in code.
Description check Passed The description directly explains the duration precedence issue, the Option-based solution, API impact, validation, and unchanged interfaces.
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.
  • 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

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.98.1)

Clippy execution timed out

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.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary for head e9cb3ce.

Public API: ten moq_tokio config fields go from Duration to Option<Duration> (table in the description). CLI, env, TOML, C ABI, bindings, and wire are unchanged.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 14, 2026
Adapts main's new tests to Option<Duration>: the relay web drain fixture's listen.timeout and the refused TCP dial test's backoff, timeout, and race.

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

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: b6e9a5b.

No actionable bugs found. Option correctly separates unset from explicit zero; resolution keeps explicit CLI/environment values ahead of typed fields and defaults without manufacturing parser values. The shared eleven-knob regression coverage and documented Rust API migration are appropriate, and binding adaptations preserve their existing external representations.

Compared the current base-relative patch with the previously inspected e9cb3ce, accounting for main imports. Production changes are equivalent; the added drain/refused-dial fixture adaptations retain their intended zero-timeout behavior.

Verification: static review of configuration resolution, serialization, callers/bindings and tests. No repository tests or builds run; the PR description's validation refers to its earlier head.

@kixelated
kixelated enabled auto-merge October 15, 2026 00:52
@kixelated

Copy link
Copy Markdown
Collaborator Author

Re-enqueued at b6e9a5ba4083d5f9e199b653869ebbc1574b6194.

The queue dropped the previous head on a real semantic conflict, not a flake: the merge_group Test job failed to compile moq-relay's lib tests because main's new web drain fixture (rs/moq-relay/src/web.rs) sets config.listen.timeout = Duration::ZERO, which this PR makes Option<Duration>.

The new head merges main and adapts the two tests main added against the old types: that fixture now sets Some(Duration::ZERO), and a_refused_tcp_dial_keeps_retrying in moq-tokio's connection.rs takes main's Windows-safe version with Some(..) for backoff, timeout, and race. quest/m1/README.md keeps main's channel-count line and still drops this quest's entry. No other code changed.

Validation: cargo check --workspace --all-targets --all-features is clean, and cargo nextest run -p moq-tokio -p moq-relay --all-features passes (830 tests). Codex reviewed the new head with no findings.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 15, 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 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated enabled auto-merge October 15, 2026 02:23
@kixelated

Copy link
Copy Markdown
Collaborator Author

Re-enqueued at b160a03af5505691c23cb57987ec88a9da8a91e8. The queue dropped b6e9a5ba4 as unmergeable behind #5526, which also removed its own adjacent quest line from quest/m1/README.md. This merge of main drops both lines. No code changed since the head Codex reviewed, and the workspace still checks clean with all features.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit 53fe8ad Oct 15, 2026
12 checks passed
@kixelated
kixelated deleted the quest/m1/cli-duration-defaults branch October 15, 2026 03:28
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