You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(test): the process-group timeout test waits for its grandchild to start, not for 0.6 seconds #1888
tests/test_process.py::test_run_subprocess_async_timeout_kills_process_group fails when the machine is busy. The test starts a Python process with run_subprocess_async(cmd, timeout=0.6). That process must start, start a second Python process and write the pid file before 0.6 seconds pass. On a busy machine the timeout fires first. The pid file does not exist, and the test fails at assert pid_file.exists().
Evidence
The failure happened in the pre-push gate (devops ci) on 2026-10-22. Result: 1 failed, 11357 passed, 1 skipped in 595 seconds.
Three gates and two targeted test runs ran at the same time on one machine.
The failing line is tests/test_process.py:208. The test passes on a quiet machine.
A search of tests/ finds one more timeout=0.6-style race around a real child process. The other short timeouts (timeout=0.01 at tests/test_process.py:113 and timeout=0.1 at tests/test_host_sandbox.py:516) expect the timeout, so they do not race.
Remedy
The test must not depend on a wall-clock deadline for the child to start. The timeout path must fire only after the pid file exists. Choose a design that is deterministic. For example, run the command with a long bound and let the test cause the timeout after it sees the pid file. The test must still prove that the timeout kills the grandchild, and it must still run in under one second on a quiet machine. A new test of the fix must fail on a busy machine before the change. A stress run with many parallel CPU tasks can show this.
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
Type: type/test. The candidate is about fixing a test that fails under load.
Priority: P2-Medium. The issue affects test reliability but does not break functionality. The failed run 1664 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 on the board.
Value: Medium. Improves test stability and reliability for CI environments.
Effort: Low. The fix involves adjusting the test logic to wait for a condition rather than using a fixed timeout.
Cause: test_run_subprocess_async_timeout_kills_process_group gave a Python child 0.6 s to start, start a second Python process and write a pid file. On a busy host the timeout fired first, and the test failed at assert pid_file.exists(). It failed in a pre-push gate on 2026-10-22. Under a stress of six busy loops on one core, the old test text failed in 15 of 15 runs. The production code has no defect.
Change: run_subprocess_async waits with asyncio.wait_for(proc.communicate(), timeout), so its timeout counts from when it starts to wait for its child. The test now replaces asyncio.create_subprocess_exec with a wrapper that returns only once the child has written its pids. The timeout is then STARTED_RUN_TIMEOUT_SECONDS = 0.2. The child hangs, so the timeout always fires, and it fires after the child and the grandchild exist. The test uses hung_with_grandchild and watching from tests/support/hung_children.py in place of a hand-written script and os.kill(pid, 0). The task file docs/agent/tasks/task-1888-process-group-timeout-waits-for-the-child.md and the fragment changelog.d/1888.md are included. Only tests/test_process.py changes.
Existing tool considered: tests/support/hung_children.py and tests/support/waits.py cover the child and the waits. time-machine moves time.time() but not loop.time() or time.monotonic(). A virtual-clock library such as aiotools is a new dependency, so I did not use one. A first design with a jump of the loop…
Activity
dan-petty commentedon Oct 22, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate is about fixing a test that fails under load.The issue affects test reliability but does not break functionality.The failed run 1664 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 on the board.Improves test stability and reliability for CI environments.The fix involves adjusting the test logic to wait for a condition rather than using a fixed timeout.fix(test): the process-group timeout test starts its timeout after th…
dan-petty commentedon Oct 22, 2026
What changed
#1897, merged into
release/v0.2.39as bfe20ee.3 file(s) changed.
How it was verified
Check runs at d0333fc:
Acceptance Criteria of
docs/agent/tasks/task-1888-process-group-timeout-waits-for-the-child.md:run_subprocess_asyncstill fires and still stops the whole group: the test fails when the stop kills only the leader.uv run devops ci test tests/test_process.pypasses.feat(release): v0.2.39 (#1947)
fix(tests): twelve tests still assert elapsed wall-clock time, and no…