Skip to content

Codex invocations do not handle lifecycle diagnostics reliably #148

Description

@jhinzzz

Problem

When Codex runs through the conversion route, its JSONL stream includes lifecycle events such as thread.started and turn.started. It can also emit a nonfatal model-catalog refresh diagnostic on stderr and then continue successfully.

The current adapter ignores the lifecycle start events and forwards the full diagnostic response body. The browser also marks a conversion as done whenever the SSE stream ends, even when the agent has a non-zero or missing exit code or produced no HTML. Together, this makes a run look stalled or successful without a reliable terminal state.

Reproduction

  1. Run pnpm -F @html-anything/next dev.
  2. Select Codex and start any conversion.
  3. Observe a lifecycle diagnostic before the assistant output.
  4. Observe that completion is not derived from both the process exit code and generated HTML.

Redacted real-session event shape:

thread.started
turn.started
item.completed (diagnostic)
item.completed (agent message)
turn.completed

Expected behavior

  • Surface the Codex session and generation start events.
  • Treat diagnostic items as warnings rather than generated HTML.
  • Preserve useful stderr context while redacting appended response bodies.
  • Mark a conversion done only after exit code 0 and non-empty HTML.
  • Keep provider and model selection inherited from the existing Codex CLI configuration.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions