Repository navigation
fix: persist installer shell PATH configuration - #10933
TomorrowX6 wants to merge 11 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="docs/public/install.sh" line_range="445" />
<code_context>
-uv tool update-shell >/dev/null 2>&1 || true
+# uv skips shell configuration when its tool directory is already on PATH.
+# Use the caller's PATH and resolve uv before removing our temporary additions.
+uv_executable="$(type -P uv)"
+if ! PATH="$original_path" "$uv_executable" tool update-shell; then
+ warn 'Could not update shell PATH. Run the following command, then reload your shell:'
</code_context>
<issue_to_address>
**Installer exits before shell setup**
When `uv` is available only as an exported Bash function and no executable named `uv` is on `PATH`, `type -P uv` returns a failure status, so the assignment to `uv_executable` exits the installer under `set -e` before it can update shell configuration or print the warning and retry command. The installation has succeeded, but the installer ends with an error.
Handle a failed executable lookup without exiting, and fall back to invoking the available `uv` function or provide a diagnostic and retry path.
</issue_to_address>
### Comment 2
<location path="docs/public/install.sh" line_range="446" />
<code_context>
+# uv skips shell configuration when its tool directory is already on PATH.
+# Use the caller's PATH and resolve uv before removing our temporary additions.
+uv_executable="$(type -P uv)"
+if ! PATH="$original_path" "$uv_executable" tool update-shell; then
+ warn 'Could not update shell PATH. Run the following command, then reload your shell:'
+ printf '%s %q tool update-shell\n' "$indent" "$uv_executable"
</code_context>
<issue_to_address>
**uv is missing after shell reload**
When `UV_INSTALL_DIR` or `UV_UNMANAGED_INSTALL` points to a directory outside uv's tool-bin directory, `uv tool update-shell` adds the tool-bin directory but not the separate directory containing the `uv` executable, so after reloading the shell `astrbot` can be available while `uv` remains unavailable.
Also persist the directory containing the `uv` executable in the shell configuration.
</issue_to_address>
### Comment 3
<location path="docs/public/install.sh" line_range="445" />
<code_context>
-uv tool update-shell >/dev/null 2>&1 || true
+# uv skips shell configuration when its tool directory is already on PATH.
+# Use the caller's PATH and resolve uv before removing our temporary additions.
+uv_executable="$(type -P uv)"
+if ! PATH="$original_path" "$uv_executable" tool update-shell; then
+ warn 'Could not update shell PATH. Run the following command, then reload your shell:'
</code_context>
<issue_to_address>
**Retry command depends on directory**
When the installer resolves `uv` through a relative PATH entry, shell configuration update fails, and the user runs the suggested retry from a different working directory, `type -P` can return a relative executable path when `uv` is found through a relative PATH entry, and the printed retry command preserves that path; running it from another working directory cannot find `uv`, leaving shell configuration unupdated.
Resolve `uv_executable` to an absolute path before using it in the update and retry command.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if uv tool update-shell writes an incorrect PATH entry, it will persist in the user's shell configuration and may change which executable runs when a command is resolved. Reverting this installer change will not remove that entry, but the impact is bounded and can be repaired by editing the shell configuration.
Blocking findings: docs/public/install.sh:445, docs/public/install.sh:446
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9f0d71eb9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66ae882b23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94e47833f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Handle uv diagnostics with and without directory backticks, reject relative tool executable directories before package installation, and localize the shell PATH diagnostics for all supported languages. Add regression coverage for legacy uv, relative paths, wrapper overrides, localized diagnostics, and repeated shell setup using a real uv executable.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Remove the additional absolute-only tool directory restriction and its help text and translations. Leave directory validation and semantics to uv, without introducing path normalization or changing installation. Restore the tool-bin query to shell setup and replace the two restriction tests with one pass-through regression. Preserve the existing PATH, wrapper, retry, legacy uv, and localization coverage.
Use one small loop for the tool and uv executable directories, avoiding duplicated update-shell and error handling code. Keep original PATH and actionable errors; remove nonessential wrapper and localization branches. Reduce installer-specific regression tests to core behaviors.
Reuse uv's own update-shell command with the original PATH and resolved executable for both tool and uv directories. Normalize an invocation-only relative UV_TOOL_BIN_DIR before the installer changes its working directory. Remove diagnostics parsing, redundant handling, and nonessential tests; retain three targeted PATH reload regressions.
Query the actual uv tool executable directory before updating uv's own directory, so shared directories are not configured twice. Strengthen the existing reload regression test to reject duplicate PATH entries; retain the real uv directory query fixture because it is now used.
Rely on uv's built-in idempotent shell configuration instead of querying tool dir before updating uv's executable directory. Delete the unused fake tool-dir command and redundant test assertions; retain three behavioral PATH reload regressions.
…ories Resolve existing installer directory overrides before changing directories, and invoke the same uv provider when configuring tool PATH. Preserve the uv binary lookup in the original PATH and report genuine shell configuration errors while ignoring uv's already-configured diagnostic. Add focused regression tests for wrapper, function-only, relative uv path, repeated install, and configuration failures.
Fixes an installer PATH persistence bug where installation succeeds, but uv and astrbot remain unavailable after running source ~/.bashrc.
The installer temporarily adds executable directories to its own PATH. This caused uv tool update-shell to skip updating shell configuration, while its output and errors were silently discarded.
Modifications / 改动点
Screenshots or Test Results / 运行截图或测试结果
Verification commands:
bash -n docs/public/install.sh
python3 tests/test_install_script.py
uvx --from ruff==0.15.22 ruff format --check .
uvx --from ruff==0.15.22 ruff check .
git diff --check
Results:
Ran 21 tests
OK
531 files already formatted
All checks passed!
Also verified shell configuration using real uv 0.13.6 in an isolated Linux home directory. After reloading .bashrc, Bash successfully located both uv and the test astrbot executable. Package installation was stubbed for this check.
No documentation update is needed: the existing shell reload instructions remain valid, and this change does not affect WebUI navigation, page structure, or labels.
———
Checklist / 检查清单
Not applicable: this is a bug fix.
Summary by Sourcery
Fix installer PATH persistence so uv and AstrBot remain discoverable after shell reloads while reporting configuration update failures.
Bug Fixes:
Enhancements:
Tests: