Repository navigation
Description
tests/test_kb_manuals_metadata.py::test_offline_speed_under_one_second asserts that three calls finish within one second of wall-clock time. It failed in a pre-push gate with KB metadata operations took 1.00s (exceeded 1.0s limit), in a run where 1 test failed and 11,321 passed. The gate shared the machine with two other gates and several test runs (load average 43), so the 1.0 s limit measured the load and not the code. The same push passed once the load fell.
The assertion adds nothing the rest of the test does not already check. "Offline" is guaranteed by the hermetic floor, which refuses every network socket and every program but git in tests, so a call that reached the network would fail on its own. The test then asserts that matched and drifting manuals are found and that filtering keeps one; those assertions stay. A wall-clock bound is the shape of check the project has already removed elsewhere (#1725, "tests never hit DNS/network") and fails on a busy runner or a busy workstation.
Remedy: delete start, elapsed and the assert elapsed < 1.0 line, the time import if nothing else uses it, and "in <1s" from the docstring. Search tests/ for other perf_counter or time.time() bounds with an assert ... < on elapsed time and decide each on the same ground: the floor, not a stopwatch, proves a test is offline.
regression of #1664, shipped in v0.2.37
Second test (folded in by the intake duplicate check on 2026-10-22)
Problem
tests/test_ui_reactive.py::test_quitting_does_not_wait_on_a_silent_log_stream asserts that quitting the dashboard takes less than 5.0 seconds of wall-clock time. On a busy machine the quit took 5.6 seconds, and the test failed with quitting took 5.6s while a stream was open. The same test passes in 1.7 to 3 seconds on its own. The bound measures the load of the machine, not a hang.
Evidence
- The failure happened in the pre-push gate (
devops ci) of the branch that deletes the dashboard GitHub tab (refactor(ui): delete the dashboard GitHub tab; gh-dash replaces it #1883) on 2026-10-22. Result:1 failed, 11314 passed. The gate ran next to another gate and a builder agent. The load average was about 25. - The test reads the clock itself:
started = time.monotonic()beforepilot.press("q")andassert elapsed < 5.0at the end. The silent stream waits on an event with a 30-second timeout. A real hang would take 30 seconds, so a bound between 5 and 30 seconds does not separate a hang from a slow machine. tests/support/waits.pyalready holdsTHREAD_HANDOFF_BOUND_SECONDS, the generous bound that issue test(cli): tests wait for a background thread with one generous bound, not a 1-second deadline, so they pass under load #1664 introduced for tests that wait for a background thread. Issue fix(tests): the knowledge base metadata test fails when the machine is busy because it asserts elapsed wall-clock time #1825 and fix(test): the process-group timeout test waits for its grandchild to start, not for 0.6 seconds #1888 report the same class of defect in two other tests.
Remedy
The test must prove that quitting does not wait for the silent stream, without a tight wall-clock bound. For example, quit while the stream is blocked and assert that the application stops before the stream is released: the event release is still unset when the application has stopped. A hang then fails the test through the generous per-test timeout, and a slow machine does not fail it. The test must still fail if the quit waits for the stream thread. Show this with a mutation of the production code or with a copy of the old behaviour.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
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 due to time assertions.This is a test reliability issue, not a critical bug or feature.Improves test stability under load which benefits CI/CD and developer experience.The fix involves removing a few lines of code and assertions.fix(tests): two tests no longer assert elapsed wall-clock time (#1896)
dan-petty commentedon Oct 22, 2026
What changed
#1896, merged into
release/v0.2.39as 75071b0.4 file(s) changed.
How it was verified
Check runs at d1304e8:
Acceptance Criteria of
docs/agent/tasks/task-1825-kb-metadata-test-asserts-no-wall-clock-time.md:uv run devops ci test tests/test_kb_manuals_metadata.py tests/test_ui_reactive.pypasses.feat(release): v0.2.39 (#1947)