fix(launchd): self-heal missing plist in launchd_restart()#31218
Open
dev-jin wants to merge 1 commit into
Open
fix(launchd): self-heal missing plist in launchd_restart()#31218dev-jin wants to merge 1 commit into
dev-jin wants to merge 1 commit into
Conversation
When the launchd plist is missing (e.g. incomplete setup wizard run), launchd_restart() fails with 'bootstrap failed: 5: Input/output error' because it tries to bootstrap a non-existent file. Add the same self-heal check already present in launchd_start(): if the plist doesn't exist, regenerate it with generate_launchd_plist() before calling launchctl bootstrap. This mirrors the pattern at line ~2943 in launchd_start().
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves launchd_restart() robustness by regenerating the per-profile LaunchAgent plist when it’s missing, enabling restart to succeed after partial/unloaded setups.
Changes:
- Add a self-healing step to recreate the LaunchAgents plist when absent.
- Ensure the LaunchAgents directory exists before bootstrapping.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3057
to
+3062
| # Self-heal: if the plist was deleted (e.g., incomplete setup wizard | ||
| # run) recreate it before bootstrapping — mirrors launchd_start(). | ||
| if not plist_path.exists(): | ||
| print("↻ launchd plist missing; regenerating service definition") | ||
| plist_path.parent.mkdir(parents=True, exist_ok=True) | ||
| plist_path.write_text(generate_launchd_plist(), encoding="utf-8") |
| if not plist_path.exists(): | ||
| print("↻ launchd plist missing; regenerating service definition") | ||
| plist_path.parent.mkdir(parents=True, exist_ok=True) | ||
| plist_path.write_text(generate_launchd_plist(), encoding="utf-8") |
Collaborator
Author
|
Issue 31212 was closed and recreated under #31224, so PR links to that. |
1 task
14 tasks
This was referenced Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.