Skip to content

Wire the PatchUpdated events through app_server#18289

Merged
akshaynathan merged 45 commits intomainfrom
draft-apply-patch-streaming-app-server
Apr 20, 2026
Merged

Wire the PatchUpdated events through app_server#18289
akshaynathan merged 45 commits intomainfrom
draft-apply-patch-streaming-app-server

Conversation

@akshaynathan
Copy link
Copy Markdown
Contributor

@akshaynathan akshaynathan commented Apr 17, 2026

Wires patch_updated events through app_server. These events are parsed and streamed while apply_patch is being written by the model. The eventual goal is to use this to display better progress indicators in the codex app.

…onses api. This is to enable clients to show progress during file writes.

This does not work with apply_patch in function call mode, since that required adding streaming json parsing.
…onses api. This is to enable clients to show progress during file writes.

This does not work with apply_patch in function call mode, since that required adding streaming json parsing.
@akshaynathan akshaynathan changed the title [DRAFT] Wire PatchUpdated events through app-server Wire the PatchUpdated events through app_server Apr 17, 2026
@akshaynathan akshaynathan requested a review from pakrym-oai April 17, 2026 05:34
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

💡 Codex Review

let path = hunk_source_path(hunk).to_path_buf();

P2 Badge Resolve streamed patch paths against cwd

PatchApplyUpdated currently keys changes by the raw hunk path (hunk_source_path), so relative patch inputs emit relative paths in progress events. The begin/end file-change items for the same call are built from verified ApplyPatchAction paths (resolved against cwd), so clients can see the same file switch from relative to absolute path mid-lifecycle and treat it as a different entry. Normalize streamed paths the same way as begin/end to keep item updates stable.


if let ResponseItem::CustomToolCall { call_id, name, .. } = &item {
let tool_name = ToolName::plain(name.as_str());
active_tool_argument_diff_consumer = tool_runtime
.create_diff_consumer(&tool_name)
.map(|consumer| (call_id.clone(), consumer));

P2 Badge Support function-call apply_patch when streaming is enabled

The diff consumer is only created for CustomToolCall items; FunctionCall items clear the active consumer. As a result, apply_patch_streaming_events produces no PatchApplyUpdated events when apply_patch is invoked through the JSON/function-call path (which remains possible unless freeform is also enabled), making the feature flag a no-op in that configuration.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/exec/src/exec_events.rs Outdated
/// Emitted when an item is updated.
#[serde(rename = "item.updated")]
ItemUpdated(ItemUpdatedEvent),
/// Emitted when the model starts streaming input for an item.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would revert all exec changes. We don't actively add APIs to it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai left a comment

Choose a reason for hiding this comment

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

Let's not touch exec

@akshaynathan akshaynathan requested a review from a team as a code owner April 20, 2026 16:35
@akshaynathan
Copy link
Copy Markdown
Contributor Author

Removed exec changes and added 500ms buffering of events.

@akshaynathan akshaynathan merged commit 34a3e85 into main Apr 20, 2026
25 checks passed
@akshaynathan akshaynathan deleted the draft-apply-patch-streaming-app-server branch April 20, 2026 17:44
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants