Skip to content

fix(macos): skip unresolved dashboard auth templates#101375

Merged
steipete merged 5 commits into
openclaw:mainfrom
fengjikui:codex/macos-secretref-token
Jul 9, 2026
Merged

fix(macos): skip unresolved dashboard auth templates#101375
steipete merged 5 commits into
openclaw:mainfrom
fengjikui:codex/macos-secretref-token

Conversation

@fengjikui

@fengjikui fengjikui commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #101286.

macOS OpenClaw.app could treat gateway.auth.token: "${OPENCLAW_GATEWAY_TOKEN}" as a literal local dashboard token when the GUI app environment did not contain that variable. That bypassed the LaunchAgent token fallback and produced a dashboard URL with an encoded placeholder fragment instead of a usable token.

Why This Change Was Made

  • Teach the local macOS auth resolver to recognize the same env SecretRef shorthand accepted by core config: ${NAME} and $NAME, with NAME matching ^[A-Z][A-Z0-9_]{0,127}$.
  • Resolve valid env SecretRefs from the app process environment when available.
  • If a valid env SecretRef is unresolved, return nil so the existing LaunchAgent snapshot fallback can supply the local token/password, and so unresolved placeholders are never embedded in the dashboard URL.
  • Keep non-matching strings such as ${custom_gateway_token} as plaintext, matching the core SecretInput parser instead of introducing a broader Swift-only grammar.
  • Keep remote gateway config token/password behavior unchanged.

User Impact

Users launching OpenClaw.app from Finder/Dock can recover when the gateway token only exists in the per-user LaunchAgent environment. The dashboard URL uses the resolved LaunchAgent token when available, or omits token auto-auth instead of passing a raw placeholder. Existing literal strings that are not valid env SecretRefs continue to be treated as plaintext.

Evidence

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 3e1c9a65efe744414c1998aa2b4834aa8dfd7ff1, but the PR head is now 8f15aa861c85b8190efa33f0502ceed2fcd2a495. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (8 earlier review cycles)
  • reviewed 2026-07-07T05:29:51.877Z sha 41eaef2 :: needs real behavior proof before merge. :: [P2] Align the Swift template parser with the SecretRef grammar
  • reviewed 2026-07-07T06:01:51.206Z sha 7467386 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T06:15:34.346Z sha 7467386 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T07:02:19.869Z sha 5e49845 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T10:46:19.935Z sha 2e00abe :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T11:02:32.136Z sha 2e00abe :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T11:36:06.143Z sha 46e8fb9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T03:20:51.007Z sha 0324d55 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog edit

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 7, 2026
@fengjikui
fengjikui force-pushed the codex/macos-secretref-token branch from 41eaef2 to 7467386 Compare July 7, 2026 05:49
@fengjikui

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I pushed 7467386 to address the parser-contract finding by matching ${NAME} / $NAME uppercase SecretRef grammar, added LaunchAgent fallback tests for token and password, and updated the PR body with the current upstream macOS CI evidence. macos-swift, macos-node, native-i18n, and the repository Real behavior proof check are now passing on the updated branch.

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@fengjikui
fengjikui force-pushed the codex/macos-secretref-token branch from 7467386 to 5e49845 Compare July 7, 2026 06:48
@fengjikui
fengjikui force-pushed the codex/macos-secretref-token branch 2 times, most recently from 104a877 to 0006394 Compare July 7, 2026 10:25
@fengjikui
fengjikui force-pushed the codex/macos-secretref-token branch from 0006394 to 2e00abe Compare July 7, 2026 10:34
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 7, 2026
@fengjikui

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current head is 2e00abe3; the branch has been rebased onto origin/main 942b4496, and the PR body now points to the passing Real behavior proof, macos-swift, macos-node, and native-i18n checks for this head.

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 7, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. label Jul 7, 2026
@fengjikui
fengjikui force-pushed the codex/macos-secretref-token branch 2 times, most recently from 620842d to 46e8fb9 Compare July 7, 2026 11:16
@fengjikui

Copy link
Copy Markdown
Contributor Author

Quick status update while refreshing proof for this PR:

So I am not refreshing this PR branch yet to avoid stacking an unmerged dependency into it. Once #101611 lands, I will rebase this PR onto current main, rerun the full proof set, and refresh the PR evidence for the rebased head.

@steipete
steipete force-pushed the codex/macos-secretref-token branch from 0324d55 to 3e1c9a6 Compare July 9, 2026 03:24
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready proof for exact head 8f15aa861c85b8190efa33f0502ceed2fcd2a495:

  • Before: current main treats a valid local $NAME or ${NAME} SecretRef as the literal dashboard credential, so the placeholder reaches the URL fragment before LaunchAgent fallback.
  • After: local token/password refs resolve in documented precedence order from the app environment, the inline LaunchAgent environment, or the canonical generated service environment used by current installs. Unresolved valid refs never reach the URL; literals and remote gateway behavior remain unchanged.
  • Current-install proof: this Mac's installed LaunchAgent references the canonical generated wrapper/environment-file pair exercised by the new parser tests. No credential values were printed or uploaded.
  • Native macOS proof: GatewayLaunchAgentManagerTests 5/5 and GatewayEndpointStoreTests 42/42 passed; touched Swift files were formatted; git diff --check passed.
  • Fresh Codex autoreview: no actionable findings.
  • Exact-head CI: run 28992029782, including macos-swift, macos-node, native-i18n, and security-fast.

No before/after screenshot: this changes credential-source routing, not pixels or layout; a screenshot would expose no meaningful behavioral difference and could risk showing auth material.

@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 9, 2026
@steipete
steipete merged commit 003bb82 into openclaw:main Jul 9, 2026
49 of 55 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 9, 2026
* fix(macos): skip unresolved auth env templates

* fix(macos): align gateway auth env refs

* fix(macos): resolve dashboard refs from service env

* fix(macos): read generated gateway service env

* chore: keep release changelog owner-only

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. size: M

Projects

None yet

2 participants