Skip to content

fix Codex invocation lifecycle handling - #149

Open
jhinzzz wants to merge 1 commit into
nexu-io:mainfrom
jhinzzz:fix/codex-invocation-lifecycle
Open

fix Codex invocation lifecycle handling#149
jhinzzz wants to merge 1 commit into
nexu-io:mainfrom
jhinzzz:fix/codex-invocation-lifecycle

Conversation

@jhinzzz

@jhinzzz jhinzzz commented Sep 4, 2026

Copy link
Copy Markdown

Closes #148

Why

Codex JSONL sessions can emit lifecycle events and a nonfatal model-catalog diagnostic before the assistant output. The adapter ignored the start events, forwarded the full diagnostic response body, and the browser marked any ended stream as done even when the process failed or produced no HTML.

What changed

  • Parse Codex thread and turn start events and surface diagnostic items as warnings.
  • Buffer only Codex stderr by line and redact model-catalog response bodies while preserving useful context.
  • Mark conversion success only for exit code 0 with non-empty HTML; preserve error states otherwise.
  • Add focused regression coverage for parsing, redaction, and terminal outcomes.

Provider and model selection remain inherited from the existing Codex CLI environment. This change adds no provider-specific configuration.

Validation

  • pnpm -F @html-anything/next test — 24 files, 190 tests passed
  • pnpm -F @html-anything/next typecheck
  • pnpm exec tsx scripts/guard.ts
  • pnpm -F @html-anything/next build
  • Real codex exec --json HTML smoke — exit 0

Redacted real-session log:

thread.started
turn.started
item.completed:error
item.completed:agent_message
turn.completed

Only event types are included; stderr payloads and generated content are intentionally omitted.

@lefarcen
lefarcen requested a review from nettee September 4, 2026 16:26
@lefarcen lefarcen added size/M Medium change: 100-299 lines risk/medium Medium risk change type/bugfix Bug fix labels Sep 4, 2026

@nettee nettee left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@jhinzzz

I reviewed the Codex JSONL lifecycle parsing, model-catalog stderr redaction, and conversion terminal-state handling across every changed range. I also verified the full application suite (190 tests), TypeScript check, and repository guard locally. Thanks for the focused regression coverage and clear failure behavior—nice work tightening this boundary.

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

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/M Medium change: 100-299 lines type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex invocations do not handle lifecycle diagnostics reliably

3 participants