Repository navigation
fix(daemon): preserve file-backed gateway auth secrets across service regeneration - #120458
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
August 8, 2026 04:19
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 8, 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.
What Problem This Solves
In-place updates (brew upgrade,
openclaw gateway installreinstall) regenerate the managed launchd service-env file and dropOPENCLAW_GATEWAY_AUTH_TOKENwhile preserving channel tokens. The gateway then fails startup withSecretRefResolutionError— recurring even after the 2026.7.1 fix for the same class.Fixes symptom 1 of #111578 (reported by @tlopez80-a11y). Symptom 2 (CLI auth outside the LaunchAgent's sourced env) is intentional fail-closed per docs; a design proposal (scoped paired-device auth) is escalated separately.
Why This Change Was Made
Root cause: the install planner unconditionally excluded
gateway.auth.token/gateway.auth.passwordfrom the service-env plan (NON_PERSISTED_CONFIG_SECRET_ENV_TARGET_IDS) before existing file-backed values were even considered — so every regeneration deleted the entry by design. The recurrence was structural, not a missed edge case.Security calibration (maintainer decision, recorded inline): gateway ingress secrets are still never newly materialized into supervisor metadata — fresh installs and mismatched/inactive refs get nothing. But when the existing service-env file already carries an active, matching, file-backed auth ref, regeneration preserves it: deleting it protects nothing (the same file retains channel tokens) while breaking gateway startup on every update — the worst outcome class.
Also forward-ports two release-branch-only commits to main (same owner surface, previously missing from main entirely):
45b6793ebfe1c"preserve runtime env during service refresh" (origin75a613587cd9) and8b85caff51143"expose service env helper through owner module" — without these, next month's train would regress the update path.User Impact
Updating OpenClaw no longer bricks gateway startup for operators using
gateway.auth.tokenas a file-backed SecretRef.Evidence
stageLaunchAgent→ emitted-file reread; before the fix the regenerated plan retained Telegram tokens but droppedOPENCLAW_GATEWAY_AUTH_TOKEN; after, both survive. Coverage includes permissions, plist secrecy, token/password symmetry, mismatched/inactive refs dropped, dotenv precedence, and fresh-install non-materialization.pnpm tsgo:core+tsgo:core:testpass; deadcode scans clean;git diff --checkclean.gpt-5.6-sol, high): clean three times (worker, independent re-review, coordinator pass on frozen diff — 0.98).