Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
codex: thread descriptions can be turned off, as titles can (cybercaius)
yetone83368d99463d
diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.mdindex 4f499b951..8b854452b 100644--- a/docs/subsystems/gateway-routing.md+++ b/docs/subsystems/gateway-routing.md@@ -51,7 +51,13 @@ settings `CodexTitles` and `CodexDescriptions` select their models separately;an empty setting preserves the requested model. On a Magpie model, bothpaths wrap plain model text in the object Codex requested. Titles use`{"title": ...}`; descriptions use `{"description": ...}` with nonempty text-and no invented maximum length. Title Off mode does not disable descriptions.+and no invented maximum length. Each has its own Off (`off`): magpie answers+the request itself with a finished reply holding no message, sends nothing+upstream and records it as answered here (`sentNowhere`); the Codex app reads+that as no title or no description (its side-turn helper's "empty" result,+not an error) and keeps the thread's as it was. Title Off does not turn+descriptions off, nor the other way round (cybercaius on Discord asked for+the description's).The Codex app asks for titles, descriptions and one-line thread summaries(`thread_summary`, after each message) on a model of its own (`gpt-6-luna`),diff --git a/internal/gateway/codex_titles.go b/internal/gateway/codex_titles.goindex f97347645..4b8b0f8f2 100644--- a/internal/gateway/codex_titles.go+++ b/internal/gateway/codex_titles.go@@ -66,8 +66,8 @@ func codexSideTo(body []byte, ours bool, session func() string) string {}// codexDescriptionsTo is where a request Codex makes for a thread's-// description goes. "" leaves the request as Codex sent it; a model's id-// writes it. A description is not a title: Codex asks for {"description"}+// description goes. "" leaves the request as Codex sent it; "off" answers+// it with no description, sent nowhere; a model's id writes it. A description is not a title: Codex asks for {"description"}// alone, which the title wrapper cannot answer.func codexDescriptionsTo(h http.Header, body []byte, ours bool, session func() string) string {if !isDescriptionKind(requestCallKind(h, requestSessionMetadata(h, body))) {@@ -193,11 +193,19 @@ func (s *Server) codexTitle(w http.ResponseWriter, r *http.Request, body []byte,writeTitleReply(w, id, out, res.Usage)}-// codexDescription answers a thread_description request with the model-// CodexDescriptions names. The model's text comes back as the+// codexDescription answers a thread_description request as+// codexDescriptionsTo says: "off" here, with no description, as titles'+// Off; a model's id by that model. The model's text comes back as the// {"description": ...} its schema asks for; a reply without one fails as a// description, not as a title.func (s *Server) codexDescription(w http.ResponseWriter, r *http.Request, body []byte, to string) {+ if to == "off" {+ // a finished reply with no message: the app's thread_description+ // helper reads no {"description"} in it as none (an "empty" result,+ // not an error) and leaves the thread's description as it was+ s.sentNowhere(w, r, body, "Descriptions off", "Codex descriptions are off in Codex's settings on magpie's Agents page: answered with no description, sent nowhere", nil)+ return+ }s.codexShaped(w, r, body, to, "description", true, descriptionJSON, noDescription)}diff --git a/internal/gateway/codex_titles_test.go b/internal/gateway/codex_titles_test.goindex 49ef1b4dd..d8789130d 100644--- a/internal/gateway/codex_titles_test.go+++ b/internal/gateway/codex_titles_test.go@@ -347,11 +347,33 @@ func TestCodexDescriptionsSetting(t *testing.T) {if sent.Model != "m1" {t.Errorf("the magpie model was asked for %q", sent.Model)}++ // off (cybercaius on Discord): nothing goes out, on the ChatGPT+ // backend's path or magpie's own /v1, and Codex gets a finished reply+ // with no description in it, which it reads as none, as titles' Off+ save("off")+ rec = codexDescriptionRequest(t, s)+ if text, n := outputText(t, rec.Body.String()); rec.Code != 200 || n != 0 || text != "" || chatgptCalls != 1 || f.calls != 1 ||+ !strings.Contains(rec.Body.String(), `"type":"response.completed"`) {+ t.Fatalf("off: %d %q, %d items, chatgpt %d, magpie model %d", rec.Code, rec.Body.String(), n, chatgptCalls, f.calls)+ }+ rec = httptest.NewRecorder()+ req := httptest.NewRequest("POST", "/v1/responses", strings.NewReader(`{"model":"fake/m1","stream":true,"input":"Describe the thread",`++ `"text":{"format":{"type":"json_schema","schema":{"type":"object","properties":{"description":{"type":"string","minLength":1}},"required":["description"]}}}}`))+ req.Header.Set("x-codex-turn-metadata", `{"thread_source":"thread_description"}`)+ s.Handler().ServeHTTP(rec, req)+ if text, n := outputText(t, rec.Body.String()); rec.Code != 200 || n != 0 || text != "" || chatgptCalls != 1 || f.calls != 1 {+ t.Fatalf("off on /v1: %d %q, %d items, chatgpt %d, magpie model %d", rec.Code, rec.Body.String(), n, chatgptCalls, f.calls)+ }+var kinds []stringfor _, u := range usage.Load(time.Time{}) {kinds = append(kinds, u.Provider+":"+u.Kind)+ if u.Provider == "magpie" && (!u.IsRejected() || u.Status != 200 || !strings.Contains(u.Error, "descriptions are off in Codex's settings on magpie's Agents page")) {+ t.Errorf("an answered-here description %+v", u)+ }}- want := "openai:thread_description fake:thread_description"+ want := "openai:thread_description fake:thread_description magpie:thread_description magpie:thread_description"if got := strings.Join(kinds, " "); got != want {t.Errorf("ledger %s\nwant %s", got, want)}diff --git a/internal/gui/api.go b/internal/gui/api.goindex d1c826e68..fa427ddb1 100644--- a/internal/gui/api.go+++ b/internal/gui/api.go@@ -1623,7 +1623,8 @@ func Handler(w Windows, gw *gateway.Server) http.Handler {writeJSON(rw, settingsState())})// where Codex's request for a thread's description goes: "" as Codex- // sends it, or a model's id. It is separate from the title setting.+ // sends it, "off", or a model's id. It is separate from the title+ // setting.mux.HandleFunc("POST /api/settings/codex-descriptions", func(rw http.ResponseWriter, r *http.Request) {var in struct{ Model string }if err := json.NewDecoder(r.Body).Decode(&in); err != nil {@@ -1631,7 +1632,7 @@ func Handler(w Windows, gw *gateway.Server) http.Handler {return}v := strings.TrimSpace(in.Model)- if v != "" {+ if v != "" && v != "off" {if _, _, ok := provider.Resolve(v); !ok {fail(rw, fmt.Errorf("no model %s to write Codex's descriptions", v))returndiff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.jsindex a0a8aca05..83db6c7c3 100644--- a/internal/gui/assets/app.js+++ b/internal/gui/assets/app.js@@ -20954,7 +20954,8 @@ function modelOpt(x) {}// renderCodexDescriptions picks the model for descriptions independently-// of titles; an empty setting preserves Codex's requested model.+// of titles; an empty setting preserves Codex's requested model, off+// answers with no description.function renderCodexDescriptions(s) {const models = s.titleModels || [];const named = (id) => {@@ -20965,10 +20966,12 @@ function renderCodexDescriptions(s) {const b = el("button", "rt-cond on");b.type = "button";b.setAttribute("aria-label", t("Codex thread descriptions"));- if (v) b.append(icon(models.find((x) => x.id === v)?.icon || "generic"), el("span", "", named(v)));+ if (v === "off") b.append(el("span", "", t("Off")));+ else if (v) b.append(icon(models.find((x) => x.id === v)?.icon || "generic"), el("span", "", named(v)));else b.append(icon("generic"), el("span", "", t(SAME_SESSION)));b.onclick = (ev) => openPicker({ id: "", name: "", fields: [] }, { key: "codexDescriptions", label: "model", value: v, options: [{ value: "", label: t(SAME_SESSION), note: t("as Codex sends them when the session is on Codex’s own model"), icon: "generic", reset: true },+ { value: "off", label: t("Off"), note: t("no description, nothing sent"), reset: true },...models.map(modelOpt)],onPick: (id) => {if (id === v) return;diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.jsindex e350f6ea7..d0092e45a 100644--- a/internal/gui/assets/i18n.js+++ b/internal/gui/assets/i18n.js@@ -1074,6 +1074,7 @@ const I18N = {"{agent} settings": "{agent} 设置","In {agent}'s settings, on the Agents page": "在 Agent 页的 {agent} 设置里","no title, nothing sent": "不生成标题,不发出请求",+ "no description, nothing sent": "不生成描述,不发出请求","A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "GPT 主代理可在 magpie 的其他模型上开子代理。仅对新会话生效;Codex 自身的 multi_agent_v2 优先","Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "Codex 自身的 multi_agent_v2 在 magpie 接管的配置里开着,会盖过 magpie 模型所需的 multi-agent V1;请在 Codex 的配置里把它关掉,才能让子代理跑在 magpie 的模型上。","Codex's multi-agent V1 is on, but magpie couldn't read Codex's config to check its own multi_agent_v2.": "Codex 的 multi-agent V1 已开启,但 magpie 读不到 Codex 的配置,无法确认它自己的 multi_agent_v2。",@@ -5083,6 +5084,7 @@ const I18N = {"{agent} settings": "{agent} 設定","In {agent}'s settings, on the Agents page": "在 Agent 頁的 {agent} 設定裡","no title, nothing sent": "不生成標題,不發出請求",+ "no description, nothing sent": "不生成描述,不發出請求","A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "GPT 主代理可在 magpie 的其他模型上開子代理。僅對新會話生效;Codex 自身的 multi_agent_v2 優先","Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "Codex 自身的 multi_agent_v2 在 magpie 接管的設定裡開著,會蓋過 magpie 模型所需的 multi-agent V1;請在 Codex 的設定裡把它關掉,才能讓子代理跑在 magpie 的模型上。","Codex's multi-agent V1 is on, but magpie couldn't read Codex's config to check its own multi_agent_v2.": "Codex 的 multi-agent V1 已開啟,但 magpie 讀不到 Codex 的設定,無法確認它自己的 multi_agent_v2。",@@ -9062,6 +9064,7 @@ const I18N = {"{agent} settings": "{agent} の設定","In {agent}'s settings, on the Agents page": "エージェントページの {agent} の設定にあります","no title, nothing sent": "タイトルなし、送信なし",+ "no description, nothing sent": "説明なし、送信なし","A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "GPT のリードが magpie の他のモデルでサブエージェントを起動します。新しいスレッドのみ。Codex 自身の multi_agent_v2 が優先されます","Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "magpie が中継する設定で Codex 自身の multi_agent_v2 がオンになっており、magpie のモデルが必要とする multi-agent V1 を上書きします。magpie のモデルでサブエージェントを動かすには、Codex の設定でオフにしてください。","Codex's multi-agent V1 is on, but magpie couldn't read Codex's config to check its own multi_agent_v2.": "Codex の multi-agent V1 はオンですが、magpie は Codex の設定を読めなかったため、それ自身の multi_agent_v2 を確認できません。",@@ -13071,6 +13074,7 @@ const I18N = {"{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",+ "no description, nothing sent": "keine Beschreibung, nichts gesendet","A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "Ein leitendes GPT startet Subagenten auf anderen magpie-Modellen. Nur neue Threads; Codex’ eigenes multi_agent_v2 hat Vorrang","Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "Codex' eigenes multi_agent_v2 ist in der von magpie gerouteten Konfiguration an und überstimmt so das multi-agent V1, das magpie-Modelle brauchen; schalte es in Codex' Konfiguration aus, damit Subagenten auf magpie-Modellen laufen.","Codex's multi-agent V1 is on, but magpie couldn't read Codex's config to check its own multi_agent_v2.": "Codex' multi-agent V1 ist an, aber magpie konnte Codex' Konfiguration nicht lesen, um dessen eigenes multi_agent_v2 zu prüfen.",diff --git a/internal/gui/codex_titles_test.go b/internal/gui/codex_titles_test.goindex 349ff1c6a..2d169bbea 100644--- a/internal/gui/codex_titles_test.go+++ b/internal/gui/codex_titles_test.go@@ -98,6 +98,13 @@ func TestCodexDescriptionsSetting(t *testing.T) {if code, _ := call("/api/settings/codex-descriptions", `{"model":"nope/x"}`); code < 400 || settings.Load().CodexDescriptions != "fake/m1" {t.Errorf("unknown model: %d %q", code, settings.Load().CodexDescriptions)}+ // off, as titles' (cybercaius on Discord), kept by another save+ if code, out := call("/api/settings/codex-descriptions", `{"model":"off"}`); code != 200 || out["codexDescriptions"] != "off" || settings.Load().CodexDescriptions != "off" {+ t.Errorf("off: %d %v %q", code, out["codexDescriptions"], settings.Load().CodexDescriptions)+ }+ if code, _ := call("/api/settings", `{"theme":"light"}`); code != 200 || settings.Load().CodexDescriptions != "off" {+ t.Errorf("another save (%d) lost off: %q", code, settings.Load().CodexDescriptions)+ }if code, _ := call("/api/settings/codex-descriptions", `{"model":""}`); code != 200 || settings.Load().CodexDescriptions != "" {t.Errorf("Codex's own: %d %q", code, settings.Load().CodexDescriptions)}diff --git a/internal/gui/tests/codex-descriptions.test.cjs b/internal/gui/tests/codex-descriptions.test.cjsindex b97abf307..df6017600 100644--- a/internal/gui/tests/codex-descriptions.test.cjs+++ b/internal/gui/tests/codex-descriptions.test.cjs@@ -2,7 +2,7 @@// Codex's "Codex thread descriptions" (#1198, congee949): Codex's// thread_description requests go where this says, apart from the titles'// setting. By default the session's model (cybercaius); the app's menu (no native-// select) offers magpie's models; a pick posts settings/codex-descriptions+// select) offers Off, as the titles' (cybercaius again), and magpie's models; a pick posts settings/codex-descriptions// on its own, the titles' setting untouched, its button shows the choice// under a name with no line of its own (as the titles' row, 1ooogle on X),// and no click scrolls the Agents page, where Codex's row holds it.@@ -69,8 +69,8 @@ function server(lang, posted) {}const want = {- en: { name: "Codex thread descriptions", own: "Same as the session" },- zh: { name: "Codex 会话描述", own: "跟随当前会话" },+ en: { name: "Codex thread descriptions", own: "Same as the session", off: "Off", offNote: "no description, nothing sent" },+ zh: { name: "Codex 会话描述", own: "跟随当前会话", off: "关闭", offNote: "不生成描述,不发出请求" },};const view = (page) => page.locator("#view-agents").evaluate((v) => v.scrollTop);@@ -110,11 +110,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",const before = await view(page);assert(before > 0, "the agents list must scroll to the row");- // the app's menu: the session's and magpie's models+ // the app's menu: the session's, Off and magpie's modelsawait pick.click();await page.locator("#pop:not([hidden]) #list li").first().waitFor();const items = (await page.locator("#list li:not(.group)").allTextContents()).join("|");- for (const s of [want[lang].own, "DeepSeek V4 Flash", "cheap"]) assert(items.includes(s), `${s} in ${items}`);+ for (const s of [want[lang].own, want[lang].off, want[lang].offNote, "DeepSeek V4 Flash", "cheap"]) assert(items.includes(s), `${s} in ${items}`);await page.keyboard.press("Escape");await page.locator("#pop:not([hidden])").waitFor({ state: "hidden" });@@ -129,6 +129,17 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.equal(await view(page), before, "picking a model scrolled the page");assert.equal(await row.locator(".sub").count(), 0);+ // Off, as the titles' has (cybercaius on Discord): the titles' stays+ await pick.click();+ await page.locator("#pop:not([hidden]) #list li").first().waitFor();+ await page.locator("#list li:not(.group)").filter({ hasText: want[lang].offNote }).first().click();+ await page.locator("#codexDescriptionsPick button", { hasText: want[lang].off }).waitFor();+ assert.equal((await pick.textContent()).trim(), want[lang].off);+ assert.deepEqual(posted.at(-1), ["codex-descriptions", { model: "off" }]);+ assert.equal((await page.locator("#codexTitlesPick button").textContent()).trim(), want[lang].own, "the titles' setting is its own");+ await page.waitForTimeout(300);+ assert.equal(await view(page), before, "picking Off scrolled the page");+// and back to the session'sawait pick.click();await page.locator("#pop:not([hidden]) #list li").first().waitFor();diff --git a/internal/settings/settings.go b/internal/settings/settings.goindex f62e6f7d4..80d9be241 100644--- a/internal/settings/settings.go+++ b/internal/settings/settings.go@@ -514,7 +514,8 @@ type Settings struct {CodexTitles string `json:"codexTitles,omitempty"`// CodexDescriptions is where the request Codex makes for a thread's// description (thread_description: its own hidden turn, on Codex's own- // model through its ChatGPT sign-in) goes: "" as Codex sends it, or a+ // model through its ChatGPT sign-in) goes: "" as Codex sends it, "off"+ // answered by magpie with no description and sent nowhere, or a// model's id (provider/model, group/<id>) that writes it. It is not// CodexTitles: a description asks for {"description"} alone.CodexDescriptions string `json:"codexDescriptions,omitempty"`@@ -1587,8 +1588,8 @@ func save(s Settings, recording bool) error {return fmt.Errorf("the model for Codex's titles must be a model's id such as openai/gpt-5-mini, or off, not %q", s.CodexTitles)}s.CodexDescriptions = strings.TrimSpace(s.CodexDescriptions)- if s.CodexDescriptions != "" && !strings.Contains(s.CodexDescriptions, "/") {- return fmt.Errorf("the model for Codex's descriptions must be a model's id such as openai/gpt-5-mini, not %q", s.CodexDescriptions)+ if s.CodexDescriptions != "" && s.CodexDescriptions != "off" && !strings.Contains(s.CodexDescriptions, "/") {+ return fmt.Errorf("the model for Codex's descriptions must be a model's id such as openai/gpt-5-mini, or off, not %q", s.CodexDescriptions)}s.CodexPredictions = strings.TrimSpace(s.CodexPredictions)if s.CodexPredictions != "" && s.CodexPredictions != "off" && !strings.Contains(s.CodexPredictions, "/") {