Skip to content

fix(gui-client): don't panic on existing session - #9779

Merged
thomaseizinger merged 1 commit into
mainfrom
chore/no-panic-existing-session
Jul 4, 2025
Merged

fix(gui-client): don't panic on existing session#9779
thomaseizinger merged 1 commit into
mainfrom
chore/no-panic-existing-session

Conversation

@thomaseizinger

Copy link
Copy Markdown
Member

Customer hit what seems to be a rare race condition where we try to connect whilst we already have a session. I don't know which state it is in so I am replacing it with a WARN log to learn more about this in Sentry in case it gets hit again.

@thomaseizinger
thomaseizinger requested review from Copilot and jamilbk July 3, 2025 22:21
@vercel

vercel Bot commented Jul 3, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
firezone ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2025 10:21pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents a panic when an existing session is detected during try_connect, replacing it with a warning log to gather more telemetry, and adds Debug derives for better visibility of session-related types.

  • Replaced assert! on an existing session with a tracing::warn! and preserved behavior.
  • Added #[derive(Debug)] to Session and EventStream for richer logging.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
rust/gui-client/src-tauri/src/service.rs Removed panic assertion, added warning log and Debug derive.
rust/client-shared/src/lib.rs Added Debug derives to Session and EventStream.
Comments suppressed due to low confidence (2)

rust/gui-client/src-tauri/src/service.rs:603

  • The doc comment for try_connect was removed; add or update documentation to reflect that it now logs a warning instead of panicking on an existing session.
    fn try_connect(&mut self, api_url: &str, token: SecretString) -> Result<Session> {

rust/gui-client/src-tauri/src/service.rs:607

  • Consider adding a unit or integration test to cover the new warning path when a session already exists, ensuring telemetry and behavior are correct.
            tracing::warn!(session = ?self.session, "Connecting despite existing session");

let started_at = Instant::now();

assert!(self.session.is_none());
if !self.session.is_none() {

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] For readability, prefer self.session.is_some() over !self.session.is_none(). This makes the intent clearer.

Suggested change
if !self.session.is_none() {
if self.session.is_some() {

Copilot uses AI. Check for mistakes.
@thomaseizinger
thomaseizinger enabled auto-merge July 3, 2025 22:52
@thomaseizinger
thomaseizinger added this pull request to the merge queue Jul 3, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 3, 2025
@thomaseizinger
thomaseizinger added this pull request to the merge queue Jul 4, 2025
Merged via the queue into main with commit 01e3fea Jul 4, 2025
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.

3 participants