v0.21.9.0 fix(host): reorder remoteEnvPrep so mise activates when binary is at ~/.local/bin#62
Merged
Merged
Conversation
The v0.21.6 attempt at fixing canopy host upgrade still failed on the canonical mise install layout (curl https://mise.run | sh → mise at ~/.local/bin/mise) because the snippet ran `command -v mise` BEFORE adding ~/.local/bin to PATH. With bash -l non-interactive over SSH, ~/.bashrc bails before the user's PATH addition, so the check missed mise, activation was skipped, no Go shim landed on PATH, and the remote canopy upgrade died at make install with "go: No such file or directory" — exactly reproducing the v0.21.4.0 regression we set out to fix. Reorder: static path prepend (~/.local/bin, /usr/local/go/bin, ~/go/bin) runs first, THEN mise activation, THEN asdf hook. Mise is now reachable when its binary lives at ~/.local/bin/mise, the default for hosts installed via the official one-liner. Adds TestRemoteEnvPrep_ActivatesMiseInUserLocalBin as a regression test that stubs mise at $HOME/.local/bin/mise with PATH stripped to /usr/bin:/bin and asserts the stub's shim dir lands on PATH. The contract under test: mise activation must run AFTER the static loop has made the binary reachable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Document the remoteEnvPrep fix in the user-facing docs: - docs/remote-workspaces.md: extend the "Upgrading a remote" `U` bullet to explain the PATH prepend + mise/asdf activation that lets remote upgrades find `go` on hosts where the toolchain is wired through ~/.bashrc. - docs/troubleshooting.md: add a new entry under the v0.17 remote troubleshooting section for the `make: go: No such file or directory` failure mode, with the fix (upgrade laptop canopy to v0.21.7.0+) and the fallback if the user is still stuck. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ke-path # Conflicts: # CHANGELOG.md # VERSION
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix for
canopy host upgradeon hosts where the Go toolchain lives behind~/.bashrc(mise/asdf activated only in interactive shells).The v0.21.4.0 fix wrapped the remote shell in
bash -lto source~/.bash_profile/~/.profile. That solved hosts whose toolchain is wired through login files, but on Omarchy/Arch/Ubuntu — where~/.bashrcearly-exits on[[ $- != *i* ]] && return— non-interactive bash never sources bashrc, mise never activates, andmake installdies withmake: go: No such file or directory.This PR rewrites
remoteEnvPrepininternal/ui/update_host_upgrade.goto bypass bashrc entirely: prepend static toolchain paths (~/.local/bin,/usr/local/go/bin,~/go/bin) first, theneval "$(mise activate bash)"(now reachable because~/.local/binis on PATH), then source~/.asdf/asdf.sh. The ordering is load-bearing: an earlier draft rancommand -v miseBEFORE the static prepend, which silently missed mise installed via the canonicalcurl https://mise.run | sh(binary at~/.local/bin/mise) — reproducing the original failure. Adversarial review caught it pre-merge.Rebased onto current main (took v0.21.9.0 slot — v0.21.7.0 and v0.21.8.0 landed during review).
Test Coverage
Coverage: ~79% (9 covered + 1 partial / 12 branches). Tests: +5 new in
internal/ui/update_host_upgrade_test.go.Pre-Landing Review
No critical issues. 4 INFORMATIONAL specialist findings (conf 5-7) judged low-value cosmetics per project's "no premature abstraction" guideline. Adversarial review caught a real ordering bug — fixed in
da91034, regression-pinned byTestRemoteEnvPrep_ActivatesMiseInUserLocalBin. PR Quality Score: 8/10.Plan Completion
No plan file — this was reactive bug-fix work.
TODOS
No items completed.
Documentation
docs/remote-workspaces.md: extended theUbullet under "Upgrading a remote" to explain mise/asdf direct activation.docs/troubleshooting.md: new entry for themake: go: No such file or directoryfailure mode with the fix (upgrade laptop canopy to v0.21.9.0+) and fallback if Go is installed outside the prepended locations.Test plan
go test ./...passes (cmd/canopy + all internal/* packages)go test -race ./internal/ui/passes (new CI requirement from v0.21.8.0)TestRemoteEnvPrep_ActivatesMiseInUserLocalBinregression test passes; reverse the snippet order → test fails with clear diagnostic/usr/bin/misesurfaces shim PATH; with stubbed mise at~/.local/bin/mise+PATH=/usr/bin:/binactivation runs and shim dir lands on PATHcanopy host upgrade towerfrom TUI should succeed end-to-end (requires laptop canopy at v0.21.9.0+)🤖 Generated with Claude Code