mirror of
https://github.com/openai/codex.git
synced 2026-04-24 06:35:50 +00:00
codex: fix blob-size-policy on PR #16282
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
//! the TUI output. Many assertions are snapshot-based so that layout regressions and status/header
|
||||
//! changes show up as stable, reviewable diffs.
|
||||
|
||||
mod jobs;
|
||||
|
||||
use super::*;
|
||||
use crate::app_event::AppEvent;
|
||||
use crate::app_event::ExitMode;
|
||||
@@ -68,8 +70,6 @@ use codex_app_server_protocol::ServerNotification;
|
||||
use codex_app_server_protocol::SkillSummary;
|
||||
use codex_app_server_protocol::ThreadClosedNotification;
|
||||
use codex_app_server_protocol::ThreadItem as AppServerThreadItem;
|
||||
use codex_app_server_protocol::ThreadJob;
|
||||
use codex_app_server_protocol::ThreadJobFiredNotification;
|
||||
use codex_app_server_protocol::Turn as AppServerTurn;
|
||||
use codex_app_server_protocol::TurnCompletedNotification;
|
||||
use codex_app_server_protocol::TurnError as AppServerTurnError;
|
||||
@@ -11772,53 +11772,6 @@ async fn app_server_mcp_startup_failure_renders_warning_history() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_job_fired_renders_prompt_history() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
chat.handle_server_notification(
|
||||
ServerNotification::ThreadJobFired(ThreadJobFiredNotification {
|
||||
thread_id: ThreadId::new().to_string(),
|
||||
job: ThreadJob {
|
||||
id: "job-1".to_string(),
|
||||
cron_expression: "@after-turn".to_string(),
|
||||
prompt: "Give me a random animal name.".to_string(),
|
||||
run_once: false,
|
||||
created_at: 0,
|
||||
next_run_at: None,
|
||||
last_run_at: None,
|
||||
},
|
||||
}),
|
||||
/*replay_kind*/ None,
|
||||
);
|
||||
|
||||
let cells = drain_insert_history(&mut rx);
|
||||
let rendered = lines_to_single_string(&cells[0]);
|
||||
assert_snapshot!(rendered, @"• Give me a random animal name. Running thread job • @after-turn
|
||||
");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_jobs_popup_keeps_selected_job_prompt_visible() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
chat.open_thread_jobs_popup(
|
||||
ThreadId::new(),
|
||||
vec![ThreadJob {
|
||||
id: "job-1".to_string(),
|
||||
cron_expression: "@after-turn".to_string(),
|
||||
prompt: "Give me a random animal name.".to_string(),
|
||||
run_once: false,
|
||||
created_at: 0,
|
||||
next_run_at: None,
|
||||
last_run_at: None,
|
||||
}],
|
||||
);
|
||||
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 80);
|
||||
assert_snapshot!("thread_jobs_popup_keeps_selected_job_prompt_visible", popup);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn app_server_mcp_startup_lag_settles_startup_and_ignores_late_updates() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
51
codex-rs/tui/src/chatwidget/tests/jobs.rs
Normal file
51
codex-rs/tui/src/chatwidget/tests/jobs.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
use super::*;
|
||||
use codex_app_server_protocol::ThreadJob;
|
||||
use codex_app_server_protocol::ThreadJobFiredNotification;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_job_fired_renders_prompt_history() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
chat.handle_server_notification(
|
||||
ServerNotification::ThreadJobFired(ThreadJobFiredNotification {
|
||||
thread_id: ThreadId::new().to_string(),
|
||||
job: ThreadJob {
|
||||
id: "job-1".to_string(),
|
||||
cron_expression: "@after-turn".to_string(),
|
||||
prompt: "Give me a random animal name.".to_string(),
|
||||
run_once: false,
|
||||
created_at: 0,
|
||||
next_run_at: None,
|
||||
last_run_at: None,
|
||||
},
|
||||
}),
|
||||
/*replay_kind*/ None,
|
||||
);
|
||||
|
||||
let cells = drain_insert_history(&mut rx);
|
||||
let rendered = lines_to_single_string(&cells[0]);
|
||||
assert_snapshot!(rendered, @"• Give me a random animal name. Running thread job • @after-turn
|
||||
");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_jobs_popup_keeps_selected_job_prompt_visible() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
chat.open_thread_jobs_popup(
|
||||
ThreadId::new(),
|
||||
vec![ThreadJob {
|
||||
id: "job-1".to_string(),
|
||||
cron_expression: "@after-turn".to_string(),
|
||||
prompt: "Give me a random animal name.".to_string(),
|
||||
run_once: false,
|
||||
created_at: 0,
|
||||
next_run_at: None,
|
||||
last_run_at: None,
|
||||
}],
|
||||
);
|
||||
|
||||
let popup = render_bottom_popup(&chat, /*width*/ 80);
|
||||
assert_snapshot!("thread_jobs_popup_keeps_selected_job_prompt_visible", popup);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/chatwidget/tests.rs
|
||||
source: tui/src/chatwidget/tests/jobs.rs
|
||||
expression: popup
|
||||
---
|
||||
Thread jobs
|
||||
Reference in New Issue
Block a user