-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[app-server] define new v2 approval request #6474
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
Conversation
d97e340 to
9a9fb99
Compare
| ExecCommandApproval { | ||
| params: v1::ExecCommandApprovalParams, | ||
| response: v1::ExecCommandApprovalResponse, | ||
| }, |
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.
I made some updates to the server_request_definitions macro - I like the explicitness of referencing the params and response structs, and it now mirrors client_request_definitions which does the same thing.
|
@codex review this |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
d4d19d3 to
94d51cc
Compare
| #[serde(tag = "type", rename_all = "camelCase")] | ||
| #[ts(tag = "type")] | ||
| #[ts(export_to = "v2/")] | ||
| pub enum ItemApprovalRequest { |
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.
can this purely reference the item?
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.
If not I think there is no point in having 1 event than has to have internal dispatch for each item type.
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.
So you're saying if we can do something like:
pub struct ItemRequestApprovalParams {
pub thread_id: String,
pub turn_id: String,
pub item: ThreadItem,
}
then it's worth consolidating. If not, then we should have two methods?
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.
The unfortunate thing about pub item: ThreadItem is that the type is too broad, in reality we only send approval requests for ThreadItem::CommandExecution and ThreadItem::FileChange.
This makes me lean towards having two separate methods actually
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.
then it's worth consolidating. If not, then we should have two methods?
Yeah, my initial goal was to have something like:
pub struct ItemRequestApprovalParams {
pub thread_id: String,
pub turn_id: String,
pub item_id: String ,
}
and have all relevant information be on the item.
But having item_id + item type specific payload makes this annoying.
two separate methods actually
Then we'll have approvals for web searches, maybe mcp calls and who knows what. I don't think we'll stop on just two.
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.
Hmm yeah, neither seems ideal. Perhaps I'll go deeper on implementation to see if there's something clever we can do, I'm not super familiar with the underlying core event msgs yet and how they map to Items
| #[ts(export_to = "v2/")] | ||
| pub struct FileEditRequest { | ||
| pub call_id: String, | ||
| pub file_changes: HashMap<PathBuf, FileChange>, |
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.
can this be inferred from the item?
| pub file_changes: HashMap<PathBuf, FileChange>, | ||
| /// Optional explanatory reason (e.g. request for extra write access). | ||
| pub reason: Option<String>, | ||
| pub grant_root: Option<PathBuf>, |
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.
is this actually used in UI?
b140bf2 to
2c23e9d
Compare
0c25da4 to
6ff6d9f
Compare
0c5fa07 to
617d52b
Compare
48ea385 to
b379e86
Compare
Define the API v2 interface for the server making a request to the client. This only happens when codex is requesting the user's approval for executing a command or writing a file.
In API v2, a single
item/requestApprovalRPC replaces bothapplyPatchApprovalandexecCommandApproval.This PR only defines the interface. Implementation to follow.