Skip to content

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented Oct 15, 2025

This adds parsed_cmd: Vec<ParsedCommand> to ExecApprovalRequestEvent in the core protocol (protocol/src/protocol.rs), which is also what this field is named on ExecCommandBeginEvent. Honestly, I don't love the name (it sounds like a single command, but it is actually a list of them), but I don't want to get distracted by a naming discussion right now.

This also adds parsed_cmd to ExecCommandApprovalParams in codex-rs/app-server-protocol/src/protocol.rs, so it will be available via codex app-server, as well.

For consistency, I also updated ExecApprovalElicitRequestParams in codex-rs/mcp-server/src/exec_approval.rs to include this field under the name codex_parsed_cmd, as that struct already has a number of special codex_* fields. Note this is the code for when Codex is used as an MCP server and therefore has to conform to the official spec for an MCP elicitation type.

@bolinfest bolinfest changed the base branch from main to pr5218 October 15, 2025 19:29
@bolinfest bolinfest requested review from gpeal and pakrym-oai October 15, 2025 19:36
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Comment on lines 1178 to +1181
/// Optional human-readable reason for the approval (e.g. retry without sandbox).
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
pub parsed_cmd: Vec<ParsedCommand>,
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Make new parsed_cmd field backward compatible

The new parsed_cmd: Vec<ParsedCommand> field is required when deserializing ExecApprovalRequestEvent. Any log replay or client compiled against an older protocol that doesn’t emit this field will now fail to deserialize these events entirely. We already have compatibility shims for other fields (e.g. formatted_output on exec events) in the TUI tests, so this will regress loading existing session logs or interop with older agents. Consider marking the field with #[serde(default)] (or making it Option<Vec<…>>) so missing data defaults to an empty vector rather than causing a hard parse error.

Useful? React with 👍 / 👎.

bolinfest added a commit that referenced this pull request Oct 15, 2025
Note these two types were identical, so it seems clear to standardize on the one in `codex_protocol` and eliminate the `Into` stuff.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/5218).
* #5222
* __->__ #5218
Base automatically changed from pr5218 to main October 15, 2025 20:00
/// Optional human-readable reason for the approval (e.g. retry without sandbox).
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
pub parsed_cmd: Vec<ParsedCommand>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make the entire field be ParsedCmd and move the vec inside?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@pakrym-oai Are you suggesting something like:

struct ParsedCmd {
  pub parsed_cmd: Vec<ParsedCommand>,
}

but then should ExecCommandBeginEvent change, as well? (And this has to change throughout?)

Copy link
Collaborator

@pakrym-oai pakrym-oai Oct 15, 2025

Choose a reason for hiding this comment

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

Something like:

struct ParsedCmd {
  pub components: Vec<ParsedCommandComponent>,
}

to give us space for later expansion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, will address this in a follow-up PR.

@bolinfest bolinfest merged commit 995f5c3 into main Oct 15, 2025
40 checks passed
@bolinfest bolinfest deleted the pr5222 branch October 15, 2025 20:58
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 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.

4 participants