Copilot's /models says capabilities.limits.max_prompt_tokens per account (936000 for gemini-4-carbon); magpie dropped it and told agents models.dev's 1048576 for the id, so Codex sent prompts Copilot answered 400 to. The window of a Copilot model is now that limit (models whose list says none keep models.dev's); other vendors are unchanged, the field being read only in copilotModels. The model catalog magpie writes for Codex lacked effective_context_window_percent, which every entry of Codex's own catalog has (95); Codex 0.166 worked out no limit from such an entry and never compacted. Magpie's entries now say 95, and a vendor-listed entry that omitted it gets it. Run: TestCopilotWindowIsThePromptItTakes, TestCodexCatalogSaysEffectivePercent and the codexcat/provider tests via mote-run. Broken by hand: window set to 0, and the percent left out; each new test goes red. Not tried: Codex 0.166 itself against the catalog (Codex 0.165 is on this machine; the live config was not touched).
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package codexcat
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/catalog"
|
|
)
|
|
|
|
// Every entry of Codex's own catalog says effective_context_window_percent
|
|
// (95); magpie's lacked it (codealc on X: Codex 0.166 on a Copilot Gemini
|
|
// worked out no limit and never compacted), for a model with no window
|
|
// known as for one with, and for a vendor-listed entry that omitted it.
|
|
func TestCodexCatalogSaysEffectivePercent(t *testing.T) {
|
|
t.Setenv("HOME", t.TempDir())
|
|
t.Setenv("USERPROFILE", os.Getenv("HOME"))
|
|
t.Setenv("XDG_CONFIG_HOME", filepath.Join(os.Getenv("HOME"), ".config"))
|
|
var got struct {
|
|
Models []map[string]any `json:"models"`
|
|
}
|
|
json.Unmarshal(Catalog([]catalog.Model{
|
|
{ID: "copilot/gemini-4-carbon", Name: "Gemini 4 Carbon", Context: 936000},
|
|
{ID: "x/nowindow", Name: "none"},
|
|
{ID: "x/listed", Name: "listed", Context: 200000, Codex: json.RawMessage(`{"slug":"listed","base_instructions":"p"}`)},
|
|
}), &got)
|
|
n := 0
|
|
for _, e := range got.Models {
|
|
slug, _ := e["slug"].(string)
|
|
if slug != "copilot/gemini-4-carbon" && slug != "x/nowindow" && slug != "x/listed" {
|
|
continue
|
|
}
|
|
n++
|
|
if e["effective_context_window_percent"] != float64(95) {
|
|
t.Errorf("%s: effective_context_window_percent %v; want 95", slug, e["effective_context_window_percent"])
|
|
}
|
|
}
|
|
if n != 3 {
|
|
t.Fatalf("%d of 3 entries found", n)
|
|
}
|
|
}
|