From cbd697693aae68d3fd0f8e8d466b7d0cb756d524 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 2 Oct 2026 03:17:50 +0800 Subject: [PATCH] =?UTF-8?q?agents:=20Claude=20Code's=20subagents=20get=20n?= =?UTF-8?q?o=20square=20while=20there=20is=20no=20model=20to=20pick=20(#46?= =?UTF-8?q?8)=20=E2=80=94=20before=20Claude=20Code=20runs=20through=20magp?= =?UTF-8?q?ie=20its=20subagents=20field=20offers=20nothing,=20yet=20the=20?= =?UTF-8?q?agents=20page=20drew=20a=20square=20that=20could=20set=20nothin?= =?UTF-8?q?g;=20it=20is=20left=20out,=20as=20an=20effort=20with=20no=20lev?= =?UTF-8?q?els=20is.=20subagent-effort.test.cjs=20fails=20without=20the=20?= =?UTF-8?q?change.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/app.js | 5 +++-- internal/gui/tests/README.md | 2 ++ internal/gui/tests/subagent-effort.test.cjs | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 477662d28..be982e79c 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -244,8 +244,9 @@ function renderAgents() { const fields = el("div", "fields"); const wide = (f) => f.label === "model" || f.label === "large"; // an effort or ultracode the model has none of (Claude Code on Haiku - // 4.5, ultracode short of xhigh) isn't drawn at all - const none = (f) => (f.key === "effort" || f.key === "ultracode") && !f.options.length && !f.value; + // 4.5, ultracode short of xhigh) isn't drawn at all, nor are subagents + // with no model to go on (Claude Code's, until it runs through magpie) + const none = (f) => (f.key === "effort" || f.key === "ultracode" || f.label === "subagents") && !f.options.length && !f.value; const shownFields = a.fields.filter((f) => !TIERS.includes(f.label) && !none(f)); const tiers = tierMenu(a); if (tiers) shownFields.push(tiers); diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md index 5ffd9e24f..610ad3403 100644 --- a/internal/gui/tests/README.md +++ b/internal/gui/tests/README.md @@ -189,6 +189,8 @@ third picker; unset, its label says what that means (the session's effort, or the subagent model's own default; 「跟随当前会话的推理强度…」), a click opens the effort slider without scrolling the page, Default its first stop, and a level picked is posted for `subagent_effort` alone and lights the square. +Claude Code's subagents (#468) get no square until it runs through magpie +(nothing to pick), and one that says "same as model" once it does. `gateway-fold.test.cjs` folds Connect on the Gateway page with the view scrolled: its fields hide, the head keeps the base URL and a copy button, the diff --git a/internal/gui/tests/subagent-effort.test.cjs b/internal/gui/tests/subagent-effort.test.cjs index 4f2352f18..2a96b8a66 100644 --- a/internal/gui/tests/subagent-effort.test.cjs +++ b/internal/gui/tests/subagent-effort.test.cjs @@ -4,7 +4,8 @@ // one, not a third picker: unset it says what that means (the session's // effort, or the subagent model's own default), it opens the effort slider // with Default as its first stop, and a level picked is posted and lights -// the square. In English and Chinese. No backend: the API is faked here. +// the square. Claude Code's subagents (#468) have no square +// while there is no model to pick. In English and Chinese. No backend: the API is faked here. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -23,7 +24,13 @@ const fresh = () => ({ { key: "subagent", label: "subagents", value: "", options: models }, { key: "subagent_effort", label: "subagent effort", value: "", options: levels }, ], - }], + }, + // Claude Code's subagents (#468): a model of magpie's, offered once it runs + // through magpie; before, there is nothing to pick and no square + ...[["cc-own", "opus", []], ["cc-magpie", "magpie/deepseek/pro", [{ value: "magpie/deepseek/flash", label: "DeepSeek Flash" }]]].map(([id, model, options]) => ({ + id, name: "Claude Code", path: "/test/settings.json", icon: "claudecode-color", + fields: [{ key: "model", label: "model", value: model, options: [{ value: model }] }, { key: "subagent", label: "subagents", value: "", options }], + }))], profiles: [], }); @@ -57,11 +64,11 @@ function server(lang, sets) { const W = { en: { unset: "subagent effort: default\nthe session's effort, or the subagent model's own default", - title: "subagent effort", def: "default", high: "high", set: "subagent effort: high", + title: "subagent effort", def: "default", high: "high", set: "subagent effort: high", follows: "subagents: same as model", }, zh: { unset: "子 agent 推理强度:默认\n跟随当前会话的推理强度;子 agent 指定了模型时,用该模型的默认强度", - title: "子 agent 推理强度", def: "默认", high: "高", set: "子 agent 推理强度:高", + title: "子 agent 推理强度", def: "默认", high: "高", set: "子 agent 推理强度:高", follows: "子 agent:同主模型", }, }; @@ -94,6 +101,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.deepEqual(await page.locator(`${codex} .field:not(.extra)`).evaluateAll((es) => es.map((e) => e.dataset.key)), ["model", "effort"]); 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('.row.agent[data-id="cc-own"] .field.extra[data-key="subagent"]').count(), 0, "a subagents square with nothing to pick"); + assert.equal(await page.locator('.row.agent[data-id="cc-magpie"] .field.extra[data-key="subagent"]').getAttribute("aria-label"), w.follows); // the effort slider, Default its first stop and the square's value on it const y = await page.evaluate(() => scrollY);