Skip to content

Commit 37af94b

Browse files
authored
test(gpui): wait for the removed agent's turn to end in the clean test (#43)
a_failed_idle_terminal_clean_neither_ends_the_shared_server_nor_blocks_ the_agents_return removed the second agent as soon as its reply was published. The turn publishes before it ends, so the removal could land while the turn was still finishing. The agent then aborted the turn rather than stopping, and the aborted turn's failed terminal clean closed the shared server by design, failing the ended == 0 assertion. It failed in about 1 in 30 local runs and more often in CI. Wait for the agent to report Idle before failing the clean and removing it, as does_not_clean_after_the_last_agent_closes_the_server does, so the test exercises the stop path it is named for. Signed-off-by: Tee8z <[email protected]>
1 parent 31554c4 commit 37af94b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • apps/buzz-gpui/crates/app/src/agent_plugins/codex/runtime

‎apps/buzz-gpui/crates/app/src/agent_plugins/codex/runtime/tests.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,16 @@ async fn a_failed_idle_terminal_clean_neither_ends_the_shared_server_nor_blocks_
20422042
let thread = f.thread_of(1);
20432043
f.complete_turn(1, "SERVER RUNNING").await;
20442044
until(|| locked(&other.published).len() == 1).await;
2045+
// The turn publishes before it ends. Removed before then, the agent
2046+
// aborts the turn instead, and that turn's failed clean closes the
2047+
// server, so wait for the turn to end.
2048+
until(|| {
2049+
f.runtime
2050+
.sessions(&"9".repeat(64))
2051+
.first()
2052+
.is_some_and(|view| view.status == "Idle")
2053+
})
2054+
.await;
20452055
f.fake.state().errors.insert(
20462056
"thread/backgroundTerminals/clean".into(),
20472057
"thread/backgroundTerminals/clean failed".into(),

0 commit comments

Comments
 (0)