Skip to content

[Bug]: macOS app wipes gateway.auth config when saving - should use config.patch instead of config.set #4286

@hexsprite

Description

@hexsprite

Description

The macOS app uses config.set to save configuration changes, which replaces the entire config file. This causes gateway.auth settings (and potentially other config blocks the app UI does not understand) to be wiped when the app saves any config change.

Steps to Reproduce

  1. Set gateway auth via CLI:
    moltbot config set gateway.auth.mode token
    moltbot config set gateway.auth.token "my-secret-token"
  2. Start the macOS app
  3. Make any change via the app UI (e.g., toggle a channel setting)
  4. Observe the gateway restart fails with: gateway auth mode is token, but no token was configured

Expected Behavior

The gateway.auth configuration should be preserved when the app saves other config changes.

Root Cause

In apps/macos/Sources/Moltbot/ConfigStore.swift:101:

_ = try await GatewayConnection.shared.requestRaw(
    method: .configSet,  // <-- full replace
    params: params,
    timeoutMs: 10000)

The app uses config.set which replaces the entire config. If the app internal representation does not include gateway.auth, it gets dropped.

Suggested Fix

Use config.patch instead of config.set to merge changes, or ensure the app preserves all unknown config keys when round-tripping.

Logs

2026-01-30T01:04:12.213Z [reload] config change detected; evaluating reload (meta.lastTouchedAt, agents.defaults.contextPruning, gateway.auth)
2026-01-30T01:04:12.215Z [reload] config change requires gateway restart (meta.lastTouchedAt, gateway.auth)
...
2026-01-30T01:04:12.666Z Gateway failed to start: Error: gateway auth mode is token, but no token was configured

Environment

  • macOS Sequoia
  • Moltbot version: 2026.1.29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions