macOS: retry stale launchd bootstrap#81728
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-backed: current main throws after an already-registered bootstrap failure, while the PR adds the missing bootout-and-retry branch and focused coverage. I did not live-reproduce the failure with macOS launchd. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the retry-only launchd recovery after maintainer review and real macOS smoke, leaving headless/sudo support on the documented GUI-session guidance unless a separate LaunchDaemon product decision is made. Do we have a high-confidence way to reproduce the issue? Yes, source-backed: current main throws after an already-registered bootstrap failure, while the PR adds the missing bootout-and-retry branch and focused coverage. I did not live-reproduce the failure with macOS launchd. Is this the best way to solve the issue? Yes. The PR is the narrow maintainable fix for stale already-registered bootstrap recovery because it retries only the per-user LaunchAgent path and avoids the legacy What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 11017c93cf14. |
|
Broad verification update:
|
|
Closing this as superseded. The launchd startup work this was tied to has already landed through the later path, and the referenced follow-up context is no longer current. Rather than keep an old dirty branch open, we can open a fresh targeted PR if a new bootstrap retry bug appears on current main. |
Summary
Refs #46153 and #48476.
Verification
Behavior addressed:
openclaw gateway install/start/restartcan recover a stale already-registered LaunchAgent without adding a legacylaunchctl load -wfallback.Real environment tested: local Codex worktree on macOS with targeted unit proof; no live launchd smoke yet.
Exact steps or command run after this patch:
PATH=/Users/buns/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH node scripts/run-vitest.mjs src/daemon/launchd.test.ts;PATH=/Users/buns/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH pnpm exec oxfmt --check --threads=1 src/daemon/launchd.ts src/daemon/launchd.test.ts;git diff --check.Evidence after fix: targeted Vitest passed 1 file, 52 tests passed; oxfmt check passed; git diff whitespace check passed.
Observed result after fix: already-registered bootstrap errors trigger
bootout gui/<uid>/<label>and one bootstrap retry; retry GUI-domain failures keep the logged-in-session guidance path.What was not tested: live macOS LaunchAgent reinstall/bootstrap smoke and broad Testbox
pnpm check:changedare still pending for the full four-slice queue.