Skip to content

🐛 fix stale desktop lock recovery#33

Merged
Reverier-Xu merged 2 commits intomasterfrom
codex/fix-stale-desktop-lock
Apr 2, 2026
Merged

🐛 fix stale desktop lock recovery#33
Reverier-Xu merged 2 commits intomasterfrom
codex/fix-stale-desktop-lock

Conversation

@Yesec
Copy link
Copy Markdown
Collaborator

@Yesec Yesec commented Apr 2, 2026

Summary

This fixes the desktop stale lock recovery path described in #32.

Changes:

  • validate .rx.is.alive instead of exiting only because the file exists
  • only treat a 2xx response from POST /popup as a live existing instance
  • treat unreadable lock files, invalid port contents, failed requests, and non-2xx responses as stale state
  • remove stale lock files and continue the current launch immediately
  • add a best-effort cleanup path after ui.run() returns

Files changed

  • crates/desktop/src/launcher.rs
  • crates/desktop/src/main.rs

Validation

  • cargo check --workspace

@Reverier-Xu Reverier-Xu changed the title Fix stale desktop lock recovery 🐛 fix stale desktop lock recovery Apr 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 improves the desktop “stale lock” recovery path so that a leftover .rx.is.alive no longer blocks startup when the prior instance is gone, and adds a best-effort cleanup path when the UI event loop returns.

Changes:

  • Refactors lock-file handling to validate the stored port and only exit when a /popup request returns 2xx; otherwise the lock is treated as stale and removed.
  • Adds runtime cleanup helpers and wires cleanup to run after ui.run() returns.
  • Centralizes shutdown cleanup to reuse the same cleanup logic.

Reviewed changes

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

File Description
crates/desktop/src/launcher.rs Adds lock validation + “focus existing instance” logic; introduces cleanup helpers used by shutdown and post-ui.run() cleanup.
crates/desktop/src/main.rs Calls new cleanup path after ui.run() returns, using a weak handle to the UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/desktop/src/main.rs Outdated
Comment thread crates/desktop/src/launcher.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Reverier-Xu Reverier-Xu merged commit 05fdcf2 into master Apr 2, 2026
3 checks passed
@Reverier-Xu Reverier-Xu deleted the codex/fix-stale-desktop-lock branch April 2, 2026 06:49
@Reverier-Xu
Copy link
Copy Markdown
Member

Closes #32 .

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