Repository navigation
fix: preserve OpenClaw profile env in macOS launch-at-login plist - #99752
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 11:14 AM ET / 15:14 UTC. ClawSweeper reviewWhat this changesThe PR adds non-empty Merge readinessKeep this PR open: current Priority: P2 Review scores
Verification
How this fits togetherThe macOS app writes a per-user LaunchAgent plist when a user enables Launch at Login. That plist starts the app after login, so its environment determines which OpenClaw config and state profile the relaunched app uses. flowchart LR
A[Foreground macOS app] --> B[Profile environment paths]
B --> C[Launch at Login enabled]
C --> D[LaunchAgent plist renderer]
D --> E[macOS launchd]
E --> F[Login-launched OpenClaw app]
F --> G[Selected config and state profile]
Before merge
Agent review detailsSecurityNone. PR surfaceOther +65. Total +65 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Refresh the branch against current Do we have a high-confidence way to reproduce the issue? Yes, source inspection provides a high-confidence path: launch the macOS app with both profile variables set, enable Launch at Login, and inspect the generated plist; current main emits only Is this the best way to solve the issue? Yes. Preserving the existing normalized profile variables in the already-used LaunchAgent environment is narrower and more maintainable than introducing a parallel profile-selection mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 206f989069fb. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
7863089 to
8fc7db9
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
Co-authored-by: Jasmine Zhang <[email protected]>
Co-authored-by: Jasmine Zhang <[email protected]>
|
Merged via squash.
|
* origin/main: test(codex): de-flake attempt turn-watch timing tests (#115258) fix: preserve retryable ACPX lease ownership (#115247) fix: serialize ACPX lease ownership transitions fix: retain ACPX leases across wrapper reconnects refactor: parse ACPX lease command identity fix: preserve OpenClaw profile env in macOS launch-at-login plist (#99752) refactor(config): retire compaction truncateAfterCompaction gate (#115206) improve(ui): reduce duplicate chat startup work (#114743) fix(ui): keep reconnects, browser tabs, and localized search consistent (#115221) perf(pr): cache complete small file lists (#115199) perf(sqlite): skip no-op automatic schema repair (#115193) docs(browser): correct Docker sandbox setup (#115254) fix(ui): avoid duplicate session refreshes during startup (#114764) # Conflicts: # ui/src/pages/agents/panels-tools-skills.browser.test.ts
* origin/main: test(codex): de-flake attempt turn-watch timing tests (#115258) fix: preserve retryable ACPX lease ownership (#115247) fix: serialize ACPX lease ownership transitions fix: retain ACPX leases across wrapper reconnects refactor: parse ACPX lease command identity fix: preserve OpenClaw profile env in macOS launch-at-login plist (#99752) refactor(config): retire compaction truncateAfterCompaction gate (#115206) improve(ui): reduce duplicate chat startup work (#114743) fix(ui): keep reconnects, browser tabs, and localized search consistent (#115221) perf(pr): cache complete small file lists (#115199) perf(sqlite): skip no-op automatic schema repair (#115193) docs(browser): correct Docker sandbox setup (#115254) fix(ui): avoid duplicate session refreshes during startup (#114764)
…enclaw#99752) * fix(macos): preserve profile env in launch-at-login plist * fix(macos): preserve login profile environment Co-authored-by: Jasmine Zhang <[email protected]> * test(macos): isolate launch agent PATH coverage Co-authored-by: Jasmine Zhang <[email protected]> --------- Co-authored-by: Jasmine Zhang <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Fixes #98594.
What Problem This Solves
The macOS app reads
OPENCLAW_CONFIG_PATHandOPENCLAW_STATE_DIRto select its active profile, but its launch-at-login plist preserved onlyPATH. After login, the relaunched app could therefore fall back to the default config and state directory.Why This Change Was Made
PATH.OpenClawEnv.pathso foreground and login-launched processes share whitespace and empty-value normalization.PATHand profile values, and test raw key uniqueness, special-character round trips, and blank omission under the shared Swift env lock.Apple's current
launchd.plist(5)contract definesEnvironmentVariablesas a dictionary of string values. The real-behavior proof below uses the documentedlaunchctl bootstrap/bootoutpath.User Impact
Enabling Launch at login from an app process started with explicit config/state paths now preserves that same profile on the next login. Users without those overrides keep the existing
PATH-only behavior.Evidence
Exact head:
085fe7532ed3c6c75d879fa55f2148e34304ad23PATHtest pollution, the test now injects preferred paths directly. The four previously failing parallel suites plus both LaunchAgent suites pass together, 147/147.plutil -lint: generated populated and blank plists passed.PATH,OPENCLAW_CONFIG_PATH, andOPENCLAW_STATE_DIR; every raw key appeared exactly once. Blank/unset profile values produced onlyPATH.PATH, config path, and state directory. The temporary service was booted out after inspection.git diff --checkpassed. Codex autoreview accepted and fixed one PATH-escaping regression, then confirmed both the final bundle at 0.96 confidence and the test-isolation repair at 0.98 confidence.The contributor branch's old standalone dependency graph no longer builds under this machine's current Swift actor checks. Proof therefore runs against the synthetic merge users would actually receive, which carries current
maindependency pins; exact-head hosted macOS CI remains the landing authority.