fix: prefer gateway config in local mode

This commit is contained in:
Peter Steinberger
2026-01-05 05:54:41 +00:00
parent 1119f2003e
commit 7c51efe8f8
2 changed files with 12 additions and 4 deletions

View File

@@ -7,6 +7,7 @@
### Fixes ### Fixes
- Onboarding: resolve CLI entrypoint when running via `npx` so gateway daemon install works without a build step. - Onboarding: resolve CLI entrypoint when running via `npx` so gateway daemon install works without a build step.
- TUI: migrate key handling to the updated pi-tui Key matcher API. - TUI: migrate key handling to the updated pi-tui Key matcher API.
- macOS: prefer gateway config reads/writes in local mode (fall back to disk if the gateway is unavailable).
- macOS: local gateway now connects via tailnet IP when bind mode is `tailnet`/`auto`. - macOS: local gateway now connects via tailnet IP when bind mode is `tailnet`/`auto`.
- macOS: Connections removes the sidebar toggle from the Settings toolbar to avoid overflow. - macOS: Connections removes the sidebar toggle from the Settings toolbar to avoid overflow.
- macOS: drop deprecated `afterMs` from agent wait params to match gateway schema. - macOS: drop deprecated `afterMs` from agent wait params to match gateway schema.

View File

@@ -34,11 +34,14 @@ enum ConfigStore {
if let override = overrides.loadRemote { if let override = overrides.loadRemote {
return await override() return await override()
} }
return await self.loadFromGateway() return await self.loadFromGateway() ?? [:]
} }
if let override = overrides.loadLocal { if let override = overrides.loadLocal {
return override() return override()
} }
if let gateway = await self.loadFromGateway() {
return gateway
}
return ClawdbotConfigFile.loadDict() return ClawdbotConfigFile.loadDict()
} }
@@ -55,13 +58,17 @@ enum ConfigStore {
if let override = overrides.saveLocal { if let override = overrides.saveLocal {
override(root) override(root)
} else { } else {
ClawdbotConfigFile.saveDict(root) do {
try await self.saveToGateway(root)
} catch {
ClawdbotConfigFile.saveDict(root)
}
} }
} }
} }
@MainActor @MainActor
private static func loadFromGateway() async -> [String: Any] { private static func loadFromGateway() async -> [String: Any]? {
do { do {
let snap: ConfigSnapshot = try await GatewayConnection.shared.requestDecoded( let snap: ConfigSnapshot = try await GatewayConnection.shared.requestDecoded(
method: .configGet, method: .configGet,
@@ -69,7 +76,7 @@ enum ConfigStore {
timeoutMs: 8000) timeoutMs: 8000)
return snap.config?.mapValues { $0.foundationValue } ?? [:] return snap.config?.mapValues { $0.foundationValue } ?? [:]
} catch { } catch {
return [:] return nil
} }
} }