Skip to content

fix: gracefully handle unsupported thread/name/set on older Codex CLI#126

Merged
dkundel-openai merged 2 commits intoopenai:mainfrom
tmchow:fix/119-thread-name-set-compat
Apr 8, 2026
Merged

fix: gracefully handle unsupported thread/name/set on older Codex CLI#126
dkundel-openai merged 2 commits intoopenai:mainfrom
tmchow:fix/119-thread-name-set-compat

Conversation

@tmchow
Copy link
Copy Markdown
Contributor

@tmchow tmchow commented Apr 3, 2026

Summary

startThread() in codex.mjs calls thread/name/set unconditionally, which throws on Codex CLI v0.118.0 because that version doesn't support the method. This wraps the call in a try/catch so thread creation succeeds even when naming is unsupported.

Changes

One file: plugins/codex/scripts/lib/codex.mjs, function startThread() (line 639-645).

Thread naming is cosmetic (used for job log labels) and should not prevent thread creation. The try/catch allows the plugin to work with both older and newer Codex CLI versions.

Testing

  • npm test: same results as main (pre-existing failures in commands.test.mjs, unrelated)
  • npm run build: passes

This contribution was developed with AI assistance (Codex).

Fixes #119

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 openai#119
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc597ce527

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.
@D2758695161
Copy link
Copy Markdown

🦀 Assigned! I will submit a PR for this issue. Looking at the fix now.

@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 5, 2026

🦀 Assigned! I will submit a PR for this issue. Looking at the fix now.

@D2758695161 please stop automating things, you're looking at PRs proposing PRs.

@dkundel-openai dkundel-openai merged commit 4bd783b into openai:main Apr 8, 2026
@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 8, 2026

@dkundel-openai thanks for the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

companion script fails with 'unknown variant thread/name/set' on Codex CLI 0.118.0

3 participants