Add managed command checkpoints requiring fresh human approval (#58045)

## Why

Managed command policies need to require a human decision independently of automatic review, hook allowances, and saved approvals.

## What changed

- Support `decision = "prompt-user"` in managed `requirements.toml` prefix rules, requiring a fresh, one-time human decision for matching commands.
- Add experimental `humanCommand` approval requests for clients advertising both `experimentalApi` and `requiredHumanApproval`. Accept only `accept`, `decline`, or `cancel`; reject commands when no capable client is available.
- Restrict responses to capable clients that received the request, and replay pending prompts to compatible clients on reconnect.
- Enable the capability in the TUI and update protocol schemas and client bindings.

## Testing

Add coverage for fresh decisions overriding saved allowances, hook allowances, and automatic review, plus child-thread approval routing and rejection of responses from incompatible or unrelated clients.

GitOrigin-RevId: 0b95ff6aab7f8a04b7298c8a4329d1fddf6a603e
This commit is contained in:
jif
2026-10-29 11:23:51 +00:00
committed by copyberry
parent 058e99a3aa
commit 9cc14e7988
70 changed files with 976 additions and 83 deletions
@@ -106,6 +106,7 @@ async fn slow_repairing_chat_listing_keeps_estimate_budget_and_ranks_across_page
pages
});
let remote = RemoteAppServerClient::connect(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::WebSocket {
websocket_url,
auth_token: None,
@@ -48,6 +48,7 @@ async fn remote() -> (RemoteAppServerClient, tokio::task::JoinHandle<()>) {
assert!(socket.next().await.unwrap().unwrap().is_close());
});
let client = RemoteAppServerClient::connect(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::WebSocket {
websocket_url: format!("ws://{address}"),
auth_token: None,
@@ -87,6 +87,7 @@ async fn consumer_roots_include_paginated_archived_descendants_and_keep_missing_
pages
});
let remote = RemoteAppServerClient::connect(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::WebSocket {
websocket_url,
auth_token: None,
@@ -29,6 +29,7 @@ pub(crate) async fn connect(target: &AppServerTarget) -> color_eyre::Result<AppS
codex_uds::validate_private_socket_path(socket_path.as_path())?;
let app_server =
RemoteAppServerClient::connect_local_daemon(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::UnixSocket {
socket_path: AbsolutePathBuf::from_absolute_path_checked(socket_path)?,
},
@@ -65,6 +65,7 @@ async fn experimental_features_rpc_paginates_thread_config_and_bounds_bad_server
page
});
let client = RemoteAppServerClient::connect(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::WebSocket {
websocket_url: url,
auth_token: None,
+2
View File
@@ -527,6 +527,7 @@ async fn connect_remote_app_server(
endpoint: RemoteAppServerEndpoint,
) -> color_eyre::Result<AppServerClient> {
let app_server = RemoteAppServerClient::connect(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint,
client_name: "codex-tui".to_string(),
client_version: env!("CARGO_PKG_VERSION").to_string(),
@@ -741,6 +742,7 @@ where
})
.collect();
let client = start_client(InProcessClientStartArgs {
required_human_approval: true,
arg0_paths,
config: Arc::new(config),
cli_overrides: cli_kv_overrides,
@@ -528,6 +528,7 @@ async fn verifies_name_uniqueness_across_server_pages() -> color_eyre::Result<()
}
});
let client = RemoteAppServerClient::connect(RemoteAppServerConnectArgs {
required_human_approval: true,
endpoint: RemoteAppServerEndpoint::WebSocket {
websocket_url: url,
auth_token: None,
+1
View File
@@ -1285,6 +1285,7 @@ mod tests {
.unwrap();
let mut auth_config = config.auth_config();
let client = InProcessAppServerClient::start(InProcessClientStartArgs {
required_human_approval: true,
arg0_paths: Arg0DispatchPaths::default(),
config: Arc::new(config),
cli_overrides: Vec::new(),