Add diff/content field to FileUpdateChange in JSON output
Summary
In codex exec --json mode, file_change items only include {path, kind} per change — the actual diff/content is stripped during the mapping from the internal protocol to the exec JSON output.
The TUI mode renders full diffs because it receives the FileChange enum directly from the protocol layer (Add { content }, Delete { content }, Update { unified_diff }). But the exec JSON mapper at codex-rs/exec/src/event_processor_with_jsonl_output.rs:186-193 only copies path and kind, discarding the rest:
.map(|change| FileUpdateChange {
path: change.path,
kind: match change.kind {
PatchChangeKind::Add => ExecPatchChangeKind::Add,
PatchChangeKind::Delete => ExecPatchChangeKind::Delete,
PatchChangeKind::Update { .. } => ExecPatchChangeKind::Update,
},
})
Proposed change
Add a diff (or content) field to FileUpdateChange in codex-rs/exec/src/exec_events.rs:
pub struct FileUpdateChange {
pub path: String,
pub kind: PatchChangeKind,
pub content: Option<String>, // file content for Add/Delete, unified_diff for Update
}
And pass it through in the mapper.
Use case
We run codex exec --json programmatically and emit ATIF (Agent Trace Interchange Format) telemetry spans for each tool call. Without the diff/content, file_change spans only show which files were touched but not what changed — making them far less useful for debugging and session analysis.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗