Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ NODE
# backup flow can run before any version bump.
maybe_install_openshell_during_install() {
local mode="${1:-force}"
local explicit_openshell_bin="${NEMOCLAW_OPENSHELL_BIN:-}"
if truthy_env "${NEMOCLAW_DEFER_OPENSHELL_INSTALL:-}"; then
info "Deferring OpenShell CLI installation until after pre-upgrade backup."
return 0
Expand All @@ -1534,6 +1535,11 @@ maybe_install_openshell_during_install() {
warn "Homebrew is not installed; using the standalone OpenShell gateway without reboot persistence."
fi
prefer_user_local_openshell
# Service discovery still uses the user-local PATH, but a source-checkout
# caller's executable selection remains authoritative for onboarding.
if [[ "$explicit_openshell_bin" == /* && -x "$explicit_openshell_bin" ]]; then
export NEMOCLAW_OPENSHELL_BIN="$explicit_openshell_bin"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
fi
install_nemoclaw_openshell_gateway_user_service
return 0
fi
Expand Down
76 changes: 76 additions & 0 deletions test/e2e/support/hermes-gpu-startup-fallback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from "../live/hermes-gpu-startup-fallback.ts";

const roots: string[] = [];
const INSTALLER_PAYLOAD = path.join(import.meta.dirname, "..", "..", "..", "scripts", "install.sh");

afterEach(() => {
for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true });
Expand Down Expand Up @@ -227,6 +228,81 @@ describe("Hermes GPU startup fallback OpenShell wrapper", () => {
]);
});

it("preserves the fallback wrapper while staging the existing OpenShell service (#7140)", () => {
const { realDir, root, wrapper } = createWrapperFixture(
"hermes-gpu-fallback-installer-selection-",
);
const result = spawnSync(
"bash",
[
"-c",
[
'source "$INSTALLER_PAYLOAD" 2>/dev/null',
"install_nemoclaw_openshell_gateway_user_service() {",
' printf "service-selection=%s\\n" "$NEMOCLAW_OPENSHELL_BIN"',
' printf "service-gateway=%s\\n" "$NEMOCLAW_OPENSHELL_GATEWAY_BIN"',
' printf "service-path=%s\\n" "$PATH"',
"}",
"maybe_install_openshell_during_install if-missing",
'printf "final-selection=%s\\n" "$NEMOCLAW_OPENSHELL_BIN"',
].join("\n"),
],
{
encoding: "utf8",
env: {
...process.env,
...wrapper.componentEnv,
HOME: root,
INSTALLER_PAYLOAD,
PATH: `${realDir}:/usr/bin:/bin`,
XDG_BIN_HOME: realDir,
},
},
);

expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0);
expect(result.stdout).toContain(`service-selection=${wrapper.wrapperPath}\n`);
expect(result.stdout).toContain(`service-gateway=${path.join(realDir, "openshell-gateway")}\n`);
expect(result.stdout.match(/^service-path=(.*)$/mu)?.[1]?.split(":")[0]).toBe(realDir);
expect(result.stdout).toContain(`final-selection=${wrapper.wrapperPath}\n`);
});

it("rejects a relative fallback wrapper selection during service staging (#7140)", () => {
const { realDir, root, wrapper } = createWrapperFixture(
"hermes-gpu-fallback-relative-selection-",
);
const relativeBin = path.join(root, "relative-openshell");
writeExecutable(relativeBin, "#!/usr/bin/env bash\nexit 0\n");
const result = spawnSync(
"bash",
[
"-c",
[
'source "$INSTALLER_PAYLOAD" 2>/dev/null',
"install_nemoclaw_openshell_gateway_user_service() { :; }",
"maybe_install_openshell_during_install if-missing",
'printf "final-selection=%s\\n" "$NEMOCLAW_OPENSHELL_BIN"',
].join("\n"),
],
{
cwd: root,
encoding: "utf8",
env: {
...process.env,
...wrapper.componentEnv,
HOME: root,
INSTALLER_PAYLOAD,
NEMOCLAW_OPENSHELL_BIN: "./relative-openshell",
PATH: `${realDir}:/usr/bin:/bin`,
XDG_BIN_HOME: realDir,
},
},
);

expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0);
expect(result.stdout).toContain(`final-selection=${path.join(realDir, "openshell")}\n`);
});

it("rejects exactly one native nvidia-smi proof when wrapper calls race", async () => {
const { wrapper } = createWrapperFixture("hermes-gpu-fallback-race-test-");
const env = { ...process.env, ...wrapper.componentEnv };
Expand Down
Loading