codex: thread descriptions can be turned off, as titles can (cybercaius)

cybercaius on Discord asked to turn Codex's thread descriptions off.
Titles and predictions had an Off; descriptions only had "as Codex
sends it" or a model.

Codex's settings on the Agents page now offer Off for "Thread
descriptions", worded as the titles' Off ("Off", "no description,
nothing sent", in zh, zh-TW, ja and de too). settings.CodexDescriptions
takes "off", /api/settings/codex-descriptions accepts it, and the
gateway answers a thread_description side turn itself through
sentNowhere, as titles' Off does: a finished response.completed with no
output, nothing sent upstream, and Routing/Usage recording it as
answered by magpie with the reason. Both routes take it (the Codex
backend path and /v1/responses).

Why an empty reply is enough: in ChatGPT.app's app.asar the
thread_description helper reads the reply's {"description"}; with no
message it records an "empty" result, not an error, and the thread's
description is left as it was.

The docs (gateway-routing.md) say each of titles and descriptions has
its own Off and neither turns off the other. No CLI change: titles' Off
isn't settable from the CLI either. docs/reference.md doesn't list
these settings.

Run:
- gofmt -l: nothing. go vet: darwin ./..., GOOS=linux -tags nogui
  ./..., GOOS=windows ./...: ok.
- go test -timeout 45m ./internal/gateway ./internal/gui
  ./internal/settings before the rebase: gui ok, settings ok; gateway
  had TestDisabledCodexModels ("no space left on device") and
  TestHistoryKeepsDaysAndDropsOld red during a moment the disk was
  full; both pass -count=5.
- Rebased on f0ffee34c: TestCodexDescriptions/Titles/Predictions in
  gateway, gui and settings ok; go vet of the three packages ok.
- Whole GUI suite (916 files, both engines, every language,
  --test-concurrency=4, box at load 100 to 200 from other sessions):
  13328 tests, 13144 pass, 184 fail. The 33 red files were run again
  on main 508911e43: the same tests red there (quota-refresh-order
  #3679, routing-* #3408 #3409 #3410 #3411 #3412 #3799 #1612 #2658,
  gateway-caller-keys #3797, menu-input-scroll #3402, key-replace
  #3476, phone-web #3180, old-webkit #3403, header-centre #3479,
  quota-count-wrap #3404, icon-tile #3858 new, provider-detect-draft
  #3859 new, ...). The rest, run again at the rebased head: green
  except s3-sync (#3413), search-first (#3795), usage-agents-hide
  (#3414), usage-fold (#3415), usage-ledger, all red the same on
  f0ffee34c, and library-row-remove 1 of 3 (#3099). codex-descriptions,
  codex-titles, codex-predictions and i18n-keys green at the rebased
  head.

Broken by hand:
- the gateway's off branch removed: gateway TestCodexDescriptionsSetting
  red (magpie knows no model "off", no response.completed);
- the API's "off" check removed: gui TestCodexDescriptionsSetting red
  (400);
- settings validation without "off": gui and gateway tests red (400 /
  "must be a model's id ... not \"off\"");
- the picker's Off option removed: codex-descriptions.test.cjs red in
  chromium and webkit, en and zh.

Not tried: a real Codex app session with descriptions Off; the app's
side is read from its minified code only.
This commit is contained in:
yetone
2026-10-27 15:30:31 +08:00
parent 8e2ba36de9
commit 83368d9946
9 changed files with 81 additions and 18 deletions
+7 -1
View File
@@ -51,7 +51,13 @@ settings `CodexTitles` and `CodexDescriptions` select their models separately;
an empty setting preserves the requested model. On a Magpie model, both
paths 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`),
+12 -4
View File
@@ -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)
}
+23 -1
View File
@@ -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 []string
for _, 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)
}
+3 -2
View File
@@ -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))
return
+5 -2
View File
@@ -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;
+4
View File
@@ -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.",
+7
View File
@@ -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)
}
+16 -5
View File
@@ -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 models
await 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's
await pick.click();
await page.locator("#pop:not([hidden]) #list li").first().waitFor();
+4 -3
View File
@@ -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, "/") {