Repository navigation
test(session): give the hard-stop fake manager the slot-list reads - #18950
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] ae0f9c2 Description read[DESCRIPTION-READ] e7f9c0aaba7667a1e255104a34a85b1c26a6bac12a00360e03b09b48c8555f25 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 stand in a fake SubagentManager that has only settle_queued_delivery. stop_slot_turn pushes a slots update, and when the coalescing window has elapsed that push serializes every slot, which calls published_queued_depths and running_agents_for on the manager. The fake had neither, so the tests raised AttributeError whenever setup took longer than the window, as it does on a loaded CI worker. The fake now answers both reads as an idle manager does, and both tests run on a clock that puts every push past the window, so they exercise the broadcast path every time instead of by timing.
4c69e57 to
ae0f9c2
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approved at head ae0f9c2: PR Readiness is green, no open change requests, and the review lanes passed. (AI-assisted review at bolichen97's request.)
Problem / Motivation
Goal: Make the two hard-stop settle tests in
test/test_session_control.pypass deterministically onmain.test_a_hard_stop_still_discards_and_settles_what_was_queued_before_itfails intermittently in Backend Tests with:It is red on #18944's own run (Backend Tests (3.12, 4)), whose merge ref is
mainplus a test-only change to an unrelated file, and green onmain's own run for the same tree. It passes locally in isolation.Why it matters
mainis already red ontest_approval_decide_owner_bound.py(fixed by #18944). This second failure is timing-dependent, so it can turn #18944,main, and any PR's Backend Tests shard red at random after that fix lands.Not a goal
test_approval_decide_owner_bound.py403 failures; test: align slot-approve internal-caller tests with the gate #18944 fixes those.What changed (motivation → approach → change)
AttributeErrorfrom_published_queued_by_slotindashboard/state.py, only on some runs.SubagentManagerthat only hassettle_queued_delivery.stop_slot_turncallsstate.push_slots_update(). If the coalescing window has elapsed since the state's last broadcast, that push serializes every slot right away. Serializing callspublished_queued_depths()andrunning_agents_for()onstate.subagents. If the window has not elapsed, the push only arms a trailing timer, which never fires beforeasyncio.runcloses the loop. So the test passes when setup is fast and fails when a loaded CI worker makes setup slower than the window._SettlingManagernow hasrunning_agents_forandpublished_queued_depths, and both answer "none", as an idle manager does._slots_window_always_openfixture patches_slots_broadcast_clockto a clock that jumps past the window on every read. This is the same seamtest_slots_broadcast_byte_pacing.pyuses. Both hard-stop tests use the fixture, so every run takes the broadcast path instead of depending on how long the test took.Backwards compatibility
Compatible: test-only change, nothing in
src/is touched.Removes nothing: the diff only adds two methods to a test double and one fixture.
Tests
test_a_send_that_lands_while_a_hard_stop_settles_stays_queuedandtest_a_hard_stop_still_discards_and_settles_what_was_queued_before_itnow always run through the immediate slots broadcast.AttributeError. With the fix, both pass.python -m pytest test/test_session_control.py test/test_slots_broadcast_byte_pacing.py: 239 passed.test/test_flake_pattern_ratchet.py: passed.Manual verification
N/A: test-only change. The unit run above is the evidence.
Related Issues
Refs #18822, #18944
Pattern harvest
Rule candidate: review-prompt
Pattern: a hand-rolled stand-in for a manager or service that a code path also reads through a broadcast or serializer needs every method that path calls, or the test passes only when the coalescing or timing window happens to skip the call.
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.