fix-codex-agent

Fix: codex agent rendering in wg TUI — colors, scrollback, layout differ from native codex CLI

Metadata

Statusdone
Assignedagent-1094
Agent identity3184716484e6f0ea08bb13539daf07686ee79d440505f1fdf2de0357707034c3
Created2026-04-29T12:26:18.773603274+00:00
Started2026-04-29T12:28:24.556025239+00:00
Completed2026-04-29T13:01:18.873995245+00:00
Tagspriority-high,bug,codex,tui,pty, eval-scheduled
Eval score0.68
└ blocking impact0.70
└ completeness0.60
└ constraint fidelity0.85
└ coordination overhead0.75
└ correctness0.65
└ downstream usability0.70
└ efficiency0.75
└ intent fidelity0.52
└ style adherence0.80

Description

Description

User report: when running a codex agent inside wg's TUI chat tab, the rendering is materially worse than the native codex CLI experience:

  • Colors are messed up (likely ANSI escape sequence handling)
  • Layout looks different from the standalone codex CLI
  • Scrollback is broken (likely overlaps with fix-pty-scrollback already queued)

User quote: 'scrollback broken. the UI looks very different than regular cli experience. color messed up too??? codex is not working as well as claude as you can see.'

The same wg TUI handles claude chat agents acceptably, so the regression is codex-specific. Likely culprits:

  • Codex CLI emits a different set of ANSI escape sequences that wg's PTY parser doesn't fully handle
  • Codex CLI may use alternate-screen mode / cursor-positioning that wg's chat-tab renderer misinterprets
  • Recent commit f3adc29c3 (tui-live-log: parse codex CLI stream events) added codex-specific parsing — this fix may need to extend that to the chat-tab renderer too

Goal

Codex chat in wg TUI should render with parity to the native codex CLI experience: correct colors, correct layout, working scrollback.

What to investigate

  • Capture a typical codex CLI session's stdout (run script -c codex codex-output.log or equivalent) and compare against what the wg chat-tab renders
  • Check the codex stream-event parser added in tui-live-log — is it being applied to the chat-tab pane or only the live-log pane?
  • ANSI colors: is the chat tab passing the PTY through a parser that strips or mangles SGR codes?
  • Scrollback: this overlaps with fix-pty-scrollback. If the fix lands first, retest before claiming separate fix needed here.

Validation

  • Side-by-side comparison: native codex CLI session vs wg TUI codex chat tab, same prompt — visual screenshots in the task log showing they match
  • Colors: standard SGR colors render correctly (red errors, green diffs, dim/bright variants)
  • Scrollback: scrolling back through codex output shows the actual content, not duplicated/garbled (tied to fix-pty-scrollback — verify both fixes are mutually compatible)
  • Cursor positioning: codex's interactive prompts (option lists, confirmations) render cleanly without leaving stale lines
  • No regression in claude chat-tab rendering (same TUI code path, don't break the working case)
  • cargo build + cargo test pass
  • Permanent smoke scenario added: feed a known codex stream-event sequence into the chat-tab renderer, assert output matches expected ANSI / layout
  • cargo install --path . was run before claiming done

Depends on

Required by

Log