Repository navigation
Tests wait for real state instead of short fixed deadlines - #53
Merged
Merged
Conversation
CI on the 0.17.1 merge commit failed six times in a row, each time on a timing test (four parallel workers per Linux job). Each wait either gave up after a few seconds or read state that the code under test had not finished producing yet. The fixes keep every assertion and change only how the tests wait: - Waits that return as soon as their state appears now have generous bounds, because the bound only limits a failure: the bots crash fixtures (a child process imports the engine first) and the live TUI tests (synthetic key streams are parsed on a background thread). The crash fixtures also stop at once if their child process exits. - A bridge job's final status is recorded before its worker writes its last events (the browser handoff notice) and releases the session (docs/ide_protocol.md). The resolved-review tests and the reused-session test now wait for the worker to retire before reading those events, sending the next turn or closing the session. - The Forge swarm test joins its second thread before checking that it stopped; the thread sets its event in a finally block and still has to unwind. Under synthetic CPU load (busy loops on every core), the old peer crash fixture and the TUI truncation test failed, and the new tests passed every round.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A job's final status and terminal events come before its worker's final ownership handoff, which is when the session moves the job from active_job to last_job (docs/ide_protocol.md). Nine tests waited for a terminal event and then read session.status, session.list or job.status expecting the job to be retired; on a busy CI worker the read could land first (Python 3.13: test_chat_completion_exposes_host_verification_verdict[True] read a missing last_job). They now join the started job workers first, through one helper.
With fail-fast waits, the peer crash fixture now reports when its child process exits before entering the blocking provider (CI, Python 3.13 and 3.14: "exited early with code 1"), but not why. Both crash fixtures write the child's error output to a file in the test's temporary folder and include its end in that failure, so the cause is visible in CI logs.
0.17.1 brought in four parallel pytest workers per Linux job. On GitHub's 4-CPU runners the suite is not yet reliable that way: eight runs in a row failed at least one Linux job on timing tests. The races fixed in the previous commits explain some of them. Others show tests interfering with each other when they share a worker: a Git fixture hit another repository's sample hook, and a schedule tick test failed in two jobs at once. Serial runs passed on main on Nov 14, at about 50 minutes per job, within the 120-minute job limit. Parallel runs can return once the suite is safe to share workers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI on the 0.17.1 merge commit (
c868a52f, run 43895031119) failed six times in a row, each time on a timing test in a Linux job (four parallel workers per job). Each wait either gave up after a few seconds or read state that the code under test had not finished producing yet. This changes only how the tests wait; every assertion stays.scripts/qa/bots_peer_recovery.py,tests/test_bots_process_recovery.py): the child process imports the engine before it starts. They also stop at once if the child exits.tests/test_mid_turn_input.py): synthetic key streams are parsed on a background thread._wait_for_lineand the worker joins intests/test_ide_stdio_bridge.py.docs/ide_protocol.mdsays so: "A retained terminal result is history, not proof of worker/resource cleanup or readiness." The resolved-review tests and the reused-session test now wait for the worker before reading those events, sending the next turn or closing the session.finallyblock and still has to unwind.Validation, Python 3.13.18, 10-core Mac,
pytest -n 8on the failing tests:ruff checkandruff format --checkare clean;scripts/qa/check_public_repo.pypassed.Second commit (ccc6573): the first CI run on this PR failed on Python 3.13 in
test_ide_stdio_bridge.py::test_chat_completion_exposes_host_verification_verdict[True], which readsession.statusright after a terminal event whilelast_jobwas still empty. A job moves fromactive_jobtolast_jobat its worker's final ownership handoff, after its terminal events. Nine bridge tests that read retired-job state now join the started job workers first (_wait_for_job_workers).tests/test_ide_stdio_bridge.pypassed in full twice under 40 busy loops on the Mac.Third and fourth commits. The second CI run failed in three Linux jobs, on more timing tests and on tests that interfere when they share a worker:
Attempt to add a non-ASCII file name).test_scheduler_keeps_ticking_while_provider_is_busy[False]failed in two jobs at once.The changes:
4ef7ea96: the bots crash fixtures now print the child's error output when it exits early.858c074f: CI runs the Linux test suites serially again, as on every main run before 0.17.1 (about 50 min per job, 120-min limit). Parallel workers (from 0.17.1) can return once the suite is safe to share workers.