feat(tui): surface newly discovered updates mid-session#237
Conversation
Toast a newly discovered release once per session when the background check lands, and re-run the mode-appropriate update check every 30 minutes for the lifetime of the shell session (previously startup-only). The loop re-consults the shared on-disk throttle, so polling cadence is unchanged; dismissal and session-skip suppression apply to the toast.
Address CodeRabbit review: the periodic check loop could re-toast managed-channel and restart notices every interval, so _update_toast now dedupes by notice text per session; add loop-recovery and toast-dedup regression tests; replace coroutine-frame introspection in the scheduler test with observable behavior.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe shell now performs periodic update checks during a session, refreshes update information, and displays deduplicated notices and toasts when a newer version is discovered. Startup scheduling routes notification modes through the periodic loop. ChangesMid-session update notices
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Shell
participant UpdateLoop
participant UpdateCache
participant UserToast
Shell->>UpdateLoop: start periodic update checks
UpdateLoop->>Shell: invoke _auto_update
Shell->>UpdateCache: refresh update cache
UpdateCache-->>Shell: return available update target
Shell->>UserToast: show notice when target is newly discovered
Shell-->>Shell: deduplicate version and notice text
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pythinker_code/ui/shell/__init__.py`:
- Around line 152-159: Update the periodic check loop around check() to enforce
an explicit timeout for each attempt, log timeout events distinctly, and
continue to the next iteration after a timeout. Preserve propagation of
asyncio.CancelledError and the existing exception logging for other failures.
In `@tests/ui_and_conv/test_mid_session_update_notice.py`:
- Around line 170-209: Refactor
test_startup_scheduler_uses_periodic_loop_in_all_scheduling_branches to avoid
mocking or asserting _periodic_update_check and _start_background_task wiring.
Instead, execute the scheduling branches and verify the observable
scheduled-check behavior, while preserving coverage for the alternate
PythinkerSoul branch and NOTIFY/DOWNLOAD modes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 69b84ac5-3246-4caf-8199-83548e3484a8
📒 Files selected for processing (3)
CHANGELOG.mdsrc/pythinker_code/ui/shell/__init__.pytests/ui_and_conv/test_mid_session_update_notice.py
Wrap each periodic update-check attempt in an asyncio.timeout backstop so a non-network hang (stuck subprocess, trickle-forever stream) can no longer block every future retry for the session; log the timeout distinctly and continue to the next interval. The watchdog is 2x the poll interval so a genuinely slow silent installer download (deliberately not total-timeout capped) still completes. Also refactor the scheduler branch test to assert the documented scheduled-coro name at the _start_background_task seam instead of mocking the private _periodic_update_check wiring.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
What
Why
After a release is tagged and promoted, a running or recently launched shell previously would not surface the update until the next restart outside the throttle window. The check bodies still re-consult the shared on-disk 30-minute throttle, so GitHub polling cadence is unchanged; dismissal and session-skip suppression apply to the toast. No mid-session install — staging remains restart-based.
Tests
tests/ui_and_conv/test_mid_session_update_notice.py: toast on discovery, no toast for startup-cached/suppressed/repeat versions, toast dedup, loop cadence, loop error recovery, and scheduler-branch coverage.make check-pythinker-codeand fullmake test-pythinker-code(incl.tests_e2e) green locally.Summary by CodeRabbit
New Features
Bug Fixes