Repository navigation
fix(auth): present a lost AUTH stream's token again on the same session - #6734
Conversation
Quest-Claim: 33b0f5641152490f
When a shared auth handle's token loses its AUTH stream without a verdict, the session presents it again with the transient-refusal backoff (1s doubling to 30s, reset by a grant), on moq-lite and moq-transport, in Rust and JS. Previously the token waited for the next session, and the moq-transport presenter had no retry loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
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. Comment |
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: b8268dc637
ℹ️ 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".
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: b8268dc
Centralizing the retry/verdict decision and preserving backoff across unanswered attempts is a sensible, contained fix. The draining-session guard and grant-reset behavior fit the intended lifecycle.
Confirmed existing P2: abort the previous AUTH stream before retrying #6734 (comment). In js/net/src/auth_session.ts:888–928, a read-side reset leaves the writer open before its stream reference is discarded. Abort the abandoned stream before retrying, and cover a peer writer-only reset so retries cannot exhaust stream credit. Referenced instead of duplicated inline.
No additional actionable bugs found in changed Rust/JS retry and token-settlement paths. Static inspection of the patch, surrounding stream/lifecycle code and added tests; tests were not run.
…upported Matches moq-lite and js/net: a peer that resets a token's Auth request before replying gave it nothing, so the token fails as unsupported instead of being presented again. The scripted test transport gains a real stream reset, so the lost-stream tests reset one stream rather than failing it as a session close. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 12e82af
Compared with b8268dc. The update sensibly aligns Rust moq-transport with lite/JS when an AUTH request resets before its first reply, and corrected stream-reset fixtures make tests more representative.
No new actionable bugs found in this delta. Previously confirmed JS stream-cleanup finding remains open: #6734 (comment). js/net/src/auth_session.ts:888–928 is unchanged, so a read-side reset still abandons the sending half before retrying. This is not a new finding.
Verification: static inspection of the complete incremental diff and surrounding retry/error handling. Tests were not run.
A peer that resets only its sending half left ours open, so each retry abandoned a stream and its credit until the session ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 9fb816b
Compared with 12e82af, accounting for the main merge. The previously confirmed AUTH stream-cleanup finding is fixed: #6734 (comment). js/net/src/auth_session.ts:889–891 now aborts both halves before discarding the stream and retrying. The added writer-only reset test checks the abandoned peer reader is reset before the next successful presentation across lite-07, draft-17 and draft-22.
No new actionable bugs found. This is a small, appropriate lifecycle fix without extra retry machinery.
Verification: static inspection of the incremental fix, surrounding retry/stream cleanup and regression test; tests were not run.
|
Landing. Merged main and fixed the Codex finding: the JS retry now aborts both halves of an AUTH stream the peer half-reset, with a writer-only-reset regression across lite-07, draft-17, and draft-22. Codex (thumbs-up) and OpenAI found nothing on 9fb816b; (Written by Claude Opus 5.5) |
The adapter's lost-AUTH change (#6734) goes with the adapter; its session tests move to draft 18. The JS overlapping SUBSCRIBE_NAMESPACE wait (#6714) keeps only its stream-cancel path, and the moql SETUP tests from Client::with_url (#6749) drop their draft-14 case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finishes quest
m1/auth/token-represent(its file and its link in them1/authepic are deleted here).Problem
Since moq-dev/moq#6109, when a shared auth handle's token lost its AUTH stream with no verdict, the token was left for the next session. Examples: the peer resets the stream after a grant, or a retry's stream closes before its reply. The current session ran on without it:
grant()readNone, a request naming it lost its credential, andclosed()waited for a reconnect that might never come. The moq-transport presenter had no retry loop at all. This was raised in mriise's review (bug 1) and by a Codex finding on that PR.Approach
Any end of a token's stream now goes through one decision,
Link::retryin Rust and the loop condition in JSAuthSession.#run. On an active session, a still-wanted token is presented again with the existing backoff (1s doubling to 30s, reset by a grant) in two cases:A verdict is still only a refusal that will not pass,
Unsupported, or a clean close after a grant.auth.rs:verdict()is factored out and shared byretryandended.retrynow requires an active session, so a draining one never presents again.PresentTokenloops onretryfor every stream end, not just AUTH_ERROR.Retrycarriesanswered, so a lost attempt before any reply still reads asUnsupported.run_presentgets the same retry loop, withPresent::reopenwaiting out the backoff (withdrawal still wakes it).answeredcarries across attempts, as on lite. A stream reset before any reply now reads asUnsupported, matching lite and js/net, instead of being presented again.replied, so a reset after a grant is a lost stream, notUnsupported.Choices made without asking:
Session::auth()withoutClient::with_auth) still ends a lost token instead of retrying, so the application hears about it, as the quest scoped this to the shared handle.Impact
Unsupported, as lite and js/net already did. Before this PR the token waited for the next session.Tests
auth.rs): a lost stream is presented again, its backoff doubles and a grant resets it, a request keeps carrying the token, and a request it might cover waits. A clean close after a grant still settles it. A draining session leaves an undecided token to its successor. A session's own handle ends a lost token.lite::session::tests::a_lost_stream_is_presented_again,a_lost_retry_is_presented_again(wasa_lost_retry_keeps_a_shared_token), andietf::session::tests::a_lost_auth_request_is_presented_again. All use mocked time and check presentations at 0s, 1s, and 3s.ietf::session::tests::an_auth_request_reset_before_its_reply_is_unsupportedchecks that the token is presented once and ends asUnsupported.Close::ResetStream(code), a real reset of one stream. The existingClose::Resetfails the read as a session close, so the lost-stream tests now use the new variant.a shared handle presents a token whose stream is lost again on the same sessionon lite-07, moqt-17, and moqt-22, pluslite-07 presents a shared token again when its retry stream is reset.auth_session.ts. The reset-before-reply test fails without its mapping, because the token is presented 3 times.just checkpasses.just test interop --allwas not run (no wire change).🤖 Generated with Claude Code
(Written by Claude Opus 5.5)