Repository navigation
fix(test): give the hard-stop settle double the slot-push reads - #18952
cruisercohen wants to merge 1 commit into
Conversation
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 5f0e3ff Description read[DESCRIPTION-READ] 0b2dccd9c39789eb09244092c9675531d7fc10a686689ba90493b2f7d126af20 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
The two hard-stop settle tests in test_session_control.py stand in a hand-rolled manager for state.subagents that implements only settle_queued_delivery. Each Stop press calls push_slots_update, and the slot-list serialization reads published_queued_depths and running_agents_for off that manager. Whether the press serializes or is folded into a trailing timer depends on the 0.2s coalescing window since the push the slot's creation made, so on a loaded runner the press serializes and the test dies with AttributeError. Add the two reads to the double (both empty: it has no children) and pin the coalescing clock past the window in both tests, so the serialization runs on every run instead of only on a slow host.
f675fbc to
5f0e3ff
Compare
|
Closing as a duplicate: #18950 makes the same fix (the hard-stop test double answers the slot-list reads, and the slots clock always clears the coalescing window), and its checks are green. |
Problem / Motivation
Goal: Stop
test/test_session_control.pyfailing at random on the backend shards of every PR.test_a_hard_stop_still_discards_and_settles_what_was_queued_before_it(and its siblingtest_a_send_that_lands_while_a_hard_stop_settles_stays_queued) fail intermittently in "Backend Tests (3.12, 4)" with:Both pass when run alone on a fast host, which is why they landed green.
Why it matters
The shard is required, so a random red here blocks merging an unrelated PR until someone notices and re-runs it. It hits whichever PR's merge ref happens to land the test on a slow worker.
Not a goal
stop_slot_turn, the slots broadcast, or its coalescing window. Product code is untouched.state.subagentsdouble in the suite. The ones found useMagicMock, which answers any read.What changed (motivation → approach → change)
Symptom: the two hard-stop settle tests die with
AttributeErroron a loaded runner and pass locally.Root cause: the tests set
state.subagentsto a hand-rolled_SettlingManagerthat implements onlysettle_queued_delivery. Every Stop press callspush_slots_update(). That push either serializes the slot list at once, or folds into a trailing timer when the last push was less than 0.2s ago. Creating the slot makes the first push, so:asyncio.runloop closes first), and nothing reads the manager;serialize_slotsreadspublished_queued_depths()andrunning_agents_for()off the manager, and the double has neither.Reproduced locally by pinning the coalescing clock past the window: both tests fail 3/3 with the CI error, on unmodified
main.Change (test-only, one file):
_SettlingManagergainspublished_queued_depths()andrunning_agents_for(), both empty, since this manager has no children. Its docstring now names every manager read a hard stop reaches._every_slots_push_broadcastsfixture puts each read of_slots_broadcast_clock(the seamstate.pyprovides for exactly this) a second after the last, and both tests use it. The serialization then runs on every run, so the outcome no longer depends on host speed, and a future read the double lacks fails on every run instead of on a slow one.Rejected alternatives:
suspend_slots_push()or a clock frozen inside the window: makes the tests pass by never serializing, which hides the incomplete double rather than fixing it.MagicMock(spec=SubagentManager)for the manager: answers every read, butrunning_agents_for()would return a truthy mock and mark the slot as having running children, a fact the tests do not mean to assert.Backwards compatibility
Compatible: test-only change, no runtime code touched.
Removes nothing: the diff adds two methods to a test double and one fixture; no test, assertion or product path is removed.
Tests
AttributeError.test/test_session_control.py229 passed, 8/8 runs serial, 3/3 runs under-n 4.slot._queue.clear()after the settle's await instop_slot_turnstill failstest_a_send_that_lands_while_a_hard_stop_settles_stays_queued.Manual verification
N/A — test-only change; the unit runs above are the verification.
Related Issues
N/A — found while reading the failing backend shard on an unrelated PR; no issue filed.
Pattern harvest
Rule candidate: review-prompt
Pattern: a hand-rolled stand-in for
state.subagents(or any manager the slots broadcast reads) that implements only the method under test, in a test that triggerspush_slots_update(); whether the broadcast reads the stand-in depends on the 0.2s coalescing window, so it passes on a fast host and fails on a slow one.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.