Make SUBSCRIBE_NAMESPACE errors non-fatal#1154
Conversation
When the peer rejects our SUBSCRIBE_NAMESPACE request, log a warning and continue the session instead of tearing it down. The session can still function via unsolicited PUBLISH_NAMESPACE messages from the peer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WalkthroughThe error handling for 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rs/moq-lite/src/ietf/session.rs`:
- Around line 55-58: The current handling of sub_ns.run_subscribe_namespace(...)
swallows all errors; change both call sites so that only the expected rejection
variant (match Err(Error::Cancel { .. })) is downgraded to tracing::warn!(..);
return Err(err) (or propagate the error) for any other error variants (e.g.,
Transport/Decode/ProtocolViolation) instead of Ok(()). Locate the two places
where run_subscribe_namespace is awaited and replace the unconditional if let
Err(err) => { warn; Ok(()) } with a match on the error that warns and continues
only for Error::Cancel and otherwise propagates the error up to the caller
(preserving the original Err type).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 41d5ee34-a304-4596-a111-b5db7a2f5321
📒 Files selected for processing (1)
rs/moq-lite/src/ietf/session.rs
| if let Err(err) = sub_ns.run_subscribe_namespace(stream).await { | ||
| tracing::warn!(%err, "subscribe_namespace failed, continuing without"); | ||
| } | ||
| Ok(()) |
There was a problem hiding this comment.
Only downgrade expected SUBSCRIBE_NAMESPACE rejections; propagate real failures.
On Line 55 and Line 89, all run_subscribe_namespace errors are converted to warn+Ok(()). That also suppresses Transport, Decode, ProtocolViolation, etc., which can leave the session in an invalid state. This should continue only for the expected rejection path (currently Error::Cancel) and return other errors to tokio::select!.
Suggested fix
- if let Err(err) = sub_ns.run_subscribe_namespace(stream).await {
- tracing::warn!(%err, "subscribe_namespace failed, continuing without");
- }
- Ok(())
+ match sub_ns.run_subscribe_namespace(stream).await {
+ Ok(()) => Ok(()),
+ Err(Error::Cancel) => {
+ tracing::warn!("subscribe_namespace rejected, continuing without");
+ Ok(())
+ }
+ Err(err) => Err(err),
+ }
} => Err(err),- if let Err(err) = sub_ns.run_subscribe_namespace(stream).await {
- tracing::warn!(%err, "subscribe_namespace failed, continuing without");
- }
- Ok(())
+ match sub_ns.run_subscribe_namespace(stream).await {
+ Ok(()) => Ok(()),
+ Err(Error::Cancel) => {
+ tracing::warn!("subscribe_namespace rejected, continuing without");
+ Ok(())
+ }
+ Err(err) => Err(err),
+ }
} => Err(err),Also applies to: 89-92
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rs/moq-lite/src/ietf/session.rs` around lines 55 - 58, The current handling
of sub_ns.run_subscribe_namespace(...) swallows all errors; change both call
sites so that only the expected rejection variant (match Err(Error::Cancel { ..
})) is downgraded to tracing::warn!(..); return Err(err) (or propagate the
error) for any other error variants (e.g., Transport/Decode/ProtocolViolation)
instead of Ok(()). Locate the two places where run_subscribe_namespace is
awaited and replace the unconditional if let Err(err) => { warn; Ok(()) } with a
match on the error that warns and continues only for Error::Cancel and otherwise
propagates the error up to the caller (preserving the original Err type).
Summary
SUBSCRIBE_NAMESPACErequest, log a warning and continue the session instead of tearing it downPUBLISH_NAMESPACEmessages from the peerDOES_NOT_EXISTorUNINTERESTEDtoSUBSCRIBE_NAMESPACEwould cause the relay to drop the sessionTest plan
SUBSCRIBE_NAMESPACE— session should stay alivePUBLISH_NAMESPACEannouncements still flow afterSUBSCRIBE_NAMESPACEis rejected🤖 Generated with Claude Code