feat(shell): silent startup auto-update (default on) with config + env opt-outs - #130
Conversation
|
Warning Review limit reached
More reviews will be available in 34 minutes and 6 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR adds silent background auto-updates at Shell startup, replacing a blocking pre-start prompt. It introduces a configuration field ChangesSilent Auto-Update Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The Windows native/pip update path in run_update_job raises SystemExit so the installer can replace the binary. That exception propagates through the asyncio task and into _cleanup via t.result(). Since SystemExit is a BaseException the existing `except Exception` clause did not catch it, allowing it to escape the done-callback and crash the shell. Add an `except SystemExit` clause (before `except Exception`) that logs the event instead of re-raising. Test uses a _CapturingTask stand-in (monkeypatching asyncio.create_task) to intercept the registered done-callback and drive it synchronously with a mock task whose .result() raises SystemExit — necessary because Python 3.14 propagates SystemExit out of asyncio.run() before the callback can be tested via a live event loop.
Narrow self.soul to PythinkerSoul before reading runtime.config (falling back to the toast-only path otherwise), cast the resolver test stub to Config, and apply ruff format across the touched files so make check passes.
f301044 to
d94fa1b
Compare
Summary
Replaces the blocking pre-start update prompt with a silent, non-blocking background auto-update at startup (on by default). When a newer installable release exists, Pythinker installs it in a background task and surfaces a single one-line
Updated X → Y. Restart Pythinker to apply.notice — the running session keeps going on the old version until you restart. Per-channel install behavior is unchanged (byte-for-byte).What changed
auto_update: boolfield (defaulttrue) andPYTHINKER_AUTO_UPDATEenv mapping. The hard kill-switchPYTHINKER_CLI_NO_AUTO_UPDATEstill takes precedence.auto_update_enabled(config)encodes precedence — env kill-switch →config.auto_update is False→ source checkout → enabled._schedule_startup_update_task()dispatches the silent installer when enabled, the existing toast-only path otherwise, and schedules nothing when the kill-switch is set. (prompt_pre_start_update_jobis retained for future re-wiring.)_silent_auto_update()runs the existingrun_update_job(print_output=False)orchestrator and toasts the result. Smoke-check failures surface "verification failed", never "Restart to apply".SystemExit(Windows native/pip installer hand-off) is re-raised at the job level and swallowed with logging only at the background-task_cleanupboundary, so it never crashes the shell.format_managed_channel_notice) and the smoke-fail sentinel (SMOKE_CHECK_FAILED_PREFIX) each have a single source of truth.auto_updateconfig field,PYTHINKER_AUTO_UPDATEenv var (+ per-channel behavior), and an updated kill-switch description;## UnreleasedCHANGELOG entry.No install/execution logic below
run_update_jobchanged — per-channel upgrade behavior stays owned by the existing update layer.Per-channel behavior
Testing
make check-pythinker-code(ruff + format + pyright) — green, 0 errorstests+tests_e2e) — 5619 passed, 11 skipped, 1 xfailed. The single local failure (test_shell_cancel_running_command_kills_process_and_recovers) is a pre-existing, load-sensitive PTY/ESC-flush flake on this machine (green in CI); it lives in shell-cancel code this branch does not touch.New tests cover: resolver precedence (6-way), managed-notice helper,
print_outputresult-invariance, the silent flow (success → restart notice, smoke-fail → verification-failed, FAILED → silent, managed → channel hint, throttle), the three dispatch branches, andSystemExitsurvival in background-task cleanup.Summary by CodeRabbit
Release Notes
PYTHINKER_AUTO_UPDATEenvironment variable or configuration setting