Skip to content

test(chat): assert the linked-session worker lookup by membership, not last call - #13121

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
billygerhard:fix/completion-sound-linked-call-assert
Sep 23, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
billygerhard:fix/completion-sound-linked-call-assert

Conversation

@billygerhard

Copy link
Copy Markdown
Contributor

Problem / Motivation

test/test_chat_completion_sound.py::test_continuation_uses_linked_session_identity flakes on the Windows shard 8 (#13044): it ends with assert_called_with(slot.linked_session_key), which checks only the MOST RECENT call on the mock. finish_frame drains the background tasks after the continuation check, and on a slow runner 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.

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_with asserts the last call, but the property under test is that the linked session was consulted, not that nothing consulted the mock afterwards → change: assert call(slot.linked_session_key) in running_agents_for.call_args_list. One line plus the call import; 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

…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
@billygerhard
billygerhard requested review from a team and cixuuz September 23, 2026 16:51
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed a70213b8c2c7f71ce7896a30a33037d5d0fb883e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a70213b

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of a70213b8c2c7f71ce7896a30a33037d5d0fb883e via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify #13044's failure log shows the extra running_agents_for call — confirming the drain-ordering mechanism, not a masked real regression.

The relaxation is safe independent of that: the fixture's side_effect returns children only for the linked key, so continuing is True on line 80 already proves the linked-session lookup happened and drove the signal; the membership assertion is belt-and-suspenders, and it still fails if the continuation check consults the wrong key.

[DESIGN-REVIEWED] a70213b

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed a70213b8c2c7f71ce7896a30a33037d5d0fb883e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a70213b

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 23, 2026
@iamwhatever
iamwhatever merged commit cfe9189 into kirodotdev:main Sep 23, 2026
95 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 23, 2026
@billygerhard
billygerhard deleted the fix/completion-sound-linked-call-assert branch September 23, 2026 18:30
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(windows): test_chat_completion_sound::test_continuation_uses_linked_session_identity flakes on shard 8 (assert_called_with races background tasks)

2 participants