mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve tool authority for TUI delegation prompts (#41046)
## Why Delegated prompts should retain the authority of the TUI tool that sent them instead of being recorded as user input. ## What changed - Start delegated `create_thread` and `send_message_to_thread` turns with a namespaced tool output and an empty user input list. - Recognize delegated outputs from trusted Codex namespaces when building activity summaries. - Render replayed delegation outputs in history and transcripts with their source task attribution, without adding them to composer history. ## Testing - Cover turn request encoding, namespace filtering, activity summaries, and replayed history/transcript rendering. GitOrigin-RevId: aeb2f5c8ad2f2a898c80e8fc791ed879a0ab655d
This commit is contained in:
1 parent
57e2edc6e9
commit
72c96598c6
7 files changed
+180
-22
No files matched your search
@@ -1284,14 +1284,18 @@ async fn dynamic_tool_requests_ignore_other_namespaces_and_dispatch_tui_namespac
|
||||
let turn = recorded_params(&requests, "turn/start")
|
||||
.pop()
|
||||
.expect("background task turn request");
|
||||
assert_eq!(turn["input"], serde_json::json!([]));
|
||||
assert_eq!(
|
||||
turn["input"][0]["text"],
|
||||
format!(
|
||||
"<codex_delegation>\n <source_thread_id>{creation_source}</source_thread_id>\n <input>Check <main> & report</input>\n</codex_delegation>"
|
||||
)
|
||||
turn["toolOutput"],
|
||||
serde_json::json!({
|
||||
"name": "create_thread",
|
||||
"namespace": "codex_tui",
|
||||
"output": format!(
|
||||
"<codex_delegation>\n <source_thread_id>{creation_source}</source_thread_id>\n <input>Check <main> & report</input>\n</codex_delegation>"
|
||||
)
|
||||
})
|
||||
);
|
||||
assert_eq!(turn["sandboxPolicy"], source_sandbox);
|
||||
|
||||
app.handle_app_server_event(
|
||||
&app_server,
|
||||
codex_app_server_client::AppServerEvent::ServerRequest(Box::new(exec_approval_request(
|
||||
@@ -1353,11 +1357,17 @@ async fn dynamic_tool_requests_ignore_other_namespaces_and_dispatch_tui_namespac
|
||||
panic!("expected a follow-up task completion event")
|
||||
};
|
||||
assert!(response.success, "{response:?}");
|
||||
let turn = &recorded_params(&requests, "turn/start")[1];
|
||||
assert_eq!(turn["input"], serde_json::json!([]));
|
||||
assert_eq!(
|
||||
recorded_params(&requests, "turn/start")[1]["input"][0]["text"],
|
||||
format!(
|
||||
"<codex_delegation>\n <source_thread_id>{thread_id}</source_thread_id>\n <input>Follow <up> & report</input>\n</codex_delegation>"
|
||||
)
|
||||
turn["toolOutput"],
|
||||
serde_json::json!({
|
||||
"name": "send_message_to_thread",
|
||||
"namespace": "codex_tui",
|
||||
"output": format!(
|
||||
"<codex_delegation>\n <source_thread_id>{thread_id}</source_thread_id>\n <input>Follow <up> & report</input>\n</codex_delegation>"
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
app.dynamic_tool_tasks.insert(
|
||||
|
||||
Reference in new issue
Block a user