Skip to content

Add diff/content field to FileUpdateChange in JSON output #17054

@gadgetman6

Description

@gadgetman6

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexecIssues related to the `codex exec` subcommand

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions