From cc597ce527be52fbf7209de1dc9710c630caee43 Mon Sep 17 00:00:00 2001 From: Trevin Chow Date: Thu, 2 Apr 2026 19:48:50 -0700 Subject: [PATCH 1/2] fix: gracefully handle unsupported thread/name/set on older Codex CLI Codex CLI v0.118.0 does not recognize the thread/name/set JSON-RPC method, causing startThread() to throw. Thread naming is cosmetic (for job log labels) and should not block thread creation. Wraps the call in try/catch so it fails silently on older CLI versions. Fixes #119 --- plugins/codex/scripts/lib/codex.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/codex/scripts/lib/codex.mjs b/plugins/codex/scripts/lib/codex.mjs index bf7e8c8..51b9c90 100644 --- a/plugins/codex/scripts/lib/codex.mjs +++ b/plugins/codex/scripts/lib/codex.mjs @@ -639,7 +639,11 @@ async function startThread(client, cwd, options = {}) { const response = await client.request("thread/start", buildThreadParams(cwd, options)); const threadId = response.thread.id; if (options.threadName) { - await client.request("thread/name/set", { threadId, name: options.threadName }); + try { + await client.request("thread/name/set", { threadId, name: options.threadName }); + } catch { + // thread/name/set not supported on this Codex CLI version + } } return response; } From 0268700bb3e6925de5cc512f9d7cd27083c0014a Mon Sep 17 00:00:00 2001 From: Trevin Chow Date: Thu, 2 Apr 2026 20:08:16 -0700 Subject: [PATCH 2/2] refactor: only suppress unsupported-method errors for thread/name/set Address Codex review feedback: the bare catch swallowed all errors including auth, network, and server failures. Now only suppresses errors containing 'unknown variant' or 'unknown method' (the specific error older CLI versions return) and rethrows everything else. --- plugins/codex/scripts/lib/codex.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/codex/scripts/lib/codex.mjs b/plugins/codex/scripts/lib/codex.mjs index 51b9c90..843b5ce 100644 --- a/plugins/codex/scripts/lib/codex.mjs +++ b/plugins/codex/scripts/lib/codex.mjs @@ -641,8 +641,13 @@ async function startThread(client, cwd, options = {}) { if (options.threadName) { try { await client.request("thread/name/set", { threadId, name: options.threadName }); - } catch { - // thread/name/set not supported on this Codex CLI version + } catch (err) { + // Only suppress "unknown variant/method" errors from older CLI versions + // that don't support thread/name/set. Rethrow auth, network, or server errors. + const msg = String(err?.message ?? err ?? ""); + if (!msg.includes("unknown variant") && !msg.includes("unknown method")) { + throw err; + } } } return response;