A path through magpie's own screens was written with › in some places and → in others (11-17 scan, item 18). Every one the user reads is now ›: Settings › Network and sharing, Settings › Privacy, Library › MCP servers, Providers › … › Use it anyway, Settings › Usage, in the GUI and in the Go errors and notices that reach it, in every language. The GUI matches errNotAsked by its prefix, so it still finds it. Left as they are: gateway errors written for agents, AiHubMix's and Claude Desktop's own menu paths (their apps' words), the image MCP tool description (it goes to agents), and comments. Own tests: chatgpt-usage-why, websearch-places, library-mcp-hub, i18n-keys; Go: internal/library (TestPrivateRepoInstallsWithToken, red on the first try because skills.go still had →), internal/plugin (notplugin_test), internal/pii, internal/provider. Run (mote, Chromium and WebKit, en zh zh-TW ja de): - before the rebase, 23 GUI files: every one green except plugin-provider-options (my bug, fixed in this branch before the push) and settings-groups' "warm-ups and check-in in each service's provider editor", red the same way at fresh origin/main98c487d09(an extra "Spend extra usage" row; #6597, commented with the sha). - rebased on origin/main98c487d09: advanced-headings, plugin-provider-options, i18n-keys, routing-advanced, provider-prefs, settings-search, panel-profiles, builtins, chatgpt-usage-why, provider-concurrency, websearch-places, library-mcp-hub all green; go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii, plugin, provider and access ok; go vet ok. No budget raised. Again at the pushed head, rebased on origin/main39c5040d7and07d19510f(mote, Chromium and WebKit, every language): advanced-headings, plugin-provider-options, i18n-keys, routing-advanced, provider-prefs, settings-search, panel-profiles, builtins, chatgpt-usage-why, provider-concurrency, websearch-places, library-mcp-hub, codex-client, codex-client-editor and nav-timeout all green; go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii, plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway and agent tests whose strings changed; gofmt -l empty; go vet, GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/... clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only webview_window_linux.go, the same on origin/main 39c5040d7.) Not tried: the real app window, and Linux/Windows runs (cross-OS go vet only).
46 lines
1.5 KiB
Go
46 lines
1.5 KiB
Go
package agent
|
||
|
||
import (
|
||
"errors"
|
||
"path/filepath"
|
||
"strings"
|
||
"testing"
|
||
|
||
"github.com/yetone/magpie/internal/provider"
|
||
)
|
||
|
||
// znuaibot's case (#1989): OpenCode is shown only the one model picked for
|
||
// it, and that model's provider is switched off. magpie has models, but
|
||
// none is left in OpenCode's lists: Connect says so, with a code the GUI
|
||
// says it by in the reader's language, not that OpenCode can't be
|
||
// connected.
|
||
func TestConnectWithEveryModelTakenOut(t *testing.T) {
|
||
home, _ := codexHome(t, "", "")
|
||
if err := provider.Save(provider.Provider{ID: "gem", Name: "Gem", Key: "k", Chat: "http://127.0.0.1:1/v1", Models: []string{"gemini-3.8-flash"}}); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
if _, err := provider.SetModelLists(map[string]provider.ModelList{"opencode": {Only: true, Picked: []string{"gem/gemini-3.8-flash"}}}); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
if err := provider.SetOff("gem", true); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
cfg := filepath.Join(home, ".config")
|
||
_, err := opencode(home, cfg).ConnectHow()
|
||
var ah *AllHiddenError
|
||
if !errors.As(err, &ah) || ah.Agent != "OpenCode" || !strings.Contains(err.Error(), "Model list › Pick") {
|
||
t.Fatalf("%v", err)
|
||
}
|
||
var nm *NoModelsError
|
||
if errors.As(err, &nm) {
|
||
t.Fatalf("said there are no models: %v", err)
|
||
}
|
||
// the provider on again, its picked model is there to connect to
|
||
if err := provider.SetOff("gem", false); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
if _, err := opencode(home, cfg).ConnectHow(); err != nil {
|
||
t.Fatalf("with the picked model's provider on: %v", err)
|
||
}
|
||
}
|