From 9588f660be876e3d3cab52d7fce80f0cb61d0d70 Mon Sep 17 00:00:00 2001 From: jif Date: Thu, 30 Jul 2026 11:36:21 +0000 Subject: [PATCH] Bound the code mode output termination test (#36139) ## What changed Update the code mode yield and termination integration test to generate a bounded output backlog, then wait on a file-backed gate until the session is terminated. Remove the timeout that previously guarded submission of the infinite-loop workload. GitOrigin-RevId: dd48307f18ab12bfbf02dc26b0f3715f073402a7 --- codex-rs/core/tests/suite/code_mode.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/codex-rs/core/tests/suite/code_mode.rs b/codex-rs/core/tests/suite/code_mode.rs index d34085cc2e..e2ad59b171 100644 --- a/codex-rs/core/tests/suite/code_mode.rs +++ b/codex-rs/core/tests/suite/code_mode.rs @@ -1755,21 +1755,25 @@ async fn code_mode_yield_and_termination_are_not_starved_by_runtime_output() -> let _ = config.features.enable(Feature::CodeMode); }); let test = builder.build(&server).await?; + let termination_gate = test.workspace_path("code-mode-output-termination.ready"); + let termination_wait = wait_for_file_source(&termination_gate)?; // Exact controller arbitration is covered by deterministic code-mode contract tests. Keep // this end-to-end load bounded while exercising a substantial runtime output backlog. - let code = r#"// @exec: {"yield_time_ms": 0, "max_output_tokens": 16} -for (let index = 0; index < 16_384; index++) { - text(`event ${index}`); -} -while (true) {} -"#; + let code = format!( + r#"// @exec: {{"yield_time_ms": 0, "max_output_tokens": 16}} +for (let index = 0; index < 256; index++) {{ + text(`event ${{index}}`); +}} +{termination_wait} +"# + ); responses::mount_sse_once( &server, sse(vec![ ev_response_created("resp-1"), - ev_custom_tool_call("call-1", "exec", code), + ev_custom_tool_call("call-1", "exec", &code), ev_completed("resp-1"), ]), ) @@ -1783,11 +1787,7 @@ while (true) {} ) .await; - tokio::time::timeout( - Duration::from_secs(5), - test.submit_turn("start the busy loop"), - ) - .await??; + test.submit_turn("start the bounded output backlog").await?; let first_request = first_completion.single_request(); let first_items = custom_tool_output_items(&first_request, "call-1");