Repository navigation
Description
Summary
After updating OpenClaw to 2026.6.1 on macOS, a LaunchAgent-managed gateway using a secret-provider-backed environment broke because the generated gateway env wrapper was regenerated during reinstall/repair.
This is not a request to add Infisical-specific support. OpenClaw already has the right first-class mechanism via:
openclaw gateway install --wrapper <path>OPENCLAW_WRAPPER
The issue is that update/install/doctor/status flows do not make it obvious when a user has modified a generated wrapper, or when CLI diagnostics are running outside the same secret-provider context as the installed gateway service.
Environment
- macOS
- LaunchAgent-managed OpenClaw gateway
- OpenClaw
2026.6.1 (2e08f0f) - Gateway health endpoint:
127.0.0.1:18789 - Secrets provided through an external wrapper, not directly present in the interactive shell
What Happened
After running the update/reinstall flow, openclaw gateway install --force regenerated:
~/.openclaw/service-env/ai.openclaw.gateway-env-wrapper.sh
back to the plain generated wrapper behavior:
source <env-file>
exec "$@"That overwrote local wrapper behavior that had been calling a stable secret-provider executor:
~/.openclaw/service-env/openclaw-infisical-env-exec.py
As a result:
openclaw statusprinted many missing env-var warnings even though secrets had been migrated to the secret provider.- The gateway entered a crash/spawn loop until the service wrapper/env setup was repaired.
- The interactive CLI path also remained misleading because
/opt/homebrew/bin/openclawinvoked Node directly, soopenclaw statusbypassed the same secret-provider context used by the LaunchAgent service.
Why This Was Confusing
Generated *-env-wrapper.sh files appear to be overwritten by design, which is reasonable.
However, it is easy for operators to miss that modifying the generated wrapper is fragile. After reinstall/repair, the service and CLI can also disagree:
- The installed gateway service may have access to secrets through a wrapper.
- The interactive CLI process may not.
openclaw statusthen reports missing env vars even when the intended service path has been repaired or is otherwise configured differently.
Requested Behavior
Consider one or more of the following:
-
During
gateway install --force, update, or doctor repair, detect when the generated env wrapper contains non-generated custom behavior and warn before overwriting it. -
If overwriting is intentional, explicitly recommend moving custom behavior to a stable wrapper passed through:
openclaw gateway install --wrapper <path>
or:
OPENCLAW_WRAPPER=<path>
-
Make
openclaw statusdiagnostics clearer when required secrets may be available only through the installed gateway/service wrapper, but not through the current interactive CLI process. -
Have doctor surface a warning when the CLI/status environment differs materially from the installed service wrapper environment.
Related Auth Profile Migration Issue
During the same update, agent runs also hit Codex app-server auth-profile validation failures around legacy profile IDs matching:
openai-codex:*
while validation expected canonical IDs like:
openai:*
This may be a separate migration-timing issue, but it appeared during the same update/repair window. It may be useful for doctor to flag legacy openai-codex:* auth-profile IDs before app-server validation rejects them, or to make that migration timing clearer.
Local Repair / Validation
After repair, the local setup was changed to:
- Use a stable wrapper outside the generated wrapper path.
- Invoke the local CLI through the same secret-provider wrapper context.
- Avoid storing secret values in generated files.
Validation after repair:
- Gateway health live on
127.0.0.1:18789 openclaw --versionreturns2026.6.1 (2e08f0f)openclaw status --timeout 15000no longer reports missing env-var diagnosticsopenclaw status --deep --timeout 30000reports Discord, iMessage, Slack, and Telegram OK
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 5, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 7:50 AM ET / 11:50 UTC.
Summary
Keep open: current main and the latest release still rewrite the generated macOS LaunchAgent env wrapper without detecting local custom behavior, and the open linked PR is the active closing fix path.
Reproducibility: yes. The reporter supplied an isolated macOS LaunchAgent repro, and current main still has the unconditional generated-wrapper write path; I did not run a fresh live macOS repro in this read-only review.
Root-cause cluster
Relationship:
canonicalCanonical: #90518
Summary: This issue is the canonical report for generated macOS LaunchAgent env-wrapper overwrite and misleading status diagnostics; the linked open PR is the candidate fix.
Members:
fixed_by_candidate: Warn on generated wrapper overwrites and status diagnostics #90537 - The PR is open and has this issue as a GitHub closing reference while changing the launchd and status surfaces described here.adjacent_distinct: fix(macos): LaunchAgent starts gateway on external home volumes #89967 - This open PR also touches macOS generated env-wrapper behavior, but it targets shell-first launchd serialization for permission-constrained volumes rather than customized wrapper overwrite warnings or status diagnostics.adjacent_distinct: gateway install --force: dist/index.js entrypoint causes plugin load failure (Unknown system error -11) under launchd #84817 - This open issue also reports a macOS launchd restart-loop class failure, but its tracked root is wrapperless dist entrypoint/plugin loading rather than generated wrapper customization being overwritten.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
No new repair lane should be queued because the open linked PR already owns the implementation path.
Review details
Best possible solution:
Review and land #90537 if it remains acceptable, keeping
--wrapperandOPENCLAW_WRAPPERas the durable operator path and tracking any auth-profile migration concern separately.Do we have a high-confidence way to reproduce the issue?
Yes. The reporter supplied an isolated macOS LaunchAgent repro, and current main still has the unconditional generated-wrapper write path; I did not run a fresh live macOS repro in this read-only review.
Is this the best way to solve the issue?
Yes. The linked PR's warning at the launchd wrapper write site plus status-context hint is narrower than provider-specific support or a new configuration surface.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against d1cbe29f3d52.
Label changes
Label justifications:
P2: This is a confirmed macOS gateway install/status reliability bug with a clear workaround and an active focused fix path.impact:auth-provider: The failure involves secrets available through the installed service wrapper context but missing from the interactive CLI/status environment.impact:crash-loop: When the generated wrapper is overwritten, a LaunchAgent-managed gateway can repeatedly crash or respawn until wrapper setup is repaired.Evidence reviewed
What I checked:
gateway install --forcerewrote a customized generated wrapper back to stock content and removed the custom marker.src/daemon/launchd.ts:214, d1cbe29f3d52)src/commands/status.command.ts:244, d1cbe29f3d52)--wrapperandOPENCLAW_WRAPPERas the persistent managed-service wrapper path for forced reinstalls, updates, and doctor repairs. Public docs:docs/cli/gateway.md. (docs/cli/gateway.md:461, d1cbe29f3d52)src/daemon/launchd.ts:213, c645ec4555c0)Likely related people:
src/cli/daemon-cli/install.ts,src/commands/daemon-install-helpers.ts,src/daemon/program-args.ts)src/daemon/launchd.ts,src/commands/daemon-install-helpers.ts,src/commands/status.command.ts)src/daemon/launchd.ts,src/cli/update-cli/update-command.ts)src/daemon/launchd.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.TurboTheTurtle commentedon Jun 5, 2026
Added a live macOS LaunchAgent repro for the generated-wrapper overwrite path. This used an isolated throwaway profile/state dir, not my real gateway service.
Environment:
2026.6.2 (8deff20)from current local main buildissue90518reproai.openclaw.issue90518repro/tmp/openclaw-90518-repro.UvAeAo19899Repro steps and observed output:
Then I simulated operator custom behavior inside the generated wrapper path:
Then I forced a reinstall of the same isolated LaunchAgent:
Cleanup confirmation:
Expected: if OpenClaw is about to overwrite a generated macOS env wrapper that contains non-generated custom behavior, it should warn and point the operator to the persistent
openclaw gateway install --wrapper <path>/OPENCLAW_WRAPPERmechanism.Actual:
openclaw gateway install --forcesilently rewrote the generated wrapper back to the stock wrapper and removed the custom behavior.This repro intentionally uses a harmless marker command instead of any real secret provider. It demonstrates the same failure mode as a local secret-provider exec wrapper being placed inside the generated
*-env-wrapper.shfile and then being silently removed by reinstall/update/repair.@clawsweeper re-review
clawsweeper commentedon Jun 5, 2026
🦞🧹
ClawSweeper re-review requested.
I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow
sweep.yml, eventrepository_dispatch).Result: the existing ClawSweeper review comment will be edited in place when the review finishes.
Re-review progress: