docs(deploy): pin Hub Bun recovery version - #781
Conversation
独立窄审 · PR #781 (Draft)Verdict: CLEAN — no BLOCKER, no MAJOR, no MINOR. Reviewer: 通信IM马 (independent, read-only). Extracted PR tree via Provenance (with 1 typo note)
Provenance note: brief states base = Item-by-item①
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 727bedb8e2
ℹ️ 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".
| # node 版本后通常要重装。若采用其它布局,必须让 command -v bun 可见, | ||
| # 或在 hub.env 显式设置可执行的 BUN_BIN。 |
There was a problem hiding this comment.
Do not direct operators to set BUN_BIN in hub.env
When Bun is not on the PM2 process's PATH, the newly documented hub.env fallback cannot work: deploy/hub/hub-daemon.sh resolves and validates BUN_BIN at lines 71–87, but does not source hub.env until line 129. An operator following this instruction will therefore still get the “找不到 bun” failure; either source the override before resolution or document a location that PM2 actually exports into the launcher environment.
AGENTS.md reference: AGENTS.md:L24-L24
Useful? React with 👍 / 👎.
| npm i -g "bun@$BUN_VERSION" | ||
| BUN_BIN="$(command -v bun)" | ||
| test -x "$BUN_BIN" | ||
| test "$("$BUN_BIN" --version)" = "$BUN_VERSION" # 版本不符即停,不拿 future latest 冒充当前运行时 |
There was a problem hiding this comment.
Actually stop when the Bun version differs
When command -v bun resolves an older executable—for example because the global install used another prefix—or when installation fails while an old Bun remains on PATH, this standalone test only returns a nonzero status. The block neither enables set -e nor chains subsequent recovery commands with &&, so an interactive paste silently continues installing the launcher despite the claimed fail-closed gate and can restore production with a non-reproducible runtime.
AGENTS.md reference: AGENTS.md:L25-L25
Useful? React with 👍 / 👎.
| BUN_BIN="$(command -v bun)" | ||
| test -x "$BUN_BIN" | ||
| test "$("$BUN_BIN" --version)" = "$BUN_VERSION" # 版本不符即停,不拿 future latest 冒充当前运行时 |
There was a problem hiding this comment.
Validate the Bun executable the daemon will select
When ~/.nvm/versions/node/v20.20.0/bin/bun remains executable, hub-daemon.sh selects that hard-coded path before consulting command -v bun (lines 63–65). These new checks can therefore validate a newly installed Bun 1.3.14 on the current PATH while PM2 actually starts Hub with an older Bun from the hard-coded Node directory; the recovery gate needs to resolve and verify the same executable as the launcher.
AGENTS.md reference: AGENTS.md:L25-L25
Useful? React with 👍 / 👎.
| BUN_VERSION=1.3.14 | ||
| npm i -g "bun@$BUN_VERSION" | ||
| BUN_BIN="$(command -v bun)" | ||
| test -x "$BUN_BIN" | ||
| test "$("$BUN_BIN" --version)" = "$BUN_VERSION" # 版本不符即停,不拿 future latest 冒充当前运行时 |
There was a problem hiding this comment.
Commit the claimed Docker recovery evidence
For this critical recovery-path change, the commit claims a Docker install/version-gate run but adds only the README; a repo-wide search finds neither the reported BUN_PIN_PASS output nor its log hash in docs/tests/, so a future empty-machine rebuild cannot inspect or rerun the claimed rehearsal from repository state. Add the independent Docker harness and saved report for this gate rather than leaving the only evidence outside the tree.
AGENTS.md reference: AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
Why
PR #779 added the missing Bun recovery step, but its unpinned npm install command would fetch a future latest release. That means a rebuilt server would not reproduce the currently deployed runtime.
This append-only follow-up pins Bun 1.3.14, fails closed when the resolved executable reports another version, and documents the real hub-daemon.sh resolution contract: PATH or an explicit BUN_BIN are valid; the current nvm layout is not mandatory.
Prior review finding: #779 (comment)
Scope
Verification
Boundaries
This PR documents recovery only. It does not install Bun on production, change hub.env, restart Hub, publish packages, or claim that databases/secrets are reproducible from Git.