Repository navigation
test(branch-flow): stop racing the wait timeout - #2229
Conversation
|
Marked ready for review. The branch-flow tests this PR changes pass locally and in CI; the red |
Simon-He95
left a comment
There was a problem hiding this comment.
Reviewed at e18dc54a. Removing timeoutMs: 3000 lets Wait use its 300 s default; the three tests end it from an idle/end/steer notice, and the bounded until_events/soon waits still fail promptly if the notice never arrives. No production change.
Note on CI: the verify (linux) failure at this head is agents::sessions::tests::exists_answers_loaded_unloaded_closed_and_deleted hitting the 10 s startup budget (initialization timed out ... SqliteStorage Loading), which is unrelated to this diff and is the failure #2231 addresses. The code change itself is fine; rerun the failed job before merging.
zerob13
left a comment
There was a problem hiding this comment.
Approved at e18dc54a62ee05cee556ec936b477b7a6552d738.
The test helper now uses the existing Wait default instead of racing a 3-second timer against notice observation. Its three callers retain bounded observation and still verify the intended wake and the delivered notice. All three passed in both Linux attempts on the tested merge. The same startup failure seen in attempt 2 also occurred before this patch, in a different test before its assertions. The underlying SQLite stall is unverified. This approves the test change only; ci-ok remains red and still gates merge.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Approved at 5a85674. No findings.
The net diff against origin/main 3a8113c is the same test-only change from e18dc54, +6/-8 in crates/dim-agent-capabilities/tests/branch_flow.rs; the merge left the file identical (git diff e18dc54a..5a85674c -- crates/dim-agent-capabilities/tests/branch_flow.rs is empty). start_wait submits tool:wait {} instead of tool:wait {"timeoutMs":3000}, so it uses Wait's 300 s default (crates/dim-agent-capabilities/src/wait.rs:37, :404-405) and no longer races a 3 s timeout against the observation of ToolUse.
Checks:
- Each of the three callers still proves the notice wakes the wait:
wait ended: steer(crates/dim-agent-capabilities/tests/branch_flow.rs:8147,:8180,:8210); a timeout returnswait ended: timeout(wait.rs:453). - The no-result assertion is retained (
branch_flow.rs:8054-8059). - A missing notice still fails promptly:
wait_endedis bounded byuntil_events, 600 iterations of 10 ms (branch_flow.rs:3594-3602), so it panics at about 6 s of sleeps plus page time, not at the 300 s default.soon(5 s) andpatient(30 s) bound the surrounding steps (:41-51). - No other real Wait caller keeps a short timeout in this file; the
{"millis":...}calls at:7426and:7590useMockTools' wait (crates/dim-agent-capabilities/src/adapters.rs:162-218). - No production change: only
crates/dim-agent-capabilities/tests/branch_flow.rsdiffers from main, and merge-tree against 3a8113c is clean.
Verification: cargo fmt --all -- --check passed. With the pinned 1.100.0 toolchain and an isolated home, the three tests ran twice at this head with --test-threads=1 (3 passed each run, 0.16 s and 0.12 s). CI at 5a85674 (run 45802684729) has changes green; verify (linux) and macos-native were still running when this review was written. The red verify (linux) at e18dc54 was the app-server sessions startup timeout that #2231, now in main, fixes.
Summary
start_waitinbranch_flowstartedtool:wait {"timeoutMs":3000}, then waited for theToolUseevent and asserted that noToolResulthad landed. Under load the 3 s timeout could fire before the event was observed, so the assertion failed withthe wait is still waiting; this happened on PR #2223's Linux verify job.The three callers end the wait from a branch idle/end/message notice:
an_idle_line_wakes_the_wait_of_the_main_that_opened_itan_ended_line_wakes_the_wait_of_the_main_that_opened_ita_steer_message_from_a_line_wakes_the_wait_of_the_main_that_opened_itThe wait now uses its default timeout. The tests no longer race a short tool timeout; the existing bounded
until_events/soonwaits still fail promptly if the notice never arrives.Fixes #2228. Part of #2217.
Design rule checklist
beforecallbacks: n/a — no Timeline writes.Documentation
Verification
--exact --test-threads=1: six passes.cargo clippy --locked -p dim-agent-capabilities --test capabilities_flow -- -D warnings— passed.cargo fmt --all -- --check— passed.