codex - 💡(How to fix) Fix Expose stable run/review lifecycle metadata for Codex tasks [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20943Fetched 2026-05-05 05:55:54
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×3commented ×2cross-referenced ×2unlabeled ×1

Error Message

  • terminal.reason: success | error | user_canceled | policy_blocked | timeout

Root Cause

  • Enables reliable supervision UX for Codex runs
  • Reduces parser fragility for community tooling
  • Preserves Codex as source of truth while allowing ecosystem clients

Code Example

{
  "version": "1.0",
  "event": "run.executing",
  "run": {
    "id": "run_123",
    "session_id": "sess_456",
    "task_id": "task_789",
    "state": "executing",
    "created_at": "2026-05-04T18:10:00Z",
    "updated_at": "2026-05-04T18:10:12Z",
    "review_required": false
  },
  "artifact": {
    "diff_available": true,
    "files_changed": 3,
    "insertions": 42,
    "deletions": 9,
    "paths": [
      "codex-rs/tui/src/app.rs",
      "codex-rs/core/src/task.rs"
    ]
  },
  "terminal": {
    "reason": null,
    "exit_code": null
  }
}
RAW_BUFFERClick to expand / collapse

What feature would you like to see?

Expose a stable, machine-readable lifecycle for Codex task execution so external clients can reliably monitor progress and decide when human review is needed.

This is intended for open-source integrations (CLI wrappers, dashboards, mobile/web review surfaces), without changing Codex model behavior.

Problem

Today, external tooling can observe Codex outcomes, but lifecycle signals are not consistently exposed as a stable contract. Integrators need to infer state transitions from mixed output/log patterns, which is brittle across versions.

Desired outcome

Provide a minimal, versioned lifecycle contract with:

  1. Run state transitions
  2. Review-required signal
  3. Diff/artifact summary metadata
  4. Final disposition

Proposed API shape (minimal)

A structured envelope emitted for each run:

  • run.created
  • run.queued
  • run.executing
  • run.review_required
  • run.completed
  • run.failed
  • run.canceled

Each event includes stable identifiers and timestamps, plus optional artifact summary fields.

Why this matters

  • Enables reliable supervision UX for Codex runs
  • Reduces parser fragility for community tooling
  • Preserves Codex as source of truth while allowing ecosystem clients

Backward compatibility

  • Additive only
  • Existing human-readable output remains unchanged
  • Version field in payload to support future extension

Acceptance criteria

  1. A documented event/state contract exists in docs.
  2. At least one output surface exposes the contract (stdout JSON mode, log stream, or dedicated command output).
  3. Contract includes explicit review_required signal.
  4. Contract includes file-change summary metadata (files_changed, insertions, deletions) when available.
  5. Tests cover state transition ordering and terminal states.

Minimal schema example

{
  "version": "1.0",
  "event": "run.executing",
  "run": {
    "id": "run_123",
    "session_id": "sess_456",
    "task_id": "task_789",
    "state": "executing",
    "created_at": "2026-05-04T18:10:00Z",
    "updated_at": "2026-05-04T18:10:12Z",
    "review_required": false
  },
  "artifact": {
    "diff_available": true,
    "files_changed": 3,
    "insertions": 42,
    "deletions": 9,
    "paths": [
      "codex-rs/tui/src/app.rs",
      "codex-rs/core/src/task.rs"
    ]
  },
  "terminal": {
    "reason": null,
    "exit_code": null
  }
}

Enum values

  • state: created | queued | executing | review_required | completed | failed | canceled
  • terminal.reason: success | error | user_canceled | policy_blocked | timeout

Additional information

I can help with:

  • Repro cases
  • Edge-case matrix (failed tool call, partial write, canceled run)
  • Draft tests for transition validity

extent analysis

TL;DR

Implement a versioned lifecycle contract with stable event/state transitions and metadata to enable reliable monitoring of Codex task execution.

Guidance

  • Define a minimal, versioned lifecycle contract with the proposed API shape, including run state transitions, review-required signal, and diff/artifact summary metadata.
  • Ensure the contract includes explicit review_required signal and file-change summary metadata (files_changed, insertions, deletions) when available.
  • Implement tests to cover state transition ordering and terminal states, and provide repro cases and edge-case matrices for failed tool calls, partial writes, and canceled runs.
  • Document the event/state contract in docs and expose it through at least one output surface, such as stdout JSON mode, log stream, or dedicated command output.

Example

{
  "version": "1.0",
  "event": "run.executing",
  "run": {
    "id": "run_123",
    "session_id": "sess_456",
    "task_id": "task_789",
    "state": "executing",
    "created_at": "2026-05-04T18:10:00Z",
    "updated_at": "2026-05-04T18:10:12Z",
    "review_required": false
  },
  "artifact": {
    "diff_available": true,
    "files_changed": 3,
    "insertions": 42,
    "deletions": 9,
    "paths": [
      "codex-rs/tui/src/app.rs",
      "codex-rs/core/src/task.rs"
    ]
  },
  "terminal": {
    "reason": null,
    "exit_code": null
  }
}

Notes

The proposed API shape and minimal schema example provide a good starting point for implementing the lifecycle contract. However, additional work may be required to ensure backward compatibility and

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Expose stable run/review lifecycle metadata for Codex tasks [2 comments, 2 participants]