Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: Codex has one subagent model, Same as the lead or one model for every subagent

yetone1cdc3a59fe39
diff --git a/internal/agent/codex.go b/internal/agent/codex.go
index 0819bee4a..6a08eb0db 100644
--- a/internal/agent/codex.go
+++ b/internal/agent/codex.go
@@ -1551,10 +1551,28 @@ func codexIn(at place) *Agent {
// is offered (#1633: a lead on a chat provider, its
// subagents wanted there too); a subagent whose task a
// ChatGPT-backed lead sealed stays on the model asked for
- // unless the one set is a ChatGPT account's (the gateway)
+ // unless the one set is a ChatGPT account's (the gateway).
+ // It is the one setting for the subagents' model the GUI
+ // shows: beside the subagents one above, the two read alike
+ // and nobody could tell them apart (the owner). So a pick
+ // here, Default too, takes away [agents]
+ // default_subagent_model, and Default is then the lead's
+ // model or the one it names, as it says
Key: "subagent_model", Label: "subagent model", Quiet: true,
Get: provider.CodexSubagentModel,
- Set: provider.SetCodexSubagentModel,
+ Set: func(v string) error {
+ m, err := subagent()
+ if err != nil {
+ return err
+ }
+ if err := provider.SetCodexSubagentModel(v); err != nil || m == "" {
+ return err
+ }
+ if err := edit.DelTOMLKey(path, "agents", "default_subagent_model"); err != nil {
+ return err
+ }
+ return dropSubEffort()
+ },
Options: func(map[string]string) []Option {
var out, groups []Option
for _, e := range provider.CodexSubagentModels() {
diff --git a/internal/agent/codex_route_test.go b/internal/agent/codex_route_test.go
index af4d84dcc..442753d8f 100644
--- a/internal/agent/codex_route_test.go
+++ b/internal/agent/codex_route_test.go
@@ -246,6 +246,33 @@ func TestCodexSubagentModelTakesAnyProvider(t *testing.T) {
}
}
+// The GUI shows one setting for the subagents' model, the one magpie puts
+// them all on: a pick there, Default too, takes away Codex's own [agents]
+// default_subagent_model, which read the same and nobody could tell apart,
+// and keeps the user's other [agents] keys; a refused pick leaves it.
+func TestCodexSubagentModelReplacesConfigs(t *testing.T) {
+ for _, pick := range []string{"fake/m1", ""} {
+ home, read := codexHome(t, `{"tokens":{"access_token":"x","id_token":"x.e30.x"}}`,
+ "model = \"gpt-5.5\"\n\n[agents]\nmax_threads = 6\ndefault_subagent_model = \"gpt-5.4-mini\"\n")
+ sub := codex(home).Field("subagent_model")
+ if err := sub.Set("gpt-5.5"); err == nil {
+ t.Fatal("a bare name of Codex's own was taken")
+ }
+ if cfg := read(); !strings.Contains(cfg, "default_subagent_model") {
+ t.Fatalf("a refused pick took Codex's away:\n%s", cfg)
+ }
+ if err := sub.Set(pick); err != nil {
+ t.Fatal(err)
+ }
+ if cfg := read(); strings.Contains(cfg, "default_subagent_model") || !strings.Contains(cfg, "max_threads = 6") {
+ t.Fatalf("pick %q:\n%s", pick, cfg)
+ }
+ if got := sub.Get(); got != pick {
+ t.Fatalf("subagent model = %q, want %q", got, pick)
+ }
+ }
+}
+
// Subagents can start at an effort of their own (#469): Codex's [agents]
// default_subagent_reasoning_effort, used when a spawn names none. Codex
// refuses a spawn at a level the subagents' model lacks, so magpie takes
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 9d3553b65..15d560293 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -388,6 +388,7 @@ function renderAgentsLoading() {
let agentArranging = false, agentRenderPending = false;
function renderAgents() {
renderCodexMemories(); // the Codex sheet's row is the same field
+ renderCodexSubagentModel(); // and this one
if (agentArranging) { agentRenderPending = true; return; }
if (unhideCleared()) return; // it renders again with the hiding dropped
const page = $("#view-agents");
@@ -422,7 +423,7 @@ function renderAgents() {
// user's own)
// nor Aside's account with one account only (#1499)
const none = (f) => (f.key === "effort" || f.key === "ultracode" || f.label === "subagents" || f.label === SUB_EFFORT || f.label === SUB_MODEL || f.label === AUTO_MODE || f.label === MEMORIES || f.label === "sign-in" || f.key === "small" || asideAccount(a, f)) && !f.options.length && !f.value;
- const shownFields = a.fields.filter((f) => !grouped(a, f) && !none(f));
+ const shownFields = a.fields.filter((f) => !grouped(a, f) && !none(f) && !codexOwnSub(a, f));
const tiers = tierMenu(a);
if (tiers) shownFields.push(tiers);
const sorted = shownFields.sort((x, y) => wide(y) - wide(x) || extra(x) - extra(y));
@@ -3743,6 +3744,30 @@ const LEAD_PICKS = "Codex's lead may name another model for a subagent; set the
// its pick, not "same as model" (KorenKrita on Discord)
const CLAUDE_PICKS = "Claude Code's lead, or a subagent's own definition, may name a model or tier for it; a model set here is for the subagents that name none";
const claudePicks = (a, f) => leadPicks(a, f) && a.id === "claude";
+// Codex had two squares for its subagents' model, the subagents one above
+// and the subagent model, and nobody could tell them apart (the owner): the
+// card shows the subagent model alone, saying plainly what each choice
+// does. A pick there takes away [agents] default_subagent_model too (the
+// backend), and one left in the config is said on it until then. With no
+// model of magpie's to pick there, Codex's own square stays.
+const codexSub = (a) => a.id.split("@wsl:")[0] === "codex" && a.fields.some((f) => f.label === SUB_MODEL && (f.options.length || f.value));
+const codexOwnSub = (a, f) => f.label === "subagents" && codexSub(a);
+const SAME_AS_LEAD = "Same as the lead";
+const SUB_MODEL_UNSET = "Each subagent runs on the lead's model ({model}), or on another the lead picks for it. Pick a model here to put every subagent on it.";
+const SUB_MODEL_UNSET_PLAIN = "Each subagent runs on the lead's model, or on another the lead picks for it. Pick a model here to put every subagent on it.";
+const SUB_MODEL_SET = "Every subagent runs on this model, whatever the lead asks for.";
+const SUB_MODEL_OLD = "Codex's config still starts subagents on {model} when the lead names none; picking here replaces it.";
+// codexSubSaid: what Codex's subagent model is, in words: its value, and a
+// line on what it does
+function codexSubSaid(a, f) {
+ const opt = optionFor(f, f.value);
+ const main = a.fields.find((x) => x.key === "model");
+ const lead = main && (optionFor(main, main.value)?.label || main.value);
+ const old = a.fields.find((x) => x.label === "subagents")?.value;
+ const name = f.value ? opt?.label || f.value : t(SAME_AS_LEAD);
+ const line = f.value ? t(SUB_MODEL_SET) : (lead ? t(SUB_MODEL_UNSET, { model: lead }) : t(SUB_MODEL_UNSET_PLAIN)) + (old ? "\n" + t(SUB_MODEL_OLD, { model: optionFor(a.fields.find((x) => x.label === "subagents"), old)?.label || old }) : "");
+ return { name, line, old, lead };
+}
const extra = (f) => f.key === "tiers" || FOLLOWS_MODEL.includes(f.label) || f.label === "sign-in" || f.key === "ultracode" || f.label === SUB_EFFORT || f.label === SUB_MODEL || f.label === AUTO_MODE || f.label === MEMORIES;
const EXTRA_GLYPH = {
subagents: "M4.5 2.75v10.5M4.5 9.25c0-2.2 1.6-3.75 3.9-3.75h3.35M9.9 3.6l1.9 1.9-1.9 1.9",
@@ -3766,11 +3791,13 @@ const EXTRA_GLYPH = {
const MEMORIES_DEFAULT = "Codex's own: gpt-5.6-terra, threads summed up with gpt-5.6-luna";
function extraField(a, f) {
if (f.key === "ultracode") return ultracodeToggle(a, f);
- const set = !!(f.value || f.custom);
+ const said = f.label === SUB_MODEL && codexSub(a) ? codexSubSaid(a, f) : null;
+ const set = !!(f.value || f.custom || said?.old);
const b = el("button", "field extra" + (set ? " set" : ""));
b.append(svg(EXTRA_GLYPH[f.label] || EXTRA_GLYPH.tiers, 13, 1.5));
const opt = optionFor(f, f.value);
- b.title = f.label === SUB_EFFORT ? subEffortTitle(a, f, opt) : f.menu ? menuTitle(f)
+ b.title = said ? t("{label}: {value}", { label: t(f.label), value: said.name }) + "\n" + said.line
+ : f.label === SUB_EFFORT ? subEffortTitle(a, f, opt) : f.menu ? menuTitle(f)
: t("{label}: {value}", { label: f.label === MEMORIES ? t("Codex memories model") : t(f.label), value: t(opt?.label || f.value || (f.label === MEMORIES ? MEMORIES_DEFAULT : f.label === SUB_MODEL ? "the model the lead asks for" : f.label === AUTO_MODE ? AUTO_MODE_UNSET : leadPicks(a, f) ? "the lead's pick, else same as model" : "same as model")) }) + (opt?.note && !FOLLOWS_MODEL.includes(f.label) ? "\n" + t(opt.note) : "") + (leadPicks(a, f) ? "\n" + t(claudePicks(a, f) ? CLAUDE_PICKS : LEAD_PICKS) : "");
b.setAttribute("aria-label", b.title);
b.dataset.key = f.key;
@@ -4643,6 +4670,10 @@ function openPicker(agent, field, anchor, ev, only) {
: main && leadPicks(agent, field) ? { value: "", label: t("Lead's pick"), note: t("{model} unless the lead names another", { model: mainName }), icon: optionFor(main, main.value)?.icon, reset: true }
: main ? { value: "", label: t("Same as model"), note: mainName, icon: optionFor(main, main.value)?.icon, reset: true }
: { value: "", label: t("Not set"), note: t("a Claude model of the tier, else the chat's model"), icon: agent.icon, reset: true });
+ } else if (field.label === SUB_MODEL && codexSub(agent) && !options.some((o) => o.value === "")) {
+ const said = codexSubSaid(agent, { ...field, value: "" });
+ const main = agent.fields.find((f) => f.key === "model");
+ options.unshift({ value: "", label: t(SAME_AS_LEAD), note: said.lead ? t("{model}, or another the lead picks for a subagent", { model: said.lead }) : t("the lead's model, or another the lead picks for a subagent"), icon: (main && optionFor(main, main.value)?.icon) || agent.icon, reset: true });
} else if (!only && !field.menu && !field.onPick && !options.some((o) => o.value === "")) {
// Pi has no default model of its own: with none set it takes the first
// provider signed in, in its own order, so Default is no fixed model
@@ -20856,7 +20887,7 @@ function renderAlerts(s, keep) {
// in Settings, apart from the agents they set (the owner, 10-20); Long
// conversations is Codex's and Claude Code's both, in each one's sheet.
const AGENT_PREFS = {
- codex: ["codexAgentsV1Row", "fullContextRow", "codexAsyncRow", "codexTitlesRow", "codexDescriptionsRow", "codexPredictionsRow", "codexAutoReviewRow", "codexMemoriesRow"],
+ codex: ["codexAgentsV1Row", "codexSubagentModelRow", "fullContextRow", "codexAsyncRow", "codexTitlesRow", "codexDescriptionsRow", "codexPredictionsRow", "codexAutoReviewRow", "codexMemoriesRow"],
claude: ["fullContextRow"],
};
const agentPrefsOf = (a) => gatewayMode ? null : AGENT_PREFS[a.id.split("@wsl:")[0]];
@@ -20963,6 +20994,7 @@ function renderAgentPrefs() {
renderCodexPredictions(s);
renderCodexAutoReview(s);
renderCodexMemories();
+ renderCodexSubagentModel();
}
// renderAgentPrefLinks: Settings' search still finds the settings an agent's
@@ -20980,7 +21012,7 @@ function renderAgentPrefLinks() {
else if (loose.parentElement === box.parentElement) $("#agentPrefRows").append(loose);
for (const r of agentPrefRowEls) {
const agents = state.agents.filter((a) => agentPrefsOf(a)?.includes(r.id) && !a.id.includes("@wsl:"));
- if (!agents.length || (r.id === "codexMemoriesRow" && r.hidden)) continue;
+ if (!agents.length || ((r.id === "codexMemoriesRow" || r.id === "codexSubagentModelRow") && r.hidden)) continue;
const row = el("div", "row pref agent-pref-link");
const who = el("div", "who");
const name = r.querySelector(".name");
@@ -21135,6 +21167,31 @@ function renderCodexMemories() {
$("#codexMemoriesPick").replaceChildren(b);
}
+// renderCodexSubagentModel: Codex's subagent model in its sheet, a row with
+// a name, as the memories one is: the card's square alone is easy to miss.
+// The same field and picker, so the row and the square are one setting.
+// It says its name alone, its button the choice, Same as the lead or the
+// model; what that does is the row's title.
+function renderCodexSubagentModel() {
+ homeAgentPrefRows();
+ const row = $("#codexSubagentModelRow");
+ if (!row) return;
+ const a = state.agents.find((x) => x.id === "codex");
+ const f = a?.fields?.find((x) => x.label === SUB_MODEL);
+ row.hidden = gatewayMode || !f || (!f.options.length && !f.value);
+ if (row.hidden) return;
+ const said = codexSubSaid(a, f);
+ const main = a.fields.find((x) => x.key === "model");
+ const b = el("button", "rt-cond on");
+ b.type = "button";
+ b.setAttribute("aria-label", t("Codex subagent model"));
+ b.append(icon((f.value ? optionFor(f, f.value)?.icon : main && optionFor(main, main.value)?.icon) || "generic"), el("span", "", said.name));
+ b.onclick = (ev) => openPicker(a, f, b, ev);
+ $("#codexSubagentModelPick").replaceChildren(b);
+ b.title = said.line;
+ row.querySelector(".who").title = said.line;
+}
+
// renderImages: the model that describes images to a model that can't see
// them — the one magpie picks, one named, or none, and then such an image
// is turned away.
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index a315b18e6..a73e3f32b 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -1055,6 +1055,14 @@ const I18N = {
"Codex’s own pick": "由 Codex 决定",
"as Codex picks it": "按 Codex 默认选择",
"Codex memories model": "Codex 记忆整理模型",
+ "Same as the lead": "跟主代理一样",
+ "Each subagent runs on the lead's model ({model}), or on another the lead picks for it. Pick a model here to put every subagent on it.": "每个子代理都用主代理正在用的模型({model}),主代理也可能给某个子代理另选一个。在这里选定一个模型,所有子代理就都用它。",
+ "Each subagent runs on the lead's model, or on another the lead picks for it. Pick a model here to put every subagent on it.": "每个子代理都用主代理正在用的模型,主代理也可能给某个子代理另选一个。在这里选定一个模型,所有子代理就都用它。",
+ "Every subagent runs on this model, whatever the lead asks for.": "所有子代理都用这个模型,不管主代理要的是哪个。",
+ "Codex's config still starts subagents on {model} when the lead names none; picking here replaces it.": "Codex 配置里还写着:主代理没指定时,子代理用 {model}。在这里选一次就会替换掉它。",
+ "{model}, or another the lead picks for a subagent": "{model},或主代理给子代理另选的模型",
+ "the lead's model, or another the lead picks for a subagent": "主代理正在用的模型,或主代理给子代理另选的模型",
+ "Codex subagent model": "Codex 子代理模型",
"{agent} settings": "{agent} 设置",
"In {agent}'s settings, on the Agents page": "在 Agent 页的 {agent} 设置里",
"no title, nothing sent": "不生成标题,不发出请求",
@@ -4984,6 +4992,14 @@ const I18N = {
"Codex’s own pick": "由 Codex 決定",
"as Codex picks it": "按 Codex 預設選擇",
"Codex memories model": "Codex 記憶整理模型",
+ "Same as the lead": "跟主代理一樣",
+ "Each subagent runs on the lead's model ({model}), or on another the lead picks for it. Pick a model here to put every subagent on it.": "每個子代理都用主代理正在用的模型({model}),主代理也可能給某個子代理另選一個。在這裡選定一個模型,所有子代理就都用它。",
+ "Each subagent runs on the lead's model, or on another the lead picks for it. Pick a model here to put every subagent on it.": "每個子代理都用主代理正在用的模型,主代理也可能給某個子代理另選一個。在這裡選定一個模型,所有子代理就都用它。",
+ "Every subagent runs on this model, whatever the lead asks for.": "所有子代理都用這個模型,不管主代理要的是哪個。",
+ "Codex's config still starts subagents on {model} when the lead names none; picking here replaces it.": "Codex 設定裡還寫著:主代理沒指定時,子代理用 {model}。在這裡選一次就會取代它。",
+ "{model}, or another the lead picks for a subagent": "{model},或主代理給子代理另選的模型",
+ "the lead's model, or another the lead picks for a subagent": "主代理正在用的模型,或主代理給子代理另選的模型",
+ "Codex subagent model": "Codex 子代理模型",
"{agent} settings": "{agent} 設定",
"In {agent}'s settings, on the Agents page": "在 Agent 頁的 {agent} 設定裡",
"no title, nothing sent": "不生成標題,不發出請求",
@@ -8883,6 +8899,14 @@ const I18N = {
"Codex’s own pick": "Codex に任せる",
"as Codex picks it": "Codex の既定どおり",
"Codex memories model": "Codex メモリ整理のモデル",
+ "Same as the lead": "リードと同じ",
+ "Each subagent runs on the lead's model ({model}), or on another the lead picks for it. Pick a model here to put every subagent on it.": "各サブエージェントはリードと同じモデル({model})で動きます。リードが別のモデルを選ぶこともあります。ここでモデルを選ぶと、すべてのサブエージェントがそのモデルになります。",
+ "Each subagent runs on the lead's model, or on another the lead picks for it. Pick a model here to put every subagent on it.": "各サブエージェントはリードと同じモデルで動きます。リードが別のモデルを選ぶこともあります。ここでモデルを選ぶと、すべてのサブエージェントがそのモデルになります。",
+ "Every subagent runs on this model, whatever the lead asks for.": "リードが何を指定しても、すべてのサブエージェントがこのモデルで動きます。",
+ "Codex's config still starts subagents on {model} when the lead names none; picking here replaces it.": "Codex の設定には、リードが指定しないときのサブエージェントのモデルとして {model} が残っています。ここで選ぶとそれを置き換えます。",
+ "{model}, or another the lead picks for a subagent": "{model}、またはリードがサブエージェントに選ぶ別のモデル",
+ "the lead's model, or another the lead picks for a subagent": "リードと同じモデル、またはリードがサブエージェントに選ぶ別のモデル",
+ "Codex subagent model": "Codex サブエージェントのモデル",
"{agent} settings": "{agent} の設定",
"In {agent}'s settings, on the Agents page": "エージェントページの {agent} の設定にあります",
"no title, nothing sent": "タイトルなし、送信なし",
@@ -12812,6 +12836,14 @@ const I18N = {
"Codex’s own pick": "Wie Codex es wählt",
"as Codex picks it": "Codex’ Standard",
"Codex memories model": "Codex-Modell für Erinnerungen",
+ "Same as the lead": "Wie der Haupt-Agent",
+ "Each subagent runs on the lead's model ({model}), or on another the lead picks for it. Pick a model here to put every subagent on it.": "Jeder Subagent läuft auf dem Modell des Haupt-Agenten ({model}) oder auf einem anderen, das der Haupt-Agent für ihn wählt. Wähle hier ein Modell, damit alle Subagenten darauf laufen.",
+ "Each subagent runs on the lead's model, or on another the lead picks for it. Pick a model here to put every subagent on it.": "Jeder Subagent läuft auf dem Modell des Haupt-Agenten oder auf einem anderen, das der Haupt-Agent für ihn wählt. Wähle hier ein Modell, damit alle Subagenten darauf laufen.",
+ "Every subagent runs on this model, whatever the lead asks for.": "Alle Subagenten laufen auf diesem Modell, egal was der Haupt-Agent verlangt.",
+ "Codex's config still starts subagents on {model} when the lead names none; picking here replaces it.": "Die Codex-Konfiguration startet Subagenten noch auf {model}, wenn der Haupt-Agent keins nennt; eine Wahl hier ersetzt das.",
+ "{model}, or another the lead picks for a subagent": "{model} oder ein anderes, das der Haupt-Agent für einen Subagenten wählt",
+ "the lead's model, or another the lead picks for a subagent": "das Modell des Haupt-Agenten oder ein anderes, das er für einen Subagenten wählt",
+ "Codex subagent model": "Codex-Subagenten-Modell",
"{agent} settings": "Einstellungen von {agent}",
"In {agent}'s settings, on the Agents page": "In den Einstellungen von {agent}, auf der Seite Agenten",
"no title, nothing sent": "kein Titel, nichts gesendet",
diff --git a/internal/gui/assets/index.html b/internal/gui/assets/index.html
index 74791fe1c..0f8d11896 100644
--- a/internal/gui/assets/index.html
+++ b/internal/gui/assets/index.html
@@ -439,6 +439,10 @@
<div class="who"><div class="name" data-t>Codex subagents on any model</div><div class="sub" data-t>A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins</div><div class="sub err" id="codexAgentsV1Warn" hidden></div></div>
<div id="codexAgentsV1Segs"></div>
</div>
+ <div class="row pref" id="codexSubagentModelRow" hidden>
+ <div class="who"><div class="name" data-t>Codex subagent model</div></div>
+ <div class="val" id="codexSubagentModelPick"></div>
+ </div>
<div class="row pref" id="fullContextRow">
<div class="who"><div class="name" data-t>Long conversations</div><div class="sub" data-t>Codex and Claude Code compact at 272K (non-Claude [1m] too) or the size typed; full window: slower, costlier</div></div>
<div id="fullContextSegs"></div>
diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go
index d28e3317c..127e7967b 100644
--- a/internal/gui/core_budget_test.go
+++ b/internal/gui/core_budget_test.go
@@ -15,8 +15,8 @@ import (
// so a page can't quietly grow back into the core; a change that needs more
// raises them and says why in its commit.
const (
- appScriptBudget = 1_317_486 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24)
- coreScriptBudget = 1_524_789 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it
+ appScriptBudget = 1_321_336 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24)
+ coreScriptBudget = 1_528_525 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24)
)
func TestCoreScriptBudget(t *testing.T) {
diff --git a/internal/gui/tests/codex-subagent-model.test.cjs b/internal/gui/tests/codex-subagent-model.test.cjs
index b13ec52a5..4b344ffa3 100644
--- a/internal/gui/tests/codex-subagent-model.test.cjs
+++ b/internal/gui/tests/codex-subagent-model.test.cjs
@@ -3,8 +3,12 @@
// can't overrule it (willz on Discord), so magpie puts every Codex subagent
// on a model set in Codex's row: a square opening the app's model picker
// (no native select) with magpie's models, another provider's too (#1633),
-// Default first. A model picked is posted and lights the square; Default
-// posts "". The Routing page's story of a subagent's request says it was
+// "Same as the lead" first. It is the one square for the subagents' model:
+// Codex's own subagents square, which read the same (the owner), isn't
+// drawn, and a model left in Codex's config by it is said on this one and
+// lights it till a pick here takes it away. Each title says plainly what
+// the choice does. A model picked is posted and lights the square; Same as
+// the lead posts "". Codex's sheet has the same setting as a named row. The Routing page's story of a subagent's request says it was
// put on that model, or why it stayed on the one asked for (a task sealed
// for ChatGPT accounts, the model set another provider's). A click scrolls nothing, nothing has a coloured left
// border, and the row fits a narrow window, in every language. No backend:
@@ -28,6 +32,7 @@ const fresh = () => ({
id: "codex", name: "Codex", path: "/test/config.toml", icon: "codex-color", wired: true,
fields: [
{ key: "model", label: "model", value: "gpt-5.5", options: own },
+ { key: "subagent", label: "subagents", value: "gpt-5.4-mini", options: own },
{ key: "subagent_model", label: "subagent model", value: "", options: chatgpt },
],
},
@@ -65,7 +70,10 @@ function server(lang, sets) {
const body = req.postDataJSON();
sets.push(body);
cur = JSON.parse(JSON.stringify(cur));
- cur.agents.find((a) => a.id === body.agent).fields.find((f) => f.key === body.field).value = body.value;
+ const fields = cur.agents.find((a) => a.id === body.agent).fields;
+ fields.find((f) => f.key === body.field).value = body.value;
+ // as the backend does: a pick here takes Codex's own away
+ if (body.field === "subagent_model") fields.find((f) => f.key === "subagent").value = "";
return json({ ...cur, settings: { lang, theme: "light" } });
}
if (url.pathname === "/api/gateway/trace") {
@@ -90,23 +98,33 @@ function server(lang, sets) {
// the words as i18n.js has them
const W = {
- en: { unset: "subagent model: the model the lead asks for", def: "Default", set: "subagent model: GPT-6 Astra",
+ en: { unset: "subagent model: Same as the lead", line: "Each subagent runs on the lead's model (GPT-5.5), or on another the lead picks for it. Pick a model here to put every subagent on it.",
+ old: "Codex's config still starts subagents on gpt-5.4-mini when the lead names none; picking here replaces it.",
+ def: "Same as the lead", note: "GPT-5.5, or another the lead picks for a subagent", set: "subagent model: GPT-6 Astra", setLine: "Every subagent runs on this model, whatever the lead asks for.", row: "Codex subagent model",
moved: "Codex requested a subagent on gpt-5.5; magpie put it on codex/gpt-6-astra, the model set for its subagents.",
kept: "Codex requested a subagent on gpt-5.5 and it stayed there: its subagents are set to codex/gpt-6-astra, but no ChatGPT account on in magpie serves it.",
sealed: "Codex requested a subagent on gpt-5.5 and it stayed there: its subagents are set to token/gpt-6.1-sol, but its task was sealed by the ChatGPT backend that answered its lead, and only a ChatGPT account can open it." },
- zh: { unset: "子代理模型:主代理请求的模型", def: "默认", set: "子代理模型:GPT-6 Astra",
+ zh: { unset: "子代理模型:跟主代理一样", line: "每个子代理都用主代理正在用的模型(GPT-5.5),主代理也可能给某个子代理另选一个。在这里选定一个模型,所有子代理就都用它。",
+ old: "Codex 配置里还写着:主代理没指定时,子代理用 gpt-5.4-mini。在这里选一次就会替换掉它。",
+ def: "跟主代理一样", note: "GPT-5.5,或主代理给子代理另选的模型", set: "子代理模型:GPT-6 Astra", setLine: "所有子代理都用这个模型,不管主代理要的是哪个。", row: "Codex 子代理模型",
moved: "Codex 请求了使用 gpt-5.5 的子代理;magpie 将其改用 codex/gpt-6-astra,即为它的子代理设定的模型。",
kept: "Codex 请求了使用 gpt-5.5 的子代理,并保留在该模型上:它的子代理设为 codex/gpt-6-astra,但magpie 中启用的 ChatGPT 账号都不提供该模型。",
sealed: "Codex 请求了使用 gpt-5.5 的子代理,并保留在该模型上:它的子代理设为 token/gpt-6.1-sol,但它的任务由回答主代理的 ChatGPT 后端加密,只有 ChatGPT 账号能打开。" },
- "zh-TW": { unset: "子代理模型:主代理請求的模型", def: null, set: "子代理模型:GPT-6 Astra",
+ "zh-TW": { unset: "子代理模型:跟主代理一樣", line: "每個子代理都用主代理正在用的模型(GPT-5.5),主代理也可能給某個子代理另選一個。在這裡選定一個模型,所有子代理就都用它。",
+ old: "Codex 設定裡還寫著:主代理沒指定時,子代理用 gpt-5.4-mini。在這裡選一次就會取代它。",
+ def: "跟主代理一樣", note: "GPT-5.5,或主代理給子代理另選的模型", set: "子代理模型:GPT-6 Astra", setLine: "所有子代理都用這個模型,不管主代理要的是哪個。", row: "Codex 子代理模型",
moved: "Codex 請求了使用 gpt-5.5 的子代理;magpie 將其改用 codex/gpt-6-astra,即為它的子代理設定的模型。",
kept: "Codex 請求了使用 gpt-5.5 的子代理,並保留在該模型上:它的子代理設為 codex/gpt-6-astra,但magpie 中啟用的 ChatGPT 帳號都不提供該模型。",
sealed: "Codex 請求了使用 gpt-5.5 的子代理,並保留在該模型上:它的子代理設為 token/gpt-6.1-sol,但它的任務由回應主代理的 ChatGPT 後端加密,只有 ChatGPT 帳號能打開。" },
- ja: { unset: "サブエージェントのモデル:リードがリクエストしたモデル", def: null, set: "サブエージェントのモデル:GPT-6 Astra",
+ ja: { unset: "サブエージェントのモデル:リードと同じ", line: "各サブエージェントはリードと同じモデル(GPT-5.5)で動きます。リードが別のモデルを選ぶこともあります。ここでモデルを選ぶと、すべてのサブエージェントがそのモデルになります。",
+ old: "Codex の設定には、リードが指定しないときのサブエージェントのモデルとして gpt-5.4-mini が残っています。ここで選ぶとそれを置き換えます。",
+ def: "リードと同じ", note: "GPT-5.5、またはリードがサブエージェントに選ぶ別のモデル", set: "サブエージェントのモデル:GPT-6 Astra", setLine: "リードが何を指定しても、すべてのサブエージェントがこのモデルで動きます。", row: "Codex サブエージェントのモデル",
moved: "Codex が gpt-5.5 のサブエージェントをリクエストしました。magpie はサブエージェント用に設定された codex/gpt-6-astra に切り替えました。",
kept: "Codex が gpt-5.5 のサブエージェントをリクエストし、そのモデルのままになりました。サブエージェントは codex/gpt-6-astra に設定されていますが、magpie で有効な ChatGPT アカウントはどれもこのモデルを提供していません。",
sealed: "Codex が gpt-5.5 のサブエージェントをリクエストし、そのモデルのままになりました。サブエージェントは token/gpt-6.1-sol に設定されていますが、そのタスクはリードに応答した ChatGPT バックエンドが暗号化しており、開けるのは ChatGPT アカウントだけです。" },
- de: { unset: "Modell der Subagenten: das Modell, das der Haupt-Agent anfordert", def: null, set: "Modell der Subagenten: GPT-6 Astra",
+ de: { unset: "Modell der Subagenten: Wie der Haupt-Agent", line: "Jeder Subagent läuft auf dem Modell des Haupt-Agenten (GPT-5.5) oder auf einem anderen, das der Haupt-Agent für ihn wählt. Wähle hier ein Modell, damit alle Subagenten darauf laufen.",
+ old: "Die Codex-Konfiguration startet Subagenten noch auf gpt-5.4-mini, wenn der Haupt-Agent keins nennt; eine Wahl hier ersetzt das.",
+ def: "Wie der Haupt-Agent", note: "GPT-5.5 oder ein anderes, das der Haupt-Agent für einen Subagenten wählt", set: "Modell der Subagenten: GPT-6 Astra", setLine: "Alle Subagenten laufen auf diesem Modell, egal was der Haupt-Agent verlangt.", row: "Codex-Subagenten-Modell",
moved: "Codex hat einen Subagent mit gpt-5.5 angefordert; magpie hat ihn auf codex/gpt-6-astra gesetzt, das für seine Subagenten festgelegte Modell.",
kept: "Codex hat einen Subagent mit gpt-5.5 angefordert, und er blieb dort: Seine Subagenten sind auf codex/gpt-6-astra gesetzt, aber kein eingeschaltetes ChatGPT-Konto in magpie bietet es an.",
sealed: "Codex hat einen Subagent mit gpt-5.5 angefordert, und er blieb dort: Seine Subagenten sind auf token/gpt-6.1-sol gesetzt, aber seine Aufgabe wurde vom ChatGPT-Backend versiegelt, das seinen Lead beantwortet hat, und nur ein ChatGPT-Konto kann sie öffnen." },
@@ -143,8 +161,10 @@ for (const engine of engines) {
const square = page.locator(`${codex} .extras-cell .field.extra[data-key="subagent_model"]`);
assert.equal(await square.count(), 1);
assert.equal(await page.locator(`${codex} .field:not(.extra)[data-key="subagent_model"]`).count(), 0, "a picker of its own");
- assert.equal(await square.getAttribute("aria-label"), w.unset);
- assert.equal(await square.evaluate((e) => e.classList.contains("set")), false);
+ assert.equal(await page.locator(`${codex} .field[data-key="subagent"]`).count(), 0, "Codex's own subagents square beside it");
+ // the model Codex's config has for its subagents, said and lit till replaced
+ assert.equal(await square.getAttribute("aria-label"), w.unset + "\n" + w.line + "\n" + w.old);
+ assert.equal(await square.evaluate((e) => e.classList.contains("set")), true);
// the row fits: no page scrolls sideways, the square in the window
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "the page scrolls sideways");
const box = await square.boundingBox();
@@ -157,7 +177,7 @@ for (const engine of engines) {
assert.equal(await page.locator("#pop").evaluate((e) => e.classList.contains("model-picker")), true);
assert.equal(await page.locator("select").count(), 0, "a native select");
const items = await page.locator("#pop #list li").allInnerTexts();
- if (w.def) assert(items[0].includes(w.def), items[0]);
+ assert(items[0].includes(w.def) && items[0].includes(w.note), items[0]);
assert(items.some((s) => s.includes("GPT-6 Astra")), items.join(" | "));
assert(!items.some((s) => s.includes("openai/")), "Codex's own models, which magpie can't put a request on");
// #1633: another provider's model is offered too
@@ -173,14 +193,23 @@ for (const engine of engines) {
await page.locator("#pop #list li", { hasText: "GPT-6 Astra" }).first().click();
await page.waitForFunction(() => document.querySelector('.row.agent[data-id="codex"] .field.extra.set[data-key="subagent_model"]'));
assert.deepEqual(sets, [{ agent: "codex", field: "subagent_model", value: "codex/gpt-6-astra" }]);
- assert.equal(await square.getAttribute("aria-label"), w.set + "\[email protected] · via magpie");
+ assert.equal(await square.getAttribute("aria-label"), w.set + "\n" + w.setLine);
+ // Codex's sheet has it as a row with a name, the same setting
+ const pick = page.locator("#codexSubagentModelRow button");
+ await pick.waitFor();
+ assert.equal((await page.locator("#codexSubagentModelRow .name").textContent()).trim(), w.row);
+ assert.equal((await pick.textContent()).trim(), "GPT-6 Astra");
+ assert.equal(await page.locator("#codexSubagentModelRow .who").getAttribute("title"), w.setLine);
- // Default: every subagent on the model asked for again
+ // Same as the lead: every subagent on the model asked for again, and
+ // Codex's config no longer has one
await square.click();
await page.locator("#pop:not([hidden]) #list li").first().waitFor();
await page.locator("#pop #list li").first().click();
await page.waitForFunction(() => !document.querySelector('.row.agent[data-id="codex"] .field.extra.set[data-key="subagent_model"]'));
assert.deepEqual(sets.at(-1), { agent: "codex", field: "subagent_model", value: "" });
+ assert.equal(await square.getAttribute("aria-label"), w.unset + "\n" + w.line);
+ assert.equal((await pick.textContent()).trim(), w.def);
assert.equal(await page.evaluate(() => scrollY), y);
// the Routing page's story: put on the model set, or why not