mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Enable remote named permission profile selection in the TUI (#43340)
## Why The permissions picker displayed profiles from the connected app server but disabled selection of remote custom profiles. ## What changed - Enable named profile selection through `thread/settings/update` and track pending selections until server confirmation. - Use pending or confirmed server permissions for subsequent turns, preserve profiles across forks and prompt edits, and reconcile pending selections on reconnect. - Block conflicting permission changes and forks while selection is pending. Preserve input when selection fails and report unsupported app servers. - Reject working directory changes while a remote named profile is active. ## Testing Add regression coverage for profile selection, turn permissions, pending-selection guards, prompt-edit profile preservation, reconnect reconciliation, and profile inheritance in forks and side conversations. GitOrigin-RevId: 76e9bb7b4d631b1066974da013d9915a89dc54a7
This commit is contained in:
1 parent
1fb5158b34
commit
121f91fd5d
24 files changed
+914
-50
No files matched your search
@@ -3,6 +3,7 @@
|
||||
use super::App;
|
||||
use crate::app_command::AppCommand;
|
||||
use crate::app_event::AppEvent;
|
||||
use crate::app_event::PermissionProfileSelection;
|
||||
use crate::app_server_session::AppServerSession;
|
||||
use crate::chatwidget::cyber_model_approval_reviewer;
|
||||
use crate::session_state::ThreadSessionState;
|
||||
@@ -38,7 +39,25 @@ impl App {
|
||||
.approval_policy
|
||||
.value(),
|
||||
) != AppServerAskForApproval::OnRequest);
|
||||
let pending_cyber_profile =
|
||||
params
|
||||
.permissions
|
||||
.as_ref()
|
||||
.map(|profile_id| PermissionProfileSelection {
|
||||
profile_id: profile_id.clone(),
|
||||
approval_policy: params.approval_policy,
|
||||
approvals_reviewer: params
|
||||
.approvals_reviewer
|
||||
.map(codex_app_server_protocol::ApprovalsReviewer::to_core),
|
||||
display_label: profile_id.clone(),
|
||||
});
|
||||
let settings_updated = self.send_thread_settings_update(app_server, params).await;
|
||||
if settings_updated
|
||||
&& let (Some(thread_id), Some(selection)) =
|
||||
(self.active_thread_id, pending_cyber_profile)
|
||||
{
|
||||
self.pending_server_profiles.insert(thread_id, selection);
|
||||
}
|
||||
if defaulted_to_auto_review && settings_updated {
|
||||
self.app_event_tx.send(AppEvent::CyberModelAutoReviewNotice);
|
||||
}
|
||||
@@ -213,6 +232,17 @@ impl App {
|
||||
if !thread_settings_update_has_changes(¶ms) {
|
||||
return false;
|
||||
}
|
||||
if ThreadId::from_string(¶ms.thread_id)
|
||||
.ok()
|
||||
.is_some_and(|thread_id| self.pending_server_profiles.contains_key(&thread_id))
|
||||
&& (params.cwd.is_some()
|
||||
|| params.approval_policy.is_some()
|
||||
|| params.approvals_reviewer.is_some()
|
||||
|| params.sandbox_policy.is_some()
|
||||
|| params.permissions.is_some())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
match app_server.thread_settings_update(params).await {
|
||||
Ok(settings_updated) => settings_updated,
|
||||
Err(err) => {
|
||||
|
||||
Reference in new issue
Block a user