agent: TestPiModelsAskedOnTheirNativeAPI asks Gemini's API of OmO's folder, Pi's keeps Chat (2f5a3f1c0)

2f5a3f1c0 kept a Gemini model on Chat in Pi's models.json (Raft runs
Pi's SDK on it with a fetch pi-ai's Google adapter refuses) and was
pushed before its full suite ended. That suite went red on this test,
which still wanted google-generative-ai at /v1beta in Pi's file. It now
wants Chat there (no api, no baseUrl), and checks the same providers in
OmO's models.json, whose folder is its own: gem/ and hybrid/
gemini-3-flash on google-generative-ai at /v1beta, hybrid/gemini-2.5-pro
and the Gemini routing group on Chat.

Run (mote, at this tree on 2f5a3f1c0):
- Full suite at 2f5a3f1c0's tree (go test -tags nogui ./... -count=1
  -timeout 45m): every package ok but internal/agent, red on this test
  alone.
- go test -tags nogui ./internal/agent -count=1 -timeout 45m: ok (150s).
- Broken by hand (piAsked back to StepCode alone): this test red on Pi's
  two Gemini entries; OmO's part passes either way.
- gofmt -l: nothing.
This commit is contained in:
yetone
2026-10-30 17:43:35 +08:00
parent 8974836679
commit 7474a86f16
+32 -4
View File
@@ -68,8 +68,11 @@ func TestPiModelsAskedOnTheirNativeAPI(t *testing.T) {
"relay/glm-4.6": nil,
"anth/claude-sonnet-5": "anthropic-messages",
"anth/kimi-k3": "anthropic-messages",
"gem/gemini-3-flash": "google-generative-ai",
"hybrid/gemini-3-flash": "google-generative-ai",
// Pi's folder keeps Gemini on Chat: Raft runs Pi's SDK on it with
// a fetch pi-ai's Google adapter refuses (piAsked); OmO, below,
// asks Gemini's API
"gem/gemini-3-flash": nil,
"hybrid/gemini-3-flash": nil,
"hybrid/gemini-2.5-pro": nil,
"auto/gpt-5.5": "openai-responses",
"group/gpts": "openai-responses",
@@ -101,8 +104,33 @@ func TestPiModelsAskedOnTheirNativeAPI(t *testing.T) {
t.Errorf("a Responses model keeps the provider's baseUrl: %v", entries["resp/grok-5"])
}
for _, id := range []string{"gem/gemini-3-flash", "hybrid/gemini-3-flash"} {
if e := entries[id]; e["baseUrl"] != gateway.URL()+"/v1beta" {
t.Errorf("%s baseUrl: %v", id, e)
if e := entries[id]; e["baseUrl"] != nil {
t.Errorf("Pi: %s baseUrl: %v", id, e)
}
}
if err := omo(home).Field("model").Set("magpie/resp/grok-5"); err != nil {
t.Fatal(err)
}
var omoFile map[string]any
if err := json.Unmarshal([]byte(readFile(filepath.Join(home, ".omo", "agent", "models.json"))), &omoFile); err != nil {
t.Fatal(err)
}
omoAPIs := map[string]map[string]any{}
for _, raw := range omoFile["providers"].(map[string]any)["magpie"].(map[string]any)["models"].([]any) {
m := raw.(map[string]any)
omoAPIs[m["id"].(string)] = m
}
for id, want := range map[string]any{"gem/gemini-3-flash": "google-generative-ai", "hybrid/gemini-3-flash": "google-generative-ai", "hybrid/gemini-2.5-pro": nil, "group/geminis": nil} {
e, ok := omoAPIs[id]
if !ok {
t.Errorf("OmO: %s not listed", id)
continue
}
if e["api"] != want {
t.Errorf("OmO: %s: api %v, want %v", id, e["api"], want)
}
if want != nil && e["baseUrl"] != gateway.URL()+"/v1beta" {
t.Errorf("OmO: %s baseUrl: %v", id, e)
}
}
}