Skip to content

test(tui): de-flake cleanup-session summary toast assertion#248

Merged
pbean merged 1 commit into
mainfrom
fix/flaky-cleanup-sessions-notify
Jul 21, 2026
Merged

test(tui): de-flake cleanup-session summary toast assertion#248
pbean merged 1 commit into
mainfrom
fix/flaky-cleanup-sessions-notify

Conversation

@pbean

@pbean pbean commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to the 0.9.0 release (#247). De-flakes a Windows-only CI failure — not a code regression; v0.9.0 shipped fine.

The failure

On the #247 merge commit, test (windows, py3.11) failed:

tests/test_tui_app.py::test_cleanup_sessions_mux_error_notifies
>   assert any("removed 1 session(s)" in m for m in notifications(app))
E   assert False

The identical tree passed this exact job in the PR's own CI — same code, passed once / failed once = a timing flake.

Root cause

_cleanup_sessions_worker (app.py) marshals two toasts from the worker thread via separate call_from_thread hops, in this order: the unverifiable engine pid warning, then the removed N session(s) summary. Both cleanup tests waited until the earlier warning appeared, then did a bare assert on the later summary — so on slow Windows timing the summary toast hadn't reached the message pump yet and the assert raced it.

Fix

Wrap the summary check in the same until() poll the surrounding waits already use, in both test_cleanup_unknown_sessions_notifies and test_cleanup_sessions_mux_error_notifies. Test-only; no production code touched.

Verification

  • pytest tests/test_tui_app.py -k cleanup → 2 passed locally.
  • trunk pre-commit hook clean.

The cleanup worker marshals its 'removed N session(s)' summary toast AFTER
the 'unverifiable engine pid' warning (app.py _cleanup_sessions_worker), each
via a separate call_from_thread hop. Both cleanup tests waited `until` the
earlier pid warning appeared, then did a BARE assert on the later summary — so
on slow Windows timing the summary had not reached the message pump yet, and
the assert raced it. Surfaced as a py3.11 Windows-only failure of
test_cleanup_sessions_mux_error_notifies on the v0.9.0 merge commit, where the
identical tree had passed in the PR's own CI.

Wrap the summary check in the same `until` poll the surrounding waits use.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@pbean, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3c08fbf-19bd-41c5-88dd-9f9ea3a55096

📥 Commits

Reviewing files that changed from the base of the PR and between 7255174 and cea5652.

📒 Files selected for processing (1)
  • tests/test_tui_app.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/flaky-cleanup-sessions-notify

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pbean
pbean marked this pull request as ready for review July 21, 2026 23:02
@pbean
pbean merged commit f071a0d into main Jul 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant