mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Show strict review warnings in the TUI (#39635)
## What changed - Render `StrictReviewRequired` notifications as warning history cells that explain tool calls may take extra time. - Preserve the active command and task-running state when the notification arrives. ## Testing - Add a TUI snapshot test covering the warning and continued command output. GitOrigin-RevId: bf01b612a22b537b247b6df6818080fc73b5414d
This commit is contained in:
1 parent
7ea7b29369
commit
7edd0a4c9d
3 files changed
+48
-1
No files matched your search
@@ -161,6 +161,15 @@ impl ChatWidget {
|
|||||||
self.on_warning(notification.message);
|
self.on_warning(notification.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ServerNotification::StrictReviewRequired(_) => {
|
||||||
|
self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
|
||||||
|
history_cell::new_warning_event(
|
||||||
|
"This request requires additional safety checks, some tool calls might take extra time"
|
||||||
|
.to_string(),
|
||||||
|
),
|
||||||
|
)));
|
||||||
|
self.request_redraw();
|
||||||
|
}
|
||||||
ServerNotification::DeprecationNotice(notification) => {
|
ServerNotification::DeprecationNotice(notification) => {
|
||||||
self.on_deprecation_notice(notification.summary, notification.details)
|
self.on_deprecation_notice(notification.summary, notification.details)
|
||||||
}
|
}
|
||||||
@@ -208,7 +217,6 @@ impl ChatWidget {
|
|||||||
| ServerNotification::ThreadArchived(_)
|
| ServerNotification::ThreadArchived(_)
|
||||||
| ServerNotification::ThreadDeleted(_)
|
| ServerNotification::ThreadDeleted(_)
|
||||||
| ServerNotification::ThreadUnarchived(_)
|
| ServerNotification::ThreadUnarchived(_)
|
||||||
| ServerNotification::StrictReviewRequired(_)
|
|
||||||
| ServerNotification::RawResponseItemCompleted(_)
|
| ServerNotification::RawResponseItemCompleted(_)
|
||||||
| ServerNotification::RawResponseCompleted(_)
|
| ServerNotification::RawResponseCompleted(_)
|
||||||
| ServerNotification::CommandExecOutputDelta(_)
|
| ServerNotification::CommandExecOutputDelta(_)
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: tui/src/chatwidget/tests/app_server.rs
|
||||||
|
expression: "lines_to_single_string(&cells[0])"
|
||||||
|
---
|
||||||
|
⚠ This request requires additional safety checks, some tool calls might take
|
||||||
|
extra time
|
||||||
@@ -751,6 +751,39 @@ async fn live_app_server_guardian_warning_notification_renders_message() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn live_app_server_strict_review_required_notification_renders_message() {
|
||||||
|
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||||
|
handle_turn_started(&mut chat, "turn-1");
|
||||||
|
begin_exec(&mut chat, "cmd-1", "printf 'streamed output\\n'");
|
||||||
|
drain_insert_history(&mut rx);
|
||||||
|
|
||||||
|
chat.handle_server_notification(
|
||||||
|
ServerNotification::StrictReviewRequired(
|
||||||
|
codex_app_server_protocol::StrictReviewRequiredNotification {
|
||||||
|
thread_id: "thread-1".to_string(),
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
started_at_ms: 1_000,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
/*replay_kind*/ None,
|
||||||
|
);
|
||||||
|
|
||||||
|
let cells = drain_insert_history(&mut rx);
|
||||||
|
assert_eq!(cells.len(), 1, "expected one warning history cell");
|
||||||
|
assert_chatwidget_snapshot!("strict_review_required", lines_to_single_string(&cells[0]));
|
||||||
|
chat.on_exec_command_output_delta("cmd-1", "streamed output\n");
|
||||||
|
assert!(
|
||||||
|
lines_to_single_string(
|
||||||
|
&chat
|
||||||
|
.active_cell_transcript_lines(/*width*/ 80)
|
||||||
|
.expect("strict review should preserve the active command")
|
||||||
|
)
|
||||||
|
.contains("streamed output")
|
||||||
|
);
|
||||||
|
assert!(chat.bottom_pane.is_task_running());
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn live_app_server_config_warning_prefixes_summary() {
|
async fn live_app_server_config_warning_prefixes_summary() {
|
||||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||||
|
|||||||
Reference in new issue
Block a user