Conversation
ca333
commented
Oct 30, 2025
- tie SSE into authentication state / lifecycle
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
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.
💡 Codex Review
https://github.com/KomodoPlatform/komodo-wallet/blob/9fe2e6672ede060ba09688d992d8158a7342ea6d/lib/bloc/auth_bloc/auth_bloc.dart#L144-L151
Treat SSE connect failures as login errors
After a successful _kdfSdk.auth.signIn() the new code calls _kdfSdk.streaming.connectIfNeeded() inside the same try block. If the SSE connection attempt throws (e.g. streaming endpoint down) the catch block will emit an auth error and cancel subscriptions even though the user is already authenticated. This leaves the SDK signed in while the UI believes login failed, forcing a relaunch or manual cleanup. Consider wrapping the streaming connect in its own try/catch (or ignoring failures) so that transient SSE issues don’t invalidate a completed sign‑in.
https://github.com/KomodoPlatform/komodo-wallet/blob/9fe2e6672ede060ba09688d992d8158a7342ea6d/lib/bloc/auth_bloc/auth_bloc.dart#L100-L106
Unhandled SSE disconnect can block logout completion
The logout handler now calls _kdfSdk.streaming.disconnect() in the finally block without guarding against exceptions. If disconnect throws synchronously (for example when the stream is already closed or the SDK tears down unexpectedly), the subsequent await _authChangesSubscription?.cancel() and emit(AuthBlocState.initial()) will never run, leaving the bloc stuck in the loading state despite the earlier effort to swallow sign‑out errors. Wrap the disconnect call in its own try/catch (and optionally await it) so that failure to close SSE does not prevent clearing the auth state.
ℹ️ 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".