mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +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
@@ -6,6 +6,13 @@ use crate::permission_discovery::PermissionDiscovery;
|
||||
pub(super) const VIEW_ID: &str = "permission-profiles";
|
||||
|
||||
impl ChatWidget {
|
||||
pub(crate) fn retain_input_after_failed_permission_selection(&mut self) {
|
||||
self.input_queue.recovered_queue |= self.input_queue.has_queued_follow_up_messages()
|
||||
|| !self.input_queue.pending_steers.is_empty();
|
||||
if let Some(message) = self.initial_user_message.take() {
|
||||
self.restore_user_message_to_composer(message);
|
||||
}
|
||||
}
|
||||
pub(crate) fn request_permission_profiles(&mut self) {
|
||||
self.invalidate_permission_discovery();
|
||||
let request_id = uuid::Uuid::new_v4();
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tui/src/chatwidget/tests/permissions.rs
|
||||
assertion_line: 50
|
||||
assertion_line: 46
|
||||
expression: "render_bottom_popup(&chat, 110)"
|
||||
---
|
||||
Update Model Permissions
|
||||
@@ -14,7 +14,6 @@ expression: "render_bottom_popup(&chat, 110)"
|
||||
requirements.)
|
||||
Read Only (disabled) Codex can read files in the current workspace. Approval is required to edit
|
||||
files or access the internet. (disabled: Disabled by requirements.)
|
||||
server-only (disabled) Description from the connected server. (disabled: Selecting custom profiles
|
||||
from a remote server is not supported yet.)
|
||||
2. server-only Description from the connected server.
|
||||
|
||||
Press enter to confirm or esc to go back
|
||||
@@ -12,7 +12,7 @@ use codex_protocol::permissions::NetworkSandboxPolicy;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[tokio::test]
|
||||
async fn permission_discovery_uses_server_catalog_and_keeps_remote_custom_selection_disabled() {
|
||||
async fn permission_discovery_uses_server_catalog_for_remote_custom_selection() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.config.explicit_permission_profile_mode = false;
|
||||
chat.set_permission_profile_from_session_snapshot(PermissionProfileSnapshot::active(
|
||||
@@ -21,7 +21,6 @@ async fn permission_discovery_uses_server_catalog_and_keeps_remote_custom_select
|
||||
))
|
||||
.unwrap();
|
||||
let mut discovery = Discovery::local(&chat.config);
|
||||
discovery.remote = true;
|
||||
discovery
|
||||
.profiles
|
||||
.push(codex_app_server_protocol::PermissionProfileSummary {
|
||||
@@ -48,9 +47,13 @@ async fn permission_discovery_uses_server_catalog_and_keeps_remote_custom_select
|
||||
"permission_discovery_remote",
|
||||
render_bottom_popup(&chat, /*width*/ 110)
|
||||
);
|
||||
// Server-only alternatives remain visible, but cannot enter the local mutation path.
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Char('5')));
|
||||
assert!(rx.try_recv().is_err());
|
||||
// Server-only alternatives are routed through App rather than resolved locally.
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Char('2')));
|
||||
assert!(matches!(
|
||||
rx.try_recv().expect("server profile selection"),
|
||||
AppEvent::SelectPermissionProfile(PermissionProfileSelection { profile_id, .. })
|
||||
if profile_id == "server-only"
|
||||
));
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::Esc));
|
||||
chat.open_permissions_popup();
|
||||
rx.try_recv().unwrap();
|
||||
|
||||
Reference in new issue
Block a user