Repository navigation
Description
What happened
#2092 made four tests wait for an event that the code under test signals, not for a time window, and added wait_while_running(condition, process) to tests/support/waits.py. Other waits in tests/ still keep a deadline of their own, so they can fail on a loaded host although the code works:
- 16 waits of 5 s and 10 s in
tests/test_ui_reactive.py. - Waits in
tests/test_trace_propagation.py,tests/test_k8s_port_forward_daemon.py,tests/test_http_connection_pool.py,tests/test_roadmap_github_store.py,tests/test_github_session.pyandtests/test_ai_client_network.py. - The 30 s waits on a new
devopsprocess intests/test_cli_startup_imports.pyandtests/test_github_session.py. On 2026-10-24 a newdevopstook more than 30 s to start under load, and 0.44 s to 0.51 s on a quiet host.
What should happen
Each wait ends on the event that the code signals, or on the exit of the process it waits for (wait_while_running), as docs/TESTING.md requires. A hang fails at the pytest timeout, not at a deadline in the test.
Evidence
- Found while fix(tests): four tests that wait for a time window fail under host load #2092 was delivered (2026-10-24):
git grep -n "wait_until(.*timeout\|THREAD_HANDOFF_BOUND_SECONDS" tests/.
Acceptance criteria
- No test in the files above passes a deadline of its own to a wait for an event or a process.
- Each changed test passes 50 times in a row under CPU load (
uv run devops ci test <file> --repeat 50).
Source: #2092
Proposed design
Problem statement
Tests in eight files wait for events or process exits using hardcoded deadlines of 5 s, 10 s, or 30 s. These deadlines can expire on a loaded host even when the code works correctly. Each wait must end on the event the code signals or on the exit of the process it waits for, as docs/TESTING.md requires. A hang fails at the pytest timeout, not at a deadline in the test.
Acceptance criteria
- Criterion 1: No test in the eight listed files passes a deadline of its own to a wait for an event or a process.
Verification: git grep -n 'wait(.*timeout=[0-9]|join(timeout=[0-9])' tests/test_ui_reactive.py tests/test_trace_propagation.py tests/test_k8s_port_forward_daemon.py tests/test_http_connection_pool.py tests/test_roadmap_github_store.py tests/test_github_session.py tests/test_ai_client_network.py tests/test_cli_startup_imports.py returns no lines. - Criterion 2: Each changed test file passes 50 consecutive runs under CPU load.
Verification: uv run devops ci test --repeat 50 exits 0 for each of the eight files. - Criterion 3: The 30 s waits on a new devops process in test_cli_startup_imports.py and test_github_session.py use wait_while_running.
Verification: git grep -n 'wait_while_running' tests/test_cli_startup_imports.py tests/test_github_session.py shows the wait for the devops process uses wait_while_running.
Key questions
- Should the 5 s and 10 s waits in test_ui_reactive.py use THREAD_HANDOFF_BOUND_SECONDS?: Yes. The waits.py docstring states that a wait expecting an event from another thread uses THREAD_HANDOFF_BOUND_SECONDS. [sources: tests/support/waits.py]
- Should the 30 s waits on a new devops process use wait_while_running?: Yes. The waits.py docstring states that a wait for an event of a process the test started uses wait_while_running and has no bound of its own. [sources: tests/support/waits.py]
- Do any waits in the listed files check that nothing happens and should keep their own window?: The issue states no test in the files above passes a deadline of its own to a wait for an event or a process. A wait that checks nothing happens keeps a short window with a comment, per the waits.py docstring. The issue does not name any such wait in the listed files. (proposed) [sources: tests/support/waits.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate proposes changes to test behavior and waits for events or process exits rather than using hardcoded deadlines.Improves test reliability under load but does not fix a critical failure or security issue.Improves test stability, reduces flakiness, and helps with CI performance under load.Requires modifying multiple test files to replace hardcoded timeouts with event-based waits.Both items address test waits that fail under load, but the candidate focuses on event-based waiting while item 1748 addresses process and session-exit tests with bounded waits.fix(tests): four tests that wait for a time window fail under host lo…
dan-petty commentedon Oct 28, 2026
Status set to Ready at bb46660 (see proposed design in issue body).
chore(main): release 0.36.0 (#2943)