-
Notifications
You must be signed in to change notification settings - Fork 6.4k
[app-server] feat: add v2 command execution approval flow #6758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,12 @@ use codex_protocol::config_types::ReasoningSummary; | |
| use codex_protocol::config_types::SandboxMode; | ||
| use codex_protocol::config_types::Verbosity; | ||
| use codex_protocol::models::ResponseItem; | ||
| use codex_protocol::parse_command::ParsedCommand; | ||
| use codex_protocol::protocol::AskForApproval; | ||
| use codex_protocol::protocol::EventMsg; | ||
| use codex_protocol::protocol::FileChange; | ||
| use codex_protocol::protocol::ReviewDecision; | ||
| use codex_protocol::protocol::SandboxCommandAssessment; | ||
| use codex_protocol::protocol::SandboxPolicy; | ||
| use codex_protocol::protocol::SessionSource; | ||
| use codex_protocol::protocol::TurnAbortReason; | ||
|
|
@@ -191,6 +195,46 @@ pub struct GitDiffToRemoteResponse { | |
| pub diff: String, | ||
| } | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct ApplyPatchApprovalParams { | ||
| pub conversation_id: ConversationId, | ||
| /// Use to correlate this with [codex_core::protocol::PatchApplyBeginEvent] | ||
| /// and [codex_core::protocol::PatchApplyEndEvent]. | ||
| pub call_id: String, | ||
| pub file_changes: HashMap<PathBuf, FileChange>, | ||
| /// Optional explanatory reason (e.g. request for extra write access). | ||
| pub reason: Option<String>, | ||
| /// When set, the agent is asking the user to allow writes under this root | ||
owenlin0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// for the remainder of the session (unclear if this is honored today). | ||
| pub grant_root: Option<PathBuf>, | ||
| } | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct ApplyPatchApprovalResponse { | ||
| pub decision: ReviewDecision, | ||
| } | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct ExecCommandApprovalParams { | ||
| pub conversation_id: ConversationId, | ||
| /// Use to correlate this with [codex_core::protocol::ExecCommandBeginEvent] | ||
| /// and [codex_core::protocol::ExecCommandEndEvent]. | ||
| pub call_id: String, | ||
| pub command: Vec<String>, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Today, we have various "shell tools" that have different APIs:
We also have some work in flight where the tool call is I'm enumerating these to be sure that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are your thoughts of the v2.rs shape here? https://github.com/openai/codex/pull/6758/files#diff-08e3876d082b8c0ed5b525feeb0d204b12b3731d4a1a0ed4f72455e819e4eea6R624 I'm thinking command as a
Interesting... I think in that case it is representable with one command exec approval request per Luckily it seems doable to expand the API to support these new exec use cases. @bolinfest Thoughts? |
||
| pub cwd: PathBuf, | ||
| pub reason: Option<String>, | ||
| pub risk: Option<SandboxCommandAssessment>, | ||
| pub parsed_cmd: Vec<ParsedCommand>, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is appropriate here. Are we doing something like this today? At a minimum, the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are actually, this is due to the fact that a shell command can be a sequence of piped commands - we have an existing unit test demonstrating this: |
||
| } | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] | ||
| pub struct ExecCommandApprovalResponse { | ||
| pub decision: ReviewDecision, | ||
| } | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct CancelLoginChatGptParams { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see now this was all moved over from
codex-rs/app-server-protocol/src/protocol/common.rs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah sorry forgot to mention in PR description. everything in v1.rs was just moved, and I didn't touch how the legacy API works