From fa517810f7ba9a06617ad899f389f61a4b80e217 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:33:11 +0100 Subject: [PATCH 1/4] test(agents): make the render cancellation test deterministic (#12447) Fix the test: raise an explicit RuntimeError if the wait loop times out instead of proceeding silently and canceling, which led to missing kills on a slow test runner. Failed 0 times tests/unit/agents/runtime/test_render.py . [100%] All checks passed! Success: no issues found in 155 source files Root cause: (a) was real. --- *PR created automatically by Jules for task [10737278039709828868](https://jules.google.com/task/10737278039709828868) started by @MarkusNeusinger* --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- tests/unit/agents/runtime/test_render.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/agents/runtime/test_render.py b/tests/unit/agents/runtime/test_render.py index b8ae25ec22..81a09750c5 100644 --- a/tests/unit/agents/runtime/test_render.py +++ b/tests/unit/agents/runtime/test_render.py @@ -866,10 +866,12 @@ async def test_local_backend_kills_the_container_on_cancellation(self, tmp_path: task = asyncio.create_task(backend.render(job(job_id="cancelme"))) # Cancel once both theme containers run: a fixed sleep lost the race on a loaded CI runner. - for _ in range(200): + for _ in range(500): if started.exists() and len(started.read_text().split()) == 2: break await asyncio.sleep(0.05) + else: + raise RuntimeError("Timed out waiting for containers to start") task.cancel() with pytest.raises(asyncio.CancelledError): await task From 7552db6813006a05351c491fe20a1e04e519cd99 Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:34:13 +0100 Subject: [PATCH 2/4] docs(changelog): render cancellation test waits longer and fails clearly Co-Authored-By: Claude Opus 5.5 --- changelog.d/render-cancel-test-wait.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog.d/render-cancel-test-wait.md diff --git a/changelog.d/render-cancel-test-wait.md b/changelog.d/render-cancel-test-wait.md new file mode 100644 index 0000000000..3134476605 --- /dev/null +++ b/changelog.d/render-cancel-test-wait.md @@ -0,0 +1,8 @@ +### Fixed + +- **Render cancellation test waits longer and fails clearly.** + `test_local_backend_kills_the_container_on_cancellation` waited at most 10 s + for both fake theme containers and then cancelled anyway, so a loaded runner + could fail with a misleading "only one container killed" assertion. It now + waits up to 25 s and raises a clear timeout error when the containers never + start. Written by Google Jules; the race could not be reproduced locally. From 431e6963ad2e7a71948a64b488b0fbd76fbf8ffc Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:34:32 +0100 Subject: [PATCH 3/4] docs(changelog): reference #12449 Co-Authored-By: Claude Opus 5.5 --- changelog.d/render-cancel-test-wait.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.d/render-cancel-test-wait.md b/changelog.d/render-cancel-test-wait.md index 3134476605..1b92f0aa00 100644 --- a/changelog.d/render-cancel-test-wait.md +++ b/changelog.d/render-cancel-test-wait.md @@ -6,3 +6,4 @@ could fail with a misleading "only one container killed" assertion. It now waits up to 25 s and raises a clear timeout error when the containers never start. Written by Google Jules; the race could not be reproduced locally. + (#12449) From 52d1887a5cc02d116650cc89c0cb060847295aa7 Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:50:17 +0100 Subject: [PATCH 4/4] test(agents): cancel the render task before raising the timeout Copilot review of #12449: on the timeout path the render task and its fake containers were left to event-loop teardown. Co-Authored-By: Claude Opus 5.5 --- tests/unit/agents/runtime/test_render.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/agents/runtime/test_render.py b/tests/unit/agents/runtime/test_render.py index 81a09750c5..f1257a3810 100644 --- a/tests/unit/agents/runtime/test_render.py +++ b/tests/unit/agents/runtime/test_render.py @@ -871,6 +871,9 @@ async def test_local_backend_kills_the_container_on_cancellation(self, tmp_path: break await asyncio.sleep(0.05) else: + # Do not leave the render task and its fake containers to event-loop teardown. + task.cancel() + await asyncio.gather(task, return_exceptions=True) raise RuntimeError("Timed out waiting for containers to start") task.cancel() with pytest.raises(asyncio.CancelledError):