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
@@ -260,6 +260,17 @@ fn oversized_read_pages_preserve_turns_and_pagination() {
|
||||
|
||||
#[test]
|
||||
fn delegated_prompts_match_desktop_xml_contract() {
|
||||
let output = FunctionCallOutputBody::Text(delegated_prompt("thread-1", "Check status"));
|
||||
for namespace in ["codex_tui", "codex_app"] {
|
||||
assert_eq!(
|
||||
parse_delegated_tool_output("send_message_to_thread", Some(namespace), &output),
|
||||
Some(("thread-1".to_string(), "Check status".to_string()))
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
parse_delegated_tool_output("send_message_to_thread", Some("untrusted"), &output),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
delegated_prompt("thread-1", "Check <main> & report > status"),
|
||||
"<codex_delegation>\n <source_thread_id>thread-1</source_thread_id>\n <input>Check <main> & report > status</input>\n</codex_delegation>"
|
||||
@@ -296,7 +307,9 @@ fn activity_metadata_is_retained_without_including_outputs() -> color_eyre::Resu
|
||||
{"type": "sleep", "id": "sleep-1", "durationMs": 1000},
|
||||
{"type": "imageGeneration", "id": "image-1", "status": "completed",
|
||||
"revisedPrompt": "a cat", "result": "image bytes"},
|
||||
{"type": "enteredReviewMode", "id": "review-1", "review": "review changes"}
|
||||
{"type": "enteredReviewMode", "id": "review-1", "review": "review changes"},
|
||||
{"type": "functionCallOutput", "id": "delegation-1", "name": "send_message_to_thread",
|
||||
"namespace": "codex_tui", "output": delegated_prompt("source-2", "Follow <up> & report")}
|
||||
]
|
||||
}))?;
|
||||
|
||||
@@ -320,7 +333,11 @@ fn activity_metadata_is_retained_without_including_outputs() -> color_eyre::Resu
|
||||
{"type": "sleep", "id": "sleep-1", "durationMs": 1000},
|
||||
{"type": "imageGeneration", "id": "image-1", "status": "completed",
|
||||
"revisedPrompt": "a cat", "savedPath": null},
|
||||
{"type": "enteredReviewMode", "id": "review-1", "review": "review changes"}
|
||||
{"type": "enteredReviewMode", "id": "review-1", "review": "review changes"},
|
||||
{"type": "functionCallOutput", "id": "delegation-1", "name": "send_message_to_thread",
|
||||
"namespace": "codex_tui", "codexDelegation": {
|
||||
"sourceThreadId": "source-2", "input": "Follow <up> & report"
|
||||
}}
|
||||
])
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user