Skip to content

fix(test): remove race-inducing idle tick from test data in test_detach_keeps_draining_into_buffer (#73854) - #73856

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-73854
Closed

fix(test): remove race-inducing idle tick from test data in test_detach_keeps_draining_into_buffer (#73854)#73856
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-73854

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Problem

test_detach_keeps_draining_into_buffer uses FakeBridge([b"one", b"", b"two"]) where b"" is a literal idle tick between the two real chunks. In PtySession._drain(), a b"" chunk triggers await asyncio.sleep(0) followed by another run_in_executor round-trip before b"two can be consumed. The 50ms asyncio.sleep in the test is often insufficient for this extra executor hop — the test fails intermittently with assert replay == b"onetwo" where only b"one" has arrived.

Fix

Remove the b"" idle tick from the test data. The FakeBridge naturally returns b"" (idle) when its chunk list is exhausted, so removing the in-band idle tick doesn't reduce what the test validates — it still proves the drain continues after detach and accumulates data into the buffer.

Verification

pytest tests/test_pty_session.py -v  # 10/10 passed
# 20 consecutive runs of the specific test: 20/20 passed

Closes #73854

@teknium1

Copy link
Copy Markdown
Contributor

Thanks @kyssta-exe — closing as resolved: test_detach_keeps_draining_into_buffer was removed entirely in today's suite-wide test prune (PR #74383), so the flake this fixed no longer exists. Your diagnosis of the race-inducing idle tick was correct and appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Flaky test - test_detach_keeps_draining_into_buffer intermittently fails

3 participants