Skip to content
Closed
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: 5 additions & 1 deletion scripts/start-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
DASHBOARD_PORT="${DASHBOARD_PORT:-18789}"

# ── Parse flags ──────────────────────────────────────────────────
SANDBOX_NAME="${NEMOCLAW_SANDBOX:-${SANDBOX_NAME:-default}}"
# SANDBOX_NAME precedence: --sandbox flag > SANDBOX_NAME env > NEMOCLAW_SANDBOX env > "default"
# Using SANDBOX_NAME:-... (not NEMOCLAW_SANDBOX:-SANDBOX_NAME:-...) ensures an explicit
# caller-set SANDBOX_NAME is not silently overridden by a stale NEMOCLAW_SANDBOX export.
_SANDBOX_DEFAULT="${NEMOCLAW_SANDBOX:-default}"
SANDBOX_NAME="${SANDBOX_NAME:-$_SANDBOX_DEFAULT}"
Comment on lines +22 to +26

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SANDBOX_NAME precedence has changed here, but the existing test coverage appears to still assert the old behavior (e.g., test/service-env.test.js has a case expecting NEMOCLAW_SANDBOX to override SANDBOX_NAME, and those tests also don’t execute start-services.sh directly). Please update/add tests to assert the new precedence (SANDBOX_NAME wins over NEMOCLAW_SANDBOX) and ideally exercise the script logic rather than duplicating a parameter-expansion snippet in the test.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify which scripts still use the old precedence pattern
echo "=== Scripts with old NEMOCLAW_SANDBOX:-SANDBOX_NAME pattern ==="
rg -n 'NEMOCLAW_SANDBOX:-.*SANDBOX_NAME' --type sh

echo ""
echo "=== Test files referencing the old pattern ==="
rg -n 'NEMOCLAW_SANDBOX:-.*SANDBOX_NAME' --type js --type ts

Repository: NVIDIA/NemoClaw

Length of output: 859


🏁 Script executed:

sed -n '120,160p' test/service-env.test.js

Repository: NVIDIA/NemoClaw

Length of output: 1646


🏁 Script executed:

sed -n '35,45p' scripts/debug.sh

Repository: NVIDIA/NemoClaw

Length of output: 310


Logic fix is correct; existing tests and debug.sh need updating to match new precedence.

The two-step expansion correctly implements the intended precedence (SANDBOX_NAME flag > SANDBOX_NAME env > NEMOCLAW_SANDBOX env > "default"). However, the following must be addressed:

  1. Test failure: test/service-env.test.js test "uses NEMOCLAW_SANDBOX over SANDBOX_NAME" (around line 133) will fail. It expects NEMOCLAW_SANDBOX="from-env" to take precedence over SANDBOX_NAME="old", but the new pattern gives SANDBOX_NAME precedence, so the test will return "old" instead of the expected "from-env". Update the test expectations to reflect the new precedence.

  2. Inconsistent sibling script: scripts/debug.sh:39 still uses the old pattern:

    SANDBOX_NAME="${NEMOCLAW_SANDBOX:-${SANDBOX_NAME:-}}"

    Update it to match the new precedence logic in start-services.sh.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/start-services.sh` around lines 22 - 26, Update the test expectation
and the sibling script to reflect the new SANDBOX_NAME precedence: change the
test in test/service-env.test.js for "uses NEMOCLAW_SANDBOX over SANDBOX_NAME"
to expect SANDBOX_NAME to win when both SANDBOX_NAME and NEMOCLAW_SANDBOX are
set (i.e., expect "old" instead of "from-env"), and edit scripts/debug.sh to use
the same two-step expansion pattern as start-services.sh (create a fallback var
like _SANDBOX_DEFAULT="${NEMOCLAW_SANDBOX:-default}" and then
SANDBOX_NAME="${SANDBOX_NAME:-$_SANDBOX_DEFAULT}") so both scripts share
identical precedence logic.

ACTION="start"

while [ $# -gt 0 ]; do
Expand Down
Loading