Skip to content

Commit df3969c

Browse files
Wait for asynchronous release command before checking child retirement
1 parent 21f29bb commit df3969c

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

‎tests/test_native_settled_fork.py‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,25 @@ async def test_fork_refuses_idle_child_terminal_until_current_environment_retire
557557
await (await source.submit("Retire the child's process")).get_result()
558558
).final_output == ("root complete")
559559
output = tool_output(peer.requests[-1], "release-child")
560-
assert "child finished" in output and "Process exited with code 0" in output
560+
output_parts = [output]
561+
for attempt in range(10):
562+
running = re.search(r"Process running with session ID (\d+)", output)
563+
if running is None:
564+
break
565+
# Poll the release command; do not start it again.
566+
call_id = f"poll-release-child-{attempt}"
567+
peer.action = function_call(
568+
"write_stdin",
569+
{"session_id": int(running[1]), "chars": "", "yield_time_ms": 1000},
570+
call_id,
571+
)
572+
assert (
573+
await (await source.submit("Wait for the release command")).get_result()
574+
).final_output == "root complete"
575+
output = tool_output(peer.requests[-1], call_id)
576+
output_parts.append(output)
577+
assert "child finished" in "".join(output_parts)
578+
assert "Process exited with code 0" in output
561579
# Retiring the process does not make a descendant graph copyable.
562580
before = len(executor.requests)
563581
model_requests = (len(peer.requests), len(peer.child_requests["alpha"]))

0 commit comments

Comments
 (0)