Skip to content

fix(e2e): re-add ~/.local/bin to PATH after .bashrc sourcing#3156

Closed
hunglp6d wants to merge 1 commit into
codex/openshell-docker-gpu-onboardfrom
fix/nightly-e2e-e2e-install-path-refresh-c25df40
Closed

fix(e2e): re-add ~/.local/bin to PATH after .bashrc sourcing#3156
hunglp6d wants to merge 1 commit into
codex/openshell-docker-gpu-onboardfrom
fix/nightly-e2e-e2e-install-path-refresh-c25df40

Conversation

@hunglp6d

@hunglp6d hunglp6d commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Four E2E test scripts fail during ensure_install() / Phase 0 because source ~/.bashrc triggers nvm.sh, which rebuilds $PATH from scratch and drops ~/.local/bin — the directory where install.sh places the openshell and nemoclaw binaries. The command -v check immediately after .bashrc sourcing cannot find the binaries and exits with "nemoclaw not found" / "openshell still missing after install".

This PR applies the same PATH-refresh guard already used by the passing test-cloud-onboard-e2e.sh: re-add ~/.local/bin immediately after sourcing .bashrc.

Diagnosed from nightly-e2e run #25468013036 (commit c25df40).

Related Issue

Changes

  • test/e2e/test-deployment-services.sh — add PATH refresh after .bashrc sourcing in install_nemoclaw()
  • test/e2e/test-diagnostics.sh — same fix in install_nemoclaw()
  • test/e2e/test-network-policy.sh — same fix in install_nemoclaw()
  • test/e2e/test-credential-migration.sh — add .bashrc sourcing + PATH refresh after install.sh call in Phase 0

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Evidence

Failing jobs (4):

Job Error
deployment-services-e2e nemoclaw not found after install.sh
diagnostics-e2e nemoclaw not found after install.sh
network-policy-e2e nemoclaw not found after install.sh
credential-migration-e2e openshell still missing after install

Root cause: nvm.sh (loaded via .bashrc) reconstructs $PATH without preserving ~/.local/bin, so install.sh-managed binaries become invisible.

Passing reference: test-cloud-onboard-e2e.sh lines 204-214 already guard against this with:

if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
  export PATH="$HOME/.local/bin:$PATH"
fi

Verification

  • bash -n passes on all four edited scripts
  • No secrets, API keys, or credentials committed
  • npx prek run --all-files passes
  • npm test passes

Signed-off-by: Hung Le hple@nvidia.com

install.sh places openshell/nemoclaw under ~/.local/bin, but sourcing
.bashrc triggers nvm.sh which rebuilds $PATH from scratch, dropping the
entry.  Four E2E test helpers (deployment-services, diagnostics,
network-policy, credential-migration) checked for the binaries after
.bashrc but before re-adding ~/.local/bin, causing them to fail with
"nemoclaw not found" / "openshell still missing after install".

Apply the same PATH-refresh guard already used by the passing
test-cloud-onboard-e2e.sh: re-add ~/.local/bin immediately after
sourcing .bashrc so the check succeeds regardless of nvm ordering.

Signed-off-by: Hung Le <hple@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented May 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 09596236-3e88-452e-a4c0-96ab15add9b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nightly-e2e-e2e-install-path-refresh-c25df40

Comment @coderabbitai help to get the list of available commands and usage tips.

@hunglp6d

hunglp6d commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

Closed due to replacement: #3200 @gaveezy

jyaunches added a commit that referenced this pull request May 7, 2026
## Summary

The e2e test harness sources `~/.bashrc` to pick up the
freshly-installed `nemoclaw` CLI, but on images whose `.bashrc` resets
`PATH` (or unconditionally prepends system paths) this wipes the
`~/.local/bin` entry that `install.sh` just added, breaking every
downstream `nemoclaw ...` invocation. This PR re-adds `~/.local/bin` to
`PATH` after `.bashrc` sourcing and extracts the pattern into a shared
helper so it stays consistent as more scripts adopt it.

## Related Issue

Supersedes #3156 (cherry-picked with author credit preserved to Hung
Le).

## Changes

- **Fix (cherry-picked from #3156, attribution preserved):** re-add
`~/.local/bin` to `PATH` after sourcing `~/.bashrc` in the cloud e2e
test scripts, so the installed `nemoclaw` CLI remains resolvable on
images whose `.bashrc` rewrites `PATH`.
- **Refactor:** extract the PATH-refresh pattern into
`test/e2e/lib/install-path-refresh.sh` with two helpers:
- `nemoclaw_refresh_install_env` — source `.bashrc` then guarantee
`~/.local/bin` is on `PATH`
- `nemoclaw_ensure_local_bin_on_path` — idempotent prepend of
`~/.local/bin`
- Migrate 6 scripts (4 PR-touched + 2 adjacent references) to the
helper: `test-cloud-inference-e2e.sh`, `test-cloud-onboard-e2e.sh`,
`test-credential-migration.sh`, `test-deployment-services.sh`,
`test-diagnostics.sh`, `test-network-policy.sh`.
- Net diff: +67 / −33 lines across 7 files (including the new 41-line
helper).

**Follow-up (not in this PR):** ~23 additional e2e scripts also carry a
copy of the inline `.local/bin on PATH` guard. Intentionally left out to
keep this PR scoped to the scripts flagged in the original review.
Tracked in #3201.

## Type of Change

- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification

- [x] `npx prek run --all-files` passes
- [ ] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

**Verification notes:**
- `bash -n` syntax check passes on the new helper and all 6 migrated
scripts.
- Helper is sourceable via all three patterns the scripts use: `dirname
"${BASH_SOURCE[0]}"/lib/`, `${E2E_DIR}/lib/`, and
`${SCRIPT_DIR_TIMEOUT}/lib/`.
- Functional test of `nemoclaw_ensure_local_bin_on_path` confirmed:
prepends `~/.local/bin` when missing, is idempotent when already
present.
- Zero inline leftovers of the old pattern in the 6 migrated scripts.
- `npm test` has 18 unrelated timeout failures in
`test/install-preflight.test.ts` (installer integration suite) on this
machine; this PR does not touch that file (0 diff lines against it) and
does not modify any code path it exercises. The actual e2e scripts
changed here run in the Brev cloud suite, which is out of the `npm test`
scope.

---
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

---------

Signed-off-by: Hung Le <hple@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Co-authored-by: Hung Le <hple@nvidia.com>
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression and removed fix labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants