Skip to content

Fix agent output parsing for current Codex, Gemini, and Copilot CLIs#50

Draft
enhung wants to merge 1 commit into
nexu-io:mainfrom
enhung:fix-agent-cli-output-parsing
Draft

Fix agent output parsing for current Codex, Gemini, and Copilot CLIs#50
enhung wants to merge 1 commit into
nexu-io:mainfrom
enhung:fix-agent-cli-output-parsing

Conversation

@enhung

@enhung enhung commented May 16, 2026

Copy link
Copy Markdown

Summary

Fixes output parsing for current versions of several local coding-agent CLIs.

What changed

  • Codex CLI 0.130.0: support item.type = "agent_message" and turn.completed usage events.
  • Gemini CLI 0.42.0: support init, message, and result stream events.
  • GitHub Copilot CLI 1.0.48: support assistant.message_delta, assistant.message, and usage events.
  • Fix ConvertChip hook ordering when switching layout modes.
  • Add waiting logs for slow first-byte agents like Codex/Copilot.

Why

The existing parser worked for Claude-style JSONL, but current Codex/Gemini/Copilot schemas could be dropped as noise. In the UI this looked like a stuck run with TTFB — and 0.0 KB, even though the CLI was installed and able to respond.

Codex can also take a long time before first output for full HTML generation, so the extra waiting logs make that state explicit instead of looking dead.

Verification

  • pnpm build
  • /api/draft smoke-tested with:
    • Codex CLI 0.130.0
    • Gemini CLI 0.42.0
    • GitHub Copilot CLI 1.0.48
  • Full /api/convert smoke test with Codex + article-magazine confirmed first HTML delta after about 74s.

@lefarcen lefarcen requested a review from mrcfps May 16, 2026 15:52
@lefarcen lefarcen added size/S Small change: 20-99 changed lines risk/medium Medium risk change type/bugfix Bug fix labels May 16, 2026
@lefarcen

Copy link
Copy Markdown

Heads-up: there are already open PRs covering parts of this same area. PR #27 touches src/lib/agents/argv.ts for the Codex agent_message / turn.completed parser drift, while PR #28 and PR #30 touch src/components/convert-chip.tsx for the ConvertChip hook-order crash.

This PR appears to bundle those slices with broader Gemini/Copilot parser support and waiting logs, so the authors and reviewer may want to compare scope before the maintainer team chooses what lands.

@lefarcen

Copy link
Copy Markdown

Hey @enhung — a quick update since my note last week. PRs #27 (Codex 0.130 agent_message / turn.completed parser) and #28 (ConvertChip hook-order fix) both merged into main on May 17, which is almost certainly what's causing the current conflict on this branch.

The parts of this PR that are still uniquely yours and haven't landed yet:

  • Gemini CLI 0.42.0 (init / message / result stream events)
  • GitHub Copilot CLI 1.0.48 (assistant.message_delta, assistant.message, usage events)
  • Waiting logs in use-convert.ts for slow first-byte agents like Codex/Copilot

A rebase on main + trimming the now-landed Codex/ConvertChip hunks should get you to a clean, focused PR for those three additions. PR #30 (ConvertChip layout-mode guard) is still open too, so worth keeping an eye on the convert-chip.tsx hunk if you keep any of that.

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/S Small change: 20-99 changed lines type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants