Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Ignore stale refresh responses in agents overview tests (#51064)

jifc8949e55c28a
diff --git a/codex-rs/tui/src/app/agents_overview_actions_tests.rs b/codex-rs/tui/src/app/agents_overview_actions_tests.rs
index 411e95359b..fa9cc71619 100644
--- a/codex-rs/tui/src/app/agents_overview_actions_tests.rs
+++ b/codex-rs/tui/src/app/agents_overview_actions_tests.rs
@@ -957,6 +957,18 @@ async fn lifecycle_removes_background_and_current_tasks_without_losing_the_dashb
// Canceling pagination must allow automatic refill to finish after removing the last task.
app.agents_overview.initialized = true;
app.agents_overview.view_state.lock().unwrap().loading = true;
+ // An invalidated refresh can already be queued when the lifecycle action
+ // aborts its task. It must not satisfy the wait for the replacement refresh.
+ app.app_event_tx
+ .send(AppEvent::AgentsOverviewThreadsLoaded {
+ request_id,
+ result: Ok(AgentsOverviewThreadRefresh {
+ threads: HashMap::new(),
+ last_messages: HashMap::new(),
+ recent_seed_complete: true,
+ discovery: None,
+ }),
+ });
Box::pin(app.handle_event(&mut tui, &mut app_server, confirmed)).await?;
if app.agents_overview.request_id.is_some() {
finish_overview_refresh(&mut app, &app_server, &mut rx).await;
diff --git a/codex-rs/tui/src/app/agents_overview_tests.rs b/codex-rs/tui/src/app/agents_overview_tests.rs
index 0afbb43ae3..7ed35541cc 100644
--- a/codex-rs/tui/src/app/agents_overview_tests.rs
+++ b/codex-rs/tui/src/app/agents_overview_tests.rs
@@ -664,6 +664,10 @@ async fn finish_overview_refresh(
if let AppEvent::AgentsOverviewThreadsLoaded { request_id, result } =
events.recv().await.expect("overview event")
{
+ // Aborting a refresh task cannot retract an already queued response.
+ if app.agents_overview.request_id != Some(request_id) {
+ continue;
+ }
assert!(result.is_ok(), "{result:?}");
app.apply_agents_overview_thread_refresh(app_server, request_id, result);
return;