Skip to content

fix(exit): stop misclassifying clean macOS exits and losing provider backups - #73

Open
zhushihao wants to merge 1 commit into
BigStrongSun:mainfrom
zhushihao:fix/macos-clean-exit
Open

fix(exit): stop misclassifying clean macOS exits and losing provider backups#73
zhushihao wants to merge 1 commit into
BigStrongSun:mainfrom
zhushihao:fix/macos-clean-exit

Conversation

@zhushihao

@zhushihao zhushihao commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • On macOS, read the current process identity through proc_pidpath and proc_pidinfo instead of assuming Linux /proc is available.
  • Classify an expected process termination without a crash as CleanExit.
  • Avoid recovery warnings and automatic takeover recovery after a normal app exit.
  • Preserve or rebuild the clean live backup for apps whose takeover remains enabled.
  • Restore the complete user backup after a confirmed restart instead of dropping user-only fields.

Root cause

The exit monitor treated a missing Linux-style /proc self entry as an unclean exit on macOS. This made normal exits look like crashes. Recovery then used a narrower provider SSOT snapshot and could drop fields that only existed in the full user backup.

Validation

  • cargo check -p cc-switch --lib
  • app_exit_monitor::tests
  • process_identity::tests
  • services::proxy::tests, including regression coverage for clean exits, planned restarts, confirmed panics, backup preservation/rebuild, and full backup restoration.

…ckups

- Add macOS process identity via proc_pidpath + proc_pidinfo instead of /proc
- Classify a clean exit without crash as CleanExit so it no longer triggers recovery warnings
- Keep a clean live backup for apps whose takeover remains enabled on exit
- Rebuild a missing or placeholder backup from the current provider before restart takeover
- Restore the full user backup on crash restart instead of falling back to provider-only SSOT
@zhushihao

Copy link
Copy Markdown
Contributor Author

Note: the backend failures are pre-existing Clippy issues under stable Rust 1.95. They occur on upstream main at e470fff4 (CI run 32929154078) and are all in files outside this PR. I left that unrelated cleanup out so this change stays focused on the macOS exit/recovery bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant