Skip to content

Support Codex 0.130 JSON agent messages#27

Merged
pftom merged 1 commit into
nexu-io:mainfrom
tackcrypto1031:fix/codex-0130-parser
May 17, 2026
Merged

Support Codex 0.130 JSON agent messages#27
pftom merged 1 commit into
nexu-io:mainfrom
tackcrypto1031:fix/codex-0130-parser

Conversation

@tackcrypto1031

Copy link
Copy Markdown
Contributor

Summary

  • Accept both legacy Codex item.item_type = assistant_message and current item.type = agent_message completed-item payloads.
  • Parse Codex turn.completed.usage as usage metadata while preserving existing task_complete support.

Fixes #23

Verification

  • pnpm exec tsc --noEmit
  • Direct parser regression script for assistant_message, agent_message, and turn.completed.usage
  • pnpm build (passes; existing Turbopack NFT tracing warning remains)

Accept both legacy assistant_message and current agent_message item.completed payloads, and keep usage metadata flowing from turn.completed events.

Constraint: Codex CLI 0.130.0 emits item.type=agent_message and turn.completed usage while older versions used item_type=assistant_message and task_complete.

Rejected: Replacing the parser branch wholesale | the compatibility gap is narrow and the existing adapter shape already handles adjacent Codex events.

Confidence: high

Scope-risk: narrow

Directive: Preserve both old and new Codex JSON shapes when changing this adapter.

Tested: pnpm exec tsc --noEmit; parser regression script for assistant_message, agent_message, and turn.completed usage; pnpm build.

Not-tested: Live /api/convert run against Codex 0.130.0 in this branch.

Co-authored-by: OmX <omx@oh-my-codex.dev>
@tackcrypto1031 tackcrypto1031 force-pushed the fix/codex-0130-parser branch from db014b9 to 92b0ce0 Compare May 15, 2026 13:22
@lefarcen lefarcen requested a review from PerishCode May 15, 2026 13:23
@lefarcen lefarcen added size/XS Extra-small change (<20 lines) risk/medium Medium risk change type/bugfix Bug fix labels May 15, 2026
@lefarcen

Copy link
Copy Markdown

Heads-up: PR #14 is also open in this area — both PRs touch src/lib/agents/argv.ts and include handling for the newer Codex agent_message / turn.completed JSON shape. This PR is the narrower parser-compatibility fix for #23, while #14 bundles that parser work with broader agent/local-font/history changes. Sharing so the authors and reviewer can compare scope before the maintainer team picks what lands.

@PerishCode PerishCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tackcrypto1031 Nice surgical fix for the Codex 0.130 JSON shift. The parser now accepts both legacy item_type=assistant_message and current type=agent_message in item.completed, and emits the usage meta from both task_complete and turn.completed, so older and newer Codex CLIs keep working through the same adapter. The nullish-coalescing fallback (item.item_type ?? item.type) and the inline type widening to include type?: string are exactly the right minimal touch — no other Codex branches are perturbed, and the change reads cleanly against the surrounding argv.ts shape. Verification (pnpm exec tsc --noEmit, the parser regression script for assistant_message/agent_message/turn.completed.usage, and pnpm build) is appropriately scoped for a parser bugfix in a repo without a test suite. Thanks for keeping both old and new shapes alive instead of replacing the branch — that's the right call for a CLI that ships JSON changes between point releases. Great work! 🚀

🔁 Powered by Looper · runner=reviewer · agent=claude-code · An autonomous AI dev team for your GitHub repos.

@lefarcen

Copy link
Copy Markdown

Heads-up: PR #50 is now open and also touches src/lib/agents/argv.ts for the Codex agent_message / turn.completed parser drift.

PR #50 is broader — it also includes Gemini/Copilot parsing and UI waiting logs — so this is mainly a scope coordination note for the authors and reviewer before the maintainer team picks the path to land.

@lefarcen

Copy link
Copy Markdown

Heads-up: PR #52 is now open and also touches src/lib/agents/argv.ts for the Codex agent_message / turn.completed parser drift.

PR #52 additionally includes the ConvertChip hook-order fix, so this is mainly a scope coordination note for the authors and reviewer before the maintainer team picks which path lands.

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

Labels

risk/medium Medium risk change size/XS Extra-small change (<20 lines) type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Codex CLI 0.130.0 JSON agent_message output

4 participants