Skip to content

fix(macos): preserve gateway auth config writes - #75953

Merged
BunsDev merged 1 commit into
openclaw:mainfrom
BunsDev:meow/preserve-dashboard-auth-config
May 2, 2026
Merged

BunsDev merged 1 commit into
openclaw:mainfrom
BunsDev:meow/preserve-dashboard-auth-config

Conversation

@BunsDev

@BunsDev BunsDev commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: macOS app/dashboard config writes can fall back to direct full-config saves and drop persisted gateway.auth or unrelated config keys.
  • Why it matters: dropping auth can force restart-time behavior changes and disconnect Control UI/dashboard clients with 1012 service restart.
  • What changed: local fallback saves now merge against a fresh on-disk snapshot, direct saves preserve existing gateway.auth by default, and the Tailscale auth editor opts into explicit auth mutation.
  • What did NOT change (scope boundary): this does not migrate every macOS settings writer to Gateway config.patch or change Gateway RPC semantics.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

  • Root cause: macOS app-side full-config fallback writes treated a stale app snapshot as authoritative for the persisted config file.
  • Missing detection / guardrail: direct config saves audited suspicious changes but did not preserve gateway.auth before writing.
  • Contributing context (if known): Gateway config.set/config.patch paths have stronger base-hash protections than the local macOS fallback path.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: apps/macos/Tests/OpenClawIPCTests/OpenClawConfigFileTests.swift
  • Scenario the test should lock in: direct and fallback-style config writes preserve existing gateway.auth and unrelated config keys unless the caller explicitly edits auth.
  • Why this is the smallest reliable guardrail: it exercises the macOS file writer and merge behavior without requiring a live Gateway restart.
  • Existing test that already covers this (if any): N/A
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

macOS/dashboard settings writes preserve persisted Gateway auth and unrelated config by default, reducing surprise disconnect/auth drift after settings changes.

Diagram (if applicable)

Before:
[dashboard/app setting save] -> [local full-config fallback] -> [gateway.auth may disappear]

After:
[dashboard/app setting save] -> [fresh snapshot merge] -> [gateway.auth and unknown keys preserved]

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) Yes
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: this hardens persisted token/auth handling by preserving existing gateway.auth unless a caller explicitly opts into auth mutation.

Repro + Verification

Environment

  • OS: macOS host, SwiftPM package under apps/macos
  • Runtime/container: local checkout on Node 24.13.0 / pnpm workspace
  • Model/provider: N/A
  • Integration/channel (if any): macOS app/dashboard config path
  • Relevant config (redacted): tests use temp OPENCLAW_STATE_DIR and OPENCLAW_CONFIG_PATH

Steps

  1. Start with an openclaw.json containing gateway.auth and unrelated config.
  2. Save a partial macOS app/dashboard config snapshot that omits auth and unrelated keys.
  3. Reload the config from disk.

Expected

  • Existing gateway.auth is still present.
  • Unrelated config keys are still present for fallback-merge writes.
  • Explicit auth edits can still remove or replace auth by opting into auth mutation.

Actual

  • Matches expected after this patch.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What I personally verified (not just CI), and how:

  • Verified scenarios:
    • swift test --package-path apps/macos --filter OpenClawIPCTests.OpenClawConfigFileTests
    • swift test --package-path apps/macos --filter OpenClawIPCTests.ConfigStoreTests
    • node scripts/check-changed.mjs CHANGELOG.md apps/macos/Sources/OpenClaw/ConfigStore.swift apps/macos/Sources/OpenClaw/OpenClawConfigFile.swift apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift apps/macos/Tests/OpenClawIPCTests/OpenClawConfigFileTests.swift
    • git diff --check origin/main..HEAD
  • Edge cases checked: explicit auth mutation remains possible through the Tailscale auth editor path; fallback merge preserves unrelated nested config.
  • What you did not verify: a live macOS dashboard settings gesture against a running Gateway.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: some caller intentionally expected a generic direct save to remove gateway.auth by omission.
    • Mitigation: callers that edit auth can pass allowGatewayAuthMutation: true; the known auth editor path does so.

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos size: S maintainer Maintainer-authored PR labels May 2, 2026
@BunsDev
BunsDev force-pushed the meow/preserve-dashboard-auth-config branch from cb75f04 to d7fa1eb Compare May 2, 2026 04:42
@clawsweeper

clawsweeper Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(macos): preserve gateway auth config writes This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS app/dashboard config writes can drop gateway.auth and restart Gateway

1 participant