mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Remove the Plan mode composer nudge (#40200)
## What changed - Keep the normal composer footer visible when a draft contains the word `plan`. - Remove the contextual “Create a plan?” prompt, its Escape dismissal behavior, and its per-thread dismissal state. ## Testing - Update wide and narrow composer snapshots to cover the standard footer for plan-related drafts. GitOrigin-RevId: 1a3c8cfce9d4effa2149790975133f652aa7c914
This commit is contained in:
1 parent
4582c0a498
commit
83d1fe0e67
14 files changed
+22
-295
No files matched your search
@@ -1,12 +1,6 @@
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
fn set_composer_text(chat: &mut ChatWidget, text: &str) {
|
||||
chat.bottom_pane
|
||||
.set_composer_text(text.to_string(), Vec::new(), Vec::new());
|
||||
chat.refresh_plan_mode_nudge();
|
||||
}
|
||||
|
||||
fn paste_hidden_plan_shell_payload(chat: &mut ChatWidget) -> String {
|
||||
let payload = format!("!echo {}", "x".repeat(1000));
|
||||
chat.bottom_pane
|
||||
@@ -68,125 +62,32 @@ fn assert_literal_plan_prompt(chat: &ChatWidget, op: Result<Op, TryRecvError>, p
|
||||
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Plan);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plan_mode_nudge_matches_only_standalone_plain_text_keyword() {
|
||||
assert!(contains_plan_keyword("plan"));
|
||||
assert!(contains_plan_keyword("Make a Plan first."));
|
||||
assert!(!contains_plan_keyword("plane"));
|
||||
assert!(!contains_plan_keyword("planning"));
|
||||
assert!(contains_plan_keyword("/plan"));
|
||||
assert!(contains_plan_keyword("!plan"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_mode_nudge_shows_only_for_eligible_default_mode_drafts() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
chat.pre_draw_tick();
|
||||
assert!(chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
set_composer_text(&mut chat, "/plan");
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
set_composer_text(&mut chat, "!plan");
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
let plan_mask = collaboration_modes::plan_mask(chat.model_catalog.as_ref())
|
||||
.expect("expected plan collaboration mode");
|
||||
chat.set_collaboration_mask(plan_mask);
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_mode_nudge_hides_while_task_or_modal_is_active() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
chat.pre_draw_tick();
|
||||
assert!(chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.on_task_started();
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.on_task_complete(
|
||||
/*last_agent_message*/ None, /*duration_ms*/ None, /*from_replay*/ false,
|
||||
);
|
||||
chat.show_selection_view(SelectionViewParams {
|
||||
items: vec![SelectionItem {
|
||||
name: "Keep planning".to_string(),
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
});
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_mode_nudge_dismissal_is_scoped_to_current_thread() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
let first_thread = ThreadId::new();
|
||||
let second_thread = ThreadId::new();
|
||||
chat.thread_id = Some(first_thread);
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
chat.pre_draw_tick();
|
||||
assert!(chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.thread_id = Some(second_thread);
|
||||
chat.pre_draw_tick();
|
||||
assert!(chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.thread_id = Some(first_thread);
|
||||
chat.pre_draw_tick();
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_mode_nudge_shift_tab_uses_existing_mode_cycle_path() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
chat.pre_draw_tick();
|
||||
assert!(chat.bottom_pane.plan_mode_nudge_visible());
|
||||
|
||||
chat.handle_key_event(KeyEvent::from(KeyCode::BackTab));
|
||||
chat.pre_draw_tick();
|
||||
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Plan);
|
||||
assert!(!chat.bottom_pane.plan_mode_nudge_visible());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_mode_nudge_snapshot() {
|
||||
async fn plan_draft_footer_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
chat.set_token_info(Some(make_token_info(
|
||||
/*total_tokens*/ 50_000, /*context_window*/ 100_000,
|
||||
)));
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
chat.pre_draw_tick();
|
||||
|
||||
assert_chatwidget_snapshot!("plan_mode_nudge", render_bottom_popup(&chat, /*width*/ 80));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_mode_nudge_narrow_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
set_composer_text(&mut chat, "make a plan");
|
||||
chat.bottom_pane
|
||||
.set_composer_text("make a plan".to_string(), Vec::new(), Vec::new());
|
||||
chat.pre_draw_tick();
|
||||
|
||||
assert_chatwidget_snapshot!(
|
||||
"plan_mode_nudge_narrow",
|
||||
render_bottom_popup(&chat, /*width*/ 36)
|
||||
"plan_draft_footer",
|
||||
normalize_snapshot_paths(render_bottom_popup(&chat, /*width*/ 80))
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plan_draft_footer_narrow_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5")).await;
|
||||
chat.bottom_pane
|
||||
.set_composer_text("make a plan".to_string(), Vec::new(), Vec::new());
|
||||
chat.pre_draw_tick();
|
||||
|
||||
assert_chatwidget_snapshot!(
|
||||
"plan_draft_footer_narrow",
|
||||
normalize_snapshot_paths(render_bottom_popup(&chat, /*width*/ 36))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user