Skip to content

fix(codex): detect status from rendered screen - #579

Merged
haofeif merged 1 commit into
awslabs:mainfrom
TiantianFlow:fix/codex-rendered-status
Aug 10, 2026
Merged

fix(codex): detect status from rendered screen#579
haofeif merged 1 commit into
awslabs:mainfrom
TiantianFlow:fix/codex-rendered-status

Conversation

@TiantianFlow

Copy link
Copy Markdown
Contributor

Summary

  • opt CodexProvider into CAO's existing pyte-composited status path
  • detect against the live rendered viewport instead of stale append-only redraw history
  • add regression coverage for erased and active MCP startup spinners, plus completed turns

Problem

Codex redraws its inline TUI in place. The raw tmux pipe-pane stream retains frames that were later erased from the visible terminal, so an MCP startup spinner can pin CAO at PROCESSING even after Codex is visibly ready. This is the Codex-specific gap described in #537 after the rendered-screen framework shipped in #293.

The change enables that existing framework for Codex and reuses the provider's line-oriented status detector on blank-trimmed viewport rows. The open generic recovery work in #558 is complementary; this fixes the provider at the normal detection path without waiting for a capture-pane fallback.

Validation

  • uv run --frozen pytest test/providers/test_codex_provider_unit.py -q — 177 passed, 3 skipped
  • uv run --frozen pytest test/services/test_status_monitor.py -q — 30 passed
  • Black and isort checks pass
  • git diff --check origin/main...HEAD passes
  • equivalent hotfix on CAO 2.4.1 completed a real deferred-init Codex launch through MCP startup and returned the assigned readiness token

Related: #537, #293, #558.

Copilot AI 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.

Pull request overview

This pull request fixes Codex status detection getting stuck in PROCESSING by opting CodexProvider into CAO’s existing pyte rendered-screen (composited viewport) status path, so detection runs against what’s currently visible instead of the append-only tmux pipe-pane stream that can retain erased spinner frames.

Changes:

  • Enable rendered-screen status detection for CodexProvider via supports_screen_detection = True.
  • Add CodexProvider.get_status_from_screen() that trims pyte’s padded rows and reuses the existing line-oriented detector on the rendered viewport.
  • Add unit regression tests covering erased MCP startup spinners, active spinners, and completed turns on the rendered screen.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/cli_agent_orchestrator/providers/codex.py Opt Codex into pyte screen detection and implement get_status_from_screen() to avoid stale in-place redraw frames pinning PROCESSING.
test/providers/test_codex_provider_unit.py Add regression tests validating correct status behavior on composited screen output for MCP startup spinners and completed turns.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

codecov-commenter commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@5464a2e). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #579   +/-   ##
=======================================
  Coverage        ?   91.15%           
=======================================
  Files           ?      181           
  Lines           ?    23788           
  Branches        ?        0           
=======================================
  Hits            ?    21683           
  Misses          ?     2105           
  Partials        ?        0           
Flag Coverage Δ
unittests 91.15% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TiantianFlow
TiantianFlow force-pushed the fix/codex-rendered-status branch from b38cb24 to f7a2f84 Compare August 10, 2026 00:59

@haofeif haofeif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One blocking status-correctness issue found.

Comment thread src/cli_agent_orchestrator/providers/codex.py
Codex redraws its TUI in place, so the append-only pipe-pane stream can retain erased MCP startup frames and leave status stuck at PROCESSING after the visible terminal is ready.

Opt Codex into the existing pyte-composited status path and reuse its line-oriented detector on the live viewport. Add regression coverage for an erased startup spinner, an active spinner, and a completed turn.

Refs awslabs#537.
@TiantianFlow
TiantianFlow force-pushed the fix/codex-rendered-status branch from f7a2f84 to e713dbf Compare August 10, 2026 01:18

@haofeif haofeif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@wjcjttl thanks for your contribution! Rechecked the revised head. The reported minute/hour progress-row regression is fixed and covered; no remaining material findings.

@haofeif
haofeif merged commit 135e7ff into awslabs:main Aug 10, 2026
23 checks passed
@TiantianFlow
TiantianFlow deleted the fix/codex-rendered-status branch August 12, 2026 00:43
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.

4 participants