mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Scope TUI approval requests to their threads (#39372)
## Why Approval and item IDs can collide across concurrent threads. Tracking pending app-server approvals by ID alone can therefore resolve, submit, or dismiss a request from the wrong thread. ## What changed - Key command execution, file change, and permissions approvals by both thread ID and approval ID. - Route approval responses through the originating thread and require the thread to match when processing resolution notifications or dismissing approval prompts. - Canonicalize parseable thread IDs so equivalent UUID representations still match. ## Testing - Cover colliding approval IDs across threads, mismatched resolution notifications, prompt dismissal, and response routing for primary and background threads. GitOrigin-RevId: c2d899a1e4b6a6413c78a0595a5311f5fabb9815
This commit is contained in:
1 parent
fde2156057
commit
8843960ba0
9 files changed
+358
-125
No files matched your search
@@ -64,7 +64,7 @@ fn take_backfill_counts(requests: &RecordedRequests) -> (usize, usize) {
|
||||
}
|
||||
|
||||
/// Starts an embedded app server behind a loopback WebSocket proxy that records JSON-RPC methods.
|
||||
async fn start_recording_app_server(
|
||||
pub(super) async fn start_recording_app_server(
|
||||
config: &Config,
|
||||
blocked_thread_list: Option<(ThreadId, oneshot::Sender<()>, oneshot::Receiver<()>)>,
|
||||
failed_thread_name: Option<&'static str>,
|
||||
@@ -255,7 +255,18 @@ async fn start_recording_app_server_with_history(
|
||||
)?)
|
||||
.await?;
|
||||
}
|
||||
JSONRPCMessage::Response(_) | JSONRPCMessage::Error(_) => {}
|
||||
JSONRPCMessage::Response(response) => {
|
||||
request_sink
|
||||
.lock()
|
||||
.expect("request recorder lock")
|
||||
.push(JSONRPCRequest {
|
||||
id: response.id,
|
||||
method: "server/request/response".to_string(),
|
||||
params: Some(response.result),
|
||||
trace: None,
|
||||
});
|
||||
}
|
||||
JSONRPCMessage::Error(_) => {}
|
||||
}
|
||||
}
|
||||
embedded.shutdown().await?;
|
||||
|
||||
Reference in new issue
Block a user