Repository navigation
test(chat): assert the linked-session worker lookup by membership, not last call - #13121
Conversation
…t last call test_continuation_uses_linked_session_identity used assert_called_with, which checks only the MOST RECENT call. finish_frame drains the background tasks after the continuation check, and on a slow runner (Windows shard 8) a background consumer calls running_agents_for again with the slot's own key, so the last call is no longer the linked-session one and the assertion misses even though the linked-session lookup happened. Assert membership in call_args_list instead: the property under test is that the linked session was consulted, not that nothing consulted the mock afterwards. Closes kirodotdev#13044
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify #13044's failure log shows the extra The relaxation is safe independent of that: the fixture's [DESIGN-REVIEWED] a70213b |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
…t last call (kirodotdev#13121) test_continuation_uses_linked_session_identity used assert_called_with, which checks only the MOST RECENT call. finish_frame drains the background tasks after the continuation check, and on a slow runner (Windows shard 8) a background consumer calls running_agents_for again with the slot's own key, so the last call is no longer the linked-session one and the assertion misses even though the linked-session lookup happened. Assert membership in call_args_list instead: the property under test is that the linked session was consulted, not that nothing consulted the mock afterwards. Closes kirodotdev#13044
Problem / Motivation
test/test_chat_completion_sound.py::test_continuation_uses_linked_session_identityflakes on the Windows shard 8 (#13044): it ends withassert_called_with(slot.linked_session_key), which checks only the MOST RECENT call on the mock.finish_framedrains the background tasks after the continuation check, and on a slow runner a background consumer callsrunning_agents_foragain with the slot's own key, so the last call is no longer the linked-session one and the assertion misses even though the linked-session lookup happened.Why it matters
Every PR that lands on shard 8 while the runner is slow goes red for a reason unrelated to its diff, and on a fork PR each re-roll costs a maintainer another workflow release. #11827 hit it once today; the same shard was green on its neighbouring heads.
What changed
Symptom: order-dependent assertion misses on a slow runner → root cause:
assert_called_withasserts the last call, but the property under test is that the linked session was consulted, not that nothing consulted the mock afterwards → change: assertcall(slot.linked_session_key) in running_agents_for.call_args_list. One line plus thecallimport; no production code touched.Backwards compatibility
Compatible: test-only change; no runtime code or contract touched.
Tests
The changed test itself (
test_chat_completion_sound.py, 17 pass locally). The assertion still fails if the continuation check never consults the linked session (the membership check is strictly weaker only with respect to unrelated LATER calls).Manual verification
N/A — unit coverage sufficient; the flake mechanism is the drain ordering, which the new assertion is independent of.
Screenshots / video
N/A — no UI change.
Closes #13044