Repository navigation
fix: show CLI upgrade instructions in the WebUI - #11621
Conversation
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/dashboard/services/update_service.py" line_range="183" />
<code_context>
reboot: Whether to restart AstrBot after applying files.
proxy: Optional GitHub proxy URL.
"""
+ if os.environ.get("ASTRBOT_CLI") == "1":
+ self.update_progress[progress_id].update(
+ status="error",
</code_context>
<issue_to_address>
**CLI installs show generic update errors**
When `ASTRBOT_CLI` is truthy but not exactly `"1"`, or `ASTRBOT_LAUNCHER` is set, the CLI check skips the guidance branch, then the updater rejects the installation and the exception handler reports a generic update failure instead of package-manager instructions.
Use the updater’s CLI-managed installation conditions for the guidance check, including truthy `ASTRBOT_CLI` values and a set `ASTRBOT_LAUNCHER`.
</issue_to_address>
### Comment 2
<location path="astrbot/dashboard/services/update_service.py" line_range="185" />
<code_context>
"""
+ if os.environ.get("ASTRBOT_CLI") == "1":
+ self.update_progress[progress_id].update(
+ status="error",
+ error_code="cli_update_required",
+ message=(
</code_context>
<issue_to_address>
**Older polls overwrite terminal guidance**
When an older running poll returns after a newer poll has returned the terminal CLI error, `applyUpdateProgress` replaces the terminal error with the older running response after polling has stopped, so the panel remains stuck on a nonterminal message instead of showing upgrade instructions.
Prevent an older running response from replacing a terminal update state.
</issue_to_address>
### Comment 3
<location path="tests/test_dashboard.py" line_range="3262" />
<code_context>
+ assert progress["status"] == "error"
+ assert progress.get("error_code") == "cli_update_required"
+ assert "uv tool upgrade astrbot" in progress["message"]
+ assert "pip install" in progress["message"]
+ assert progress["overall_percent"] == 0
+ update.assert_not_awaited()
</code_context>
<issue_to_address>
**Generic pip guidance passes route test**
When the polled response contains a generic `pip install` instruction but omits the required command details, `test_cli_update_guidance_in_polled_progress` only checks for the substring `pip install`, so a response missing `python -m`, `--upgrade astrbot`, or the original-environment instruction still passes as valid guidance.
Assert the full pip upgrade command and the original-Python-environment guidance in the polled message.
</issue_to_address>
### Comment 4
<location path="dashboard/tests/updateProgressMessage.test.mjs" line_range="1-16" />
<code_context>
+import { expect, test } from "vitest";
+import en from "../src/i18n/locales/en-US/core/header.json";
+import ja from "../src/i18n/locales/ja-JP/core/header.json";
+import ru from "../src/i18n/locales/ru-RU/core/header.json";
+import zh from "../src/i18n/locales/zh-CN/core/header.json";
+import { getUpdateProgressMessage } from "../src/utils/updateProgressMessage.ts";
+
+const failure = { status: "error", stage: "preparing", message: "Server fallback" };
+
</code_context>
<issue_to_address>
**Repository guidance is disregarded**
When the newly added dashboard test file is included, the PR adds a new frontend test file despite the repository-wide instruction not to generate test files, so this change violates that rule.
Remove the newly added test file.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: astrbot/dashboard/services/update_service.py:183, astrbot/dashboard/services/update_service.py:185, tests/test_dashboard.py:3262
| reboot: Whether to restart AstrBot after applying files. | ||
| proxy: Optional GitHub proxy URL. | ||
| """ | ||
| if os.environ.get("ASTRBOT_CLI") == "1": |
There was a problem hiding this comment.
🟡 Medium · CLI installs show generic update errors
When ASTRBOT_CLI is truthy but not exactly "1", or ASTRBOT_LAUNCHER is set, the CLI check skips the guidance branch, then the updater rejects the installation and the exception handler reports a generic update failure instead of package-manager instructions.
Use the updater’s CLI-managed installation conditions for the guidance check, including truthy ASTRBOT_CLI values and a set ASTRBOT_LAUNCHER.
Prompt for AI agents
In `astrbot/dashboard/services/update_service.py` at line 183:
**CLI installs show generic update errors**
When `ASTRBOT_CLI` is truthy but not exactly `"1"`, or `ASTRBOT_LAUNCHER` is set, the CLI check skips the guidance branch, then the updater rejects the installation and the exception handler reports a generic update failure instead of package-manager instructions.
Use the updater’s CLI-managed installation conditions for the guidance check, including truthy `ASTRBOT_CLI` values and a set `ASTRBOT_LAUNCHER`.| """ | ||
| if os.environ.get("ASTRBOT_CLI") == "1": | ||
| self.update_progress[progress_id].update( | ||
| status="error", |
There was a problem hiding this comment.
🟡 Medium · Older polls overwrite terminal guidance
When an older running poll returns after a newer poll has returned the terminal CLI error, applyUpdateProgress replaces the terminal error with the older running response after polling has stopped, so the panel remains stuck on a nonterminal message instead of showing upgrade instructions.
Prevent an older running response from replacing a terminal update state.
Prompt for AI agents
In `astrbot/dashboard/services/update_service.py` at line 185:
**Older polls overwrite terminal guidance**
When an older running poll returns after a newer poll has returned the terminal CLI error, `applyUpdateProgress` replaces the terminal error with the older running response after polling has stopped, so the panel remains stuck on a nonterminal message instead of showing upgrade instructions.
Prevent an older running response from replacing a terminal update state.64a79ca to
1772156
Compare
Linked issuesChecked at commit c696aee #11620 使用uv安装的AstrBot无法通过WebUI更新。当前实现具有显著误导性 · 1 of 1 met
|
Modifications
When AstrBot is started via the CLI, return a stable update error and show package-manager-specific instructions in the progress panel:
uv tool upgrade astrbotfor uv tool installs orpython -m pip install --upgrade astrbotin the original pip environment. The core downloader is unchanged.Test results
The route regression uses the v1 update endpoint and polls progress. It failed on the base branch; 65 targeted backend tests, 5 frontend tests, the four-locale key check, and Ruff lint and format checks passed.
Fixes #11620
Summary by Sourcery
Guide CLI-launched users to upgrade AstrBot with their package manager instead of attempting a WebUI update.
New Features:
Enhancements:
cli_update_requirederror through update progress when AstrBot is launched via the CLI, without starting the core updater.Tests: