[UX] /upgrade requires multiple attempts before succeeding
Bug Description
Users must press /upgrade 2–3 times before the upgrade actually completes. Typical sequence:
/upgrade→ "Already Up to Date" (false — new version exists but PyPI CDN hasn't propagated yet)/upgrade→ "Update Available" → user confirms → "Version unchanged after upgrade. Try again in a few minutes." (pip reports success but disk version hasn't changed)/upgrade→ "Update Available" → user confirms → Success, restart
Root Causes
1. No retry after "Version unchanged" (bot/app.py:818-834)
After perform_upgrade() succeeds (pip exit 0) but get_installed_version() still returns the old version, the bot sends a message and returns immediately. No automatic retry, no polling — user must manually re-trigger.
2. PyPI propagation lag
check_pypi() may return the old version briefly after a release, causing false "Already Up to Date" on the first attempt.
3. Race condition between pip and verification
get_installed_version() spawns a subprocess immediately after pip finishes. On some systems pip reports success before the package metadata is fully written to disk.
Proposed Fixes
A. Retry loop after upgrade (highest impact)
After perform_upgrade() succeeds but version is unchanged, poll get_installed_version() a few times with short delays (e.g. 3 attempts, 5s apart) before giving up.
# Pseudocode
for attempt in range(3):
actual = await get_installed_version()
if actual != current:
break
await asyncio.sleep(5)
B. Forced restart option If pip exited 0 and the target version matches what PyPI reports, offer a "Force restart anyway?" button instead of just telling the user to try again.
C. PyPI cache-bust on check
Add a cache-buster query param or Cache-Control: no-cache header to the PyPI JSON API request to reduce CDN staleness.
Environment
- OS: Linux / Windows / macOS
- Version: 0.5.5
- Affects both Telegram
/upgradeandductor upgradeCLI
Fixed in v0.6.0.
- Retry with verification: After pip reports success, the installed version is polled before restarting.
- PyPI cache-busting (
fresh=True) reduces CDN staleness. perform_upgrade_pipeline()replaces the old inline subprocess logic with proper retry handling.
All three root causes from the description are addressed.