Skip to content

fix: add support for exec and apply_patch approvals in the new wire format - #2286

Merged
bolinfest merged 1 commit into
mainfrom
pr2286
Aug 14, 2025
Merged

bolinfest merged 1 commit into
mainfrom
pr2286

Conversation

@bolinfest

@bolinfest bolinfest commented Aug 14, 2025 •

Copy link
Copy Markdown
Collaborator

Now when CodexMessageProcessor receives either a EventMsg::ApplyPatchApprovalRequest or a EventMsg::ExecApprovalRequest, it sends the appropriate request from the server to the client. When it gets a response, it forwards it on to the CodexConversation.

Note this takes a lot of code from:

https://github.com/openai/codex/blob/main/codex-rs/mcp-server/src/conversation_loop.rs
https://github.com/openai/codex/blob/main/codex-rs/mcp-server/src/exec_approval.rs
https://github.com/openai/codex/blob/main/codex-rs/mcp-server/src/patch_approval.rs

I am copy/pasting for now because I am trying to consolidate around the new wire_format.rs, so I plan to delete these other files soon.

Now that we have requests going both from client-to-server and server-to-client, I renamed CodexRequest to ClientRequest.


Stack created with Sapling. Best reviewed with ReviewStack.

@bolinfest
bolinfest changed the base branch from main to pr2285 August 14, 2025 05:21
@bolinfest
bolinfest requested a review from gpeal August 14, 2025 05:22
bolinfest added a commit that referenced this pull request Aug 14, 2025
As `Session` needs a bit of work, it will make things easier to move
around if we can start by reducing the extent of its public API. This
makes all the fields private, though adds three `pub(crate)` getters.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2285).
* #2287
* #2286
* __->__ #2285
Base automatically changed from pr2285 to main August 14, 2025 05:53
}
}

async fn apply_bespoke_event_handling(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is "bespoke"?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Well, as opposed to the general treatment we give to apply EventMsg variants in add_conversation_listener(), which is that we forward all of them as notifications, whether or not we believe they are actually useful.

Though as noted in:

// For now, we send a notification for every event,
// JSON-serializing the `Event` as-is, but we will move
// to creating a special enum for notifications with a
// stable wire format.

I would like to stop doing that in the near future.

***
fix: add support for exec and apply_patch approvals in the new wire format
@bolinfest
bolinfest merged commit 539f4b2 into main Aug 14, 2025
@bolinfest
bolinfest deleted the pr2286 branch August 14, 2025 06:00
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 14, 2025
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