From 5d4d177a58d0c5dda78e4c3d099eac35a7d778ad Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 03:36:50 +0000 Subject: [PATCH 1/2] fix(config): ensure user model_list isn't overridden with default models if originally empty Previously, `loadConfig` in `pkg/config/migration.go` checked `len(tmp.ModelList) > 0` to decide whether to override the default loaded `cfg.ModelList`. If the user has manually cleared out their model list, leaving it as an empty array (`[]`), the unmarshaling would fail this condition and revert their list to the long default list again whenever the configuration is saved. This commit changes the condition to use `json.RawMessage` to accurately detect if the `model_list` key was actually present in the file, regardless of its length. Co-authored-by: TanLuong <28281768+TanLuong@users.noreply.github.com> --- pkg/config/migration.go | 6 ++++-- pkg/config/migration.go.patch | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 pkg/config/migration.go.patch diff --git a/pkg/config/migration.go b/pkg/config/migration.go index fee800a76..d93fbc00b 100644 --- a/pkg/config/migration.go +++ b/pkg/config/migration.go @@ -521,11 +521,13 @@ func loadConfig(data []byte) (*Config, error) { // would silently inherit values from the DefaultConfig template at the same // index position. We only reset cfg.ModelList when the user actually provides // entries; when count is 0 we keep DefaultConfig's built-in list as fallback. - var tmp Config + var tmp struct { + ModelList json.RawMessage `json:"model_list"` + } if err := json.Unmarshal(data, &tmp); err != nil { return nil, err } - if len(tmp.ModelList) > 0 { + if tmp.ModelList != nil { cfg.ModelList = nil } diff --git a/pkg/config/migration.go.patch b/pkg/config/migration.go.patch new file mode 100644 index 000000000..84485866e --- /dev/null +++ b/pkg/config/migration.go.patch @@ -0,0 +1,21 @@ +--- pkg/config/migration.go ++++ pkg/config/migration.go +@@ -515,11 +515,16 @@ + // zero-initializing them, so fields absent from the user's JSON (e.g. api_base) + // would silently inherit values from the DefaultConfig template at the same + // index position. We only reset cfg.ModelList when the user actually provides + // entries; when count is 0 we keep DefaultConfig's built-in list as fallback. +- var tmp Config ++ var tmp struct { ++ ModelList json.RawMessage `json:"model_list"` ++ } + if err := json.Unmarshal(data, &tmp); err != nil { + return nil, err + } +- if len(tmp.ModelList) > 0 { ++ if tmp.ModelList != nil { ++ // User explicitly defined model_list, even if it's empty [] + cfg.ModelList = nil + } + + if err := json.Unmarshal(data, cfg); err != nil { From cc49f37eb2ff470ad70d95b445a34ca72e4680b2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 03:40:37 +0000 Subject: [PATCH 2/2] fix(linter): fix golines formatting issues on vertex provider and config struct These fixes address the CI failure: pkg/config/config.go:1051:1: File is not properly formatted (golines) pkg/providers/vertex/provider.go:90:1: File is not properly formatted (golines) Co-authored-by: TanLuong <28281768+TanLuong@users.noreply.github.com> --- pkg/config/config.go | 8 ++++---- pkg/providers/vertex/provider.go | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 3a4c0f6a6..d94da7694 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1048,10 +1048,10 @@ type SearXNGConfig struct { } type GLMSearchConfig struct { - Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_WEB_GLM_ENABLED"` - apiKey string - secDirty bool - BaseURL string `json:"base_url" env:"PICOCLAW_TOOLS_WEB_GLM_BASE_URL"` + Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_WEB_GLM_ENABLED"` + apiKey string + secDirty bool + BaseURL string `json:"base_url" env:"PICOCLAW_TOOLS_WEB_GLM_BASE_URL"` // SearchEngine specifies the search backend: "search_std" (default), // "search_pro", "search_pro_sogou", or "search_pro_quark". SearchEngine string `json:"search_engine" env:"PICOCLAW_TOOLS_WEB_GLM_SEARCH_ENGINE"` diff --git a/pkg/providers/vertex/provider.go b/pkg/providers/vertex/provider.go index 9c1ea41dc..171ea11a6 100644 --- a/pkg/providers/vertex/provider.go +++ b/pkg/providers/vertex/provider.go @@ -87,7 +87,14 @@ func (p *Provider) buildURL(model string, action string) string { if region == "" { region = "us-central1" } - baseURL = fmt.Sprintf("https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s", region, p.projectID, region, model, action) + baseURL = fmt.Sprintf( + "https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s", + region, + p.projectID, + region, + model, + action, + ) } // Only append ?key= for custom apiBase endpoints