Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion plugins/codex/scripts/lib/codex.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ function looksLikeVerificationCommand(command) {
}

function buildTaskThreadName(prompt) {
const excerpt = shorten(prompt, 56);
const titleSource = String(prompt ?? "").replace(
/^\s*<recommended_plugins>[\s\S]*?<\/recommended_plugins>\s*/i,
""
);
const excerpt = shorten(titleSource, 56);
return excerpt ? `${TASK_THREAD_PREFIX}: ${excerpt}` : TASK_THREAD_PREFIX;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/runtime.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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, `<recommended_plugins>\nHere is a list of plugins.\n</recommended_plugins>\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();
Expand Down