From a709e5a12d296cf7083a4b44e7f85ef2cbc93458 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Fri, 30 Jan 2026 04:17:56 +0800 Subject: [PATCH] fix(config): ensure empty mapping persists for `oauth-model-alias` deletions #1305 --- internal/config/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 5fd48408..63d04aa4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1414,6 +1414,16 @@ func pruneMappingToGeneratedKeys(dstRoot, srcRoot *yaml.Node, key string) { } srcIdx := findMapKeyIndex(srcRoot, key) if srcIdx < 0 { + // Keep an explicit empty mapping for oauth-model-alias when it was previously present. + // + // Rationale: LoadConfig runs MigrateOAuthModelAlias before unmarshalling. If the + // oauth-model-alias key is missing, migration will add the default antigravity aliases. + // When users delete the last channel from oauth-model-alias via the management API, + // we want that deletion to persist across hot reloads and restarts. + if key == "oauth-model-alias" { + dstRoot.Content[dstIdx+1] = &yaml.Node{Kind: yaml.MappingNode, Tag: "!!map"} + return + } removeMapKey(dstRoot, key) return }