From e8fd3489df49e10acddb6c12a6d3c1abe2c4030d Mon Sep 17 00:00:00 2001 From: Verso Labs Date: Fri, 4 Sep 2026 15:55:40 -0300 Subject: [PATCH] fix: ignore recommended plugin context in thread titles --- plugins/codex/scripts/lib/codex.mjs | 6 +++++- tests/runtime.test.mjs | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/codex/scripts/lib/codex.mjs b/plugins/codex/scripts/lib/codex.mjs index fead00cc4..ea8b9aeff 100644 --- a/plugins/codex/scripts/lib/codex.mjs +++ b/plugins/codex/scripts/lib/codex.mjs @@ -105,7 +105,11 @@ function looksLikeVerificationCommand(command) { } function buildTaskThreadName(prompt) { - const excerpt = shorten(prompt, 56); + const titleSource = String(prompt ?? "").replace( + /^\s*[\s\S]*?<\/recommended_plugins>\s*/i, + "" + ); + const excerpt = shorten(titleSource, 56); return excerpt ? `${TASK_THREAD_PREFIX}: ${excerpt}` : TASK_THREAD_PREFIX; } diff --git a/tests/runtime.test.mjs b/tests/runtime.test.mjs index 8f276835b..b579a8c66 100644 --- a/tests/runtime.test.mjs +++ b/tests/runtime.test.mjs @@ -157,6 +157,20 @@ test("review renders a no-findings result from app-server review/start", () => { assert.match(result.stdout, /No material issues found/); }); +test("task thread names ignore leading recommended_plugins context", () => { + const repo = makeTempDir(); + const binDir = makeTempDir(); + const statePath = path.join(binDir, "fake-codex-state.json"); + installFakeCodex(binDir); + initGitRepo(repo); + const promptPath = path.join(repo, "prompt.txt"); + fs.writeFileSync(promptPath, `\nHere is a list of plugins.\n\nFix the flaky login test`, "utf8"); + const result = run("node", [SCRIPT, "task", "--prompt-file", promptPath], { cwd: repo, env: buildEnv(binDir) }); + assert.equal(result.status, 0, result.stderr); + const fakeState = JSON.parse(fs.readFileSync(statePath, "utf8")); + assert.equal(fakeState.threads[0].name, "Codex Companion Task: Fix the flaky login test"); +}); + test("task runs when the active provider does not require OpenAI login", () => { const repo = makeTempDir(); const binDir = makeTempDir();