fix(cli): clear conflicting OPENCLAW_LAUNCHD_LABEL when --profile is provided#2442
Open
BingqingLyu wants to merge 5 commits into
Open
fix(cli): clear conflicting OPENCLAW_LAUNCHD_LABEL when --profile is provided#2442BingqingLyu wants to merge 5 commits into
BingqingLyu wants to merge 5 commits into
Conversation
…provided When --profile is explicitly passed, applyCliProfileEnv() now clears OPENCLAW_LAUNCHD_LABEL only when it conflicts with the profile-derived label. This allows resolveLaunchAgentLabel() to derive the correct label from OPENCLAW_PROFILE instead of short-circuiting on a stale inherited value from a parent gateway process. Matching labels are preserved to respect explicit operator overrides. Fixes openclaw#65643
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.
Summary
Fixes openclaw#65643
When running CLI commands from within a gateway process that has
OPENCLAW_LAUNCHD_LABELset (e.g.ai.openclaw.batch), using--profile interactive gateway statuswould still resolve the wrong plist becauseresolveLaunchAgentLabel()short-circuits on the inherited env label.Changes
src/cli/profile.ts:applyCliProfileEnv()now clearsOPENCLAW_LAUNCHD_LABELonly when it conflicts with the profile-derived label. Matching labels are preserved to respect explicit operator overrides.src/cli/profile.test.ts: Added 4 test cases covering conflict clearing, label preservation, custom label clearing, and no-op behavior.Behavior
OPENCLAW_LAUNCHD_LABEL=ai.openclaw.batch+--profile interactiveOPENCLAW_LAUNCHD_LABEL=ai.openclaw.work+--profile workOPENCLAW_LAUNCHD_LABEL=com.custom.openclaw+--profile ops--profile opsTest plan