feat(env): add configurable port overrides via .env files#639
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughCentralizes and makes ports configurable: adds Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
README.md (2)
188-191: Add blank line before horizontal rule to fix Markdown structure.The horizontal rule
---immediately follows the blockquote without a blank line, which causes the static analysis warning. Adding a blank line improves the document structure.📝 Suggested fix
> When using local inference (Ollama or vLLM), the inference service binds to `0.0.0.0` so that containers can reach it via `host.openshell.internal`. This means the service is reachable from your local network, not just localhost. This is required for the sandbox architecture but should be considered in shared or untrusted network environments. + ---🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` around lines 188 - 191, The blockquote beginning with "> **⚠️ Network exposure**" is directly adjacent to the horizontal rule '---', causing a Markdown structure warning; insert a single blank line between the end of that blockquote and the '---' horizontal rule so the separator is on its own line and the document renders/analyses correctly.
176-180: Useconsolecode block with$prompt for CLI examples.The coding guidelines specify CLI code blocks should use the
consolelanguage tag with$prompt prefix for consistency with the documentation style.📝 Suggested fix
-```bash -export NEMOCLAW_GATEWAY_PORT=9080 -export NEMOCLAW_VLLM_PORT=9000 -nemoclaw onboard -``` +```console +$ export NEMOCLAW_GATEWAY_PORT=9080 +$ export NEMOCLAW_VLLM_PORT=9000 +$ nemoclaw onboard +```As per coding guidelines: "CLI code blocks must use the
consolelanguage tag with$prompt prefix. Flagbash orshell for CLI examples."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` around lines 176 - 180, Replace the current bash code block in README.md (the block showing NEMOCLAW_GATEWAY_PORT, NEMOCLAW_VLLM_PORT, and the `nemoclaw onboard` command) with a console-style CLI example: change the fence from ```bash to ```console and prefix each command line with a `$ ` prompt so the three lines become `$ export NEMOCLAW_GATEWAY_PORT=9080`, `$ export NEMOCLAW_VLLM_PORT=9000`, and `$ nemoclaw onboard`, then close the block with ```.docs/reference/port-configuration.md (1)
23-24: Consider active voice for the introduction.Line 24 uses passive voice ("are configurable"). Per coding guidelines, active voice is preferred.
📝 Suggested fix
NemoClaw uses four network ports. -All ports are configurable through environment variables or a `.env` file at the project root. +You can configure all ports through environment variables or a `.env` file at the project root.As per coding guidelines: "Active voice required. Flag passive constructions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/reference/port-configuration.md` around lines 23 - 24, Change the passive sentence "All ports are configurable through environment variables or a `.env` file at the project root." to an active-voice phrasing; locate the sentence text and replace it with something like "Configure all ports using environment variables or a `.env` file at the project root" (or similar active construction) so the intro reads actively after "NemoClaw uses four network ports."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/lib/env.js`:
- Around line 57-70: The inline comment stripping runs before quote stripping
which corrupts quoted values (e.g., KEY="value # comment"); change the logic to
detect and strip surrounding quotes from value first (handle both single and
double quotes on value), then only apply inline comment removal for unquoted
content, or alternatively locate a closing quote and treat any trailing text
after that as potential comment to strip; update the code paths around the value
variable where quotes are tested ((value.startsWith... && value.endsWith...))
and where hashIndex is computed so quoted hashes are preserved and only unquoted
inline comments are removed.
In `@scripts/check-ports.sh`:
- Around line 20-39: The load_env function currently strips comments from the
entire line before parsing, which truncates quoted values containing #; change
the parsing order in load_env: after trimming whitespace and skipping
blank/non-key lines, split the line into key and raw val first (using the
existing key="${line%%=*}" and val="${line#*=}"), then if val is not quoted
(doesn't start and end with matching ' or "), strip inline comments from val,
and only after that remove surrounding quotes and export if the key is unset;
keep the existing trimming of leading/trailing whitespace but move the
comment-stripping step to operate on unquoted vals only so quoted values like
KEY="value#with#hash" are preserved.
---
Nitpick comments:
In `@docs/reference/port-configuration.md`:
- Around line 23-24: Change the passive sentence "All ports are configurable
through environment variables or a `.env` file at the project root." to an
active-voice phrasing; locate the sentence text and replace it with something
like "Configure all ports using environment variables or a `.env` file at the
project root" (or similar active construction) so the intro reads actively after
"NemoClaw uses four network ports."
In `@README.md`:
- Around line 188-191: The blockquote beginning with "> **⚠️ Network exposure**"
is directly adjacent to the horizontal rule '---', causing a Markdown structure
warning; insert a single blank line between the end of that blockquote and the
'---' horizontal rule so the separator is on its own line and the document
renders/analyses correctly.
- Around line 176-180: Replace the current bash code block in README.md (the
block showing NEMOCLAW_GATEWAY_PORT, NEMOCLAW_VLLM_PORT, and the `nemoclaw
onboard` command) with a console-style CLI example: change the fence from
```bash to ```console and prefix each command line with a `$ ` prompt so the
three lines become `$ export NEMOCLAW_GATEWAY_PORT=9080`, `$ export
NEMOCLAW_VLLM_PORT=9000`, and `$ nemoclaw onboard`, then close the block with
```.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 53ae0b80-75af-45b8-974d-1ec3dc665d0e
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (29)
.env.exampleREADME.mdbin/lib/env.jsbin/lib/local-inference.jsbin/lib/nim.jsbin/lib/onboard.jsbin/lib/ports.jsbin/lib/preflight.jsbin/nemoclaw.jsdocs/reference/port-configuration.mddocs/reference/troubleshooting.mdnemoclaw-blueprint/blueprint.yamlnemoclaw-blueprint/orchestrator/runner.pyscripts/brev-setup.shscripts/check-ports.shscripts/debug.shscripts/lib/runtime.shscripts/nemoclaw-start.shscripts/setup.shscripts/start-services.shscripts/telegram-bridge.jstest/e2e/test-double-onboard.shtest/env.test.jstest/local-inference.test.jstest/onboard-readiness.test.jstest/onboard-selection.test.jstest/preflight.test.jstest/runtime-shell.test.jsuninstall.sh
💤 Files with no reviewable changes (1)
- scripts/telegram-bridge.js
4c99478 to
6a3aab4
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (3)
docs/reference/troubleshooting.md (2)
93-94: Use second-person wording in this troubleshooting intro.The new paragraph switches to an impersonal “onboarding fails …” description instead of telling the reader what they see. Keep the guide’s voice consistent and address the reader directly here.
As per coding guidelines, "Second person ("you") when addressing the reader."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/reference/troubleshooting.md` around lines 93 - 94, The troubleshooting intro uses impersonal phrasing; change the sentence "If another process is bound to one of these ports, onboarding fails with a message identifying the conflicting process." to second-person voice so it addresses the reader directly (e.g., "If another process is bound to one of these ports, you will see onboarding fail with a message identifying the conflicting process.")—update the sentence in the docs/reference/troubleshooting.md paragraph so the guide consistently uses "you" when addressing the reader.
110-115: Wrap the default port values in inline code.These are literal configuration values in the table, so format them the same way as the environment variable names in the next column.
As per coding guidelines, "CLI commands, file paths, flags, parameter names, and values must use inline
codeformatting."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/reference/troubleshooting.md` around lines 110 - 115, The default port numeric values (8080, 8000, 18789, 11434) in the table are not formatted as inline code; update the table so each default port is wrapped in backticks (e.g., `8080`) to match the inline code style used for the env vars like NEMOCLAW_GATEWAY_PORT and comply with the project's formatting guideline for CLI/parameter values.README.md (1)
184-190: Remove the emoji callout labels and fix the blockquote break.The
ℹ️and⚠️labels violate the Markdown guideline for technical prose, and the blank quoted separator in this block is whatMD028is warning about on Line 187.As per coding guidelines, "
**/*.md: ... No emoji in technical prose."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` around lines 184 - 190, Remove the emoji callout labels and the extra blank quote line in the README block: replace the quoted lines starting with "**ℹ️ Note**" and "**⚠️ Network exposure**" so they use plain text headings (e.g., "**Note**" and "**Network exposure**") without emojis, and ensure there is no empty blockquote separator between the two quoted paragraphs so the blockquote is continuous (this will satisfy MD028 and the "no emoji in technical prose" guideline).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/lib/onboard.js`:
- Line 13: The code requires DASHBOARD_PORT and GATEWAY_PORT before preflight()
copies .env.example so the first onboarding run still uses already-loaded
values; move the env-dependent require or re-read the env after preflight
completes: call preflight() (and any dotenv config) first, then
require("./ports") or re-initialize DASHBOARD_PORT/GATEWAY_PORT (same fix for
the duplicate block around the 329-337 region), ensuring the ports are resolved
only after the .env.example copy/persist step so the first run uses the
persisted, conflict-free ports.
- Around line 541-557: The build-time dashboard origin is not being updated
because CHAT_UI_URL and NEMOCLAW_DASHBOARD_PORT are only passed as runtime env
vars (chatUiUrl, envArgs) while the Dockerfile bakes a default ARG; fix by
creating a temporary Dockerfile derived from buildCtx/Dockerfile with the
ARG/default origin patched to use process.env.NEMOCLAW_DASHBOARD_PORT (or
directly inject the computed chatUiUrl), and then update createArgs to point
--from to that temporary Dockerfile path before calling the sandbox create CLI;
reference the existing symbols buildCtx, Dockerfile, createArgs, chatUiUrl and
envArgs so the code replaces the ARG/default in the Dockerfile copy and uses
that copy for the build so the custom dashboard port is baked into the image.
- Around line 652-653: After starting Ollama in the "ollama" and
"install-ollama" branches, replace the fixed sleep with a readiness probe that
reuses the existing runCapture call against
http://localhost:${OLLAMA_PORT}/api/tags (same check used to set ollamaRunning)
in a short retry loop (e.g., try every 500ms up to a few seconds/timeout); only
set provider = "ollama-local" and print the success message when the probe
returns healthy, otherwise log the failure and fall back/return an error. Use
the existing runCapture invocation and OLLAMA_PORT constant and ensure the
branch behavior mirrors the initial ollamaRunning check so a non-functional
service is not accepted.
---
Nitpick comments:
In `@docs/reference/troubleshooting.md`:
- Around line 93-94: The troubleshooting intro uses impersonal phrasing; change
the sentence "If another process is bound to one of these ports, onboarding
fails with a message identifying the conflicting process." to second-person
voice so it addresses the reader directly (e.g., "If another process is bound to
one of these ports, you will see onboarding fail with a message identifying the
conflicting process.")—update the sentence in the
docs/reference/troubleshooting.md paragraph so the guide consistently uses "you"
when addressing the reader.
- Around line 110-115: The default port numeric values (8080, 8000, 18789,
11434) in the table are not formatted as inline code; update the table so each
default port is wrapped in backticks (e.g., `8080`) to match the inline code
style used for the env vars like NEMOCLAW_GATEWAY_PORT and comply with the
project's formatting guideline for CLI/parameter values.
In `@README.md`:
- Around line 184-190: Remove the emoji callout labels and the extra blank quote
line in the README block: replace the quoted lines starting with "**ℹ️ Note**"
and "**⚠️ Network exposure**" so they use plain text headings (e.g., "**Note**"
and "**Network exposure**") without emojis, and ensure there is no empty
blockquote separator between the two quoted paragraphs so the blockquote is
continuous (this will satisfy MD028 and the "no emoji in technical prose"
guideline).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1e41884c-be73-43d1-b3c7-7ad89667a1a0
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (29)
.env.exampleREADME.mdbin/lib/env.jsbin/lib/local-inference.jsbin/lib/nim.jsbin/lib/onboard.jsbin/lib/ports.jsbin/lib/preflight.jsbin/nemoclaw.jsdocs/reference/port-configuration.mddocs/reference/troubleshooting.mdnemoclaw-blueprint/blueprint.yamlnemoclaw-blueprint/orchestrator/runner.pyscripts/brev-setup.shscripts/check-ports.shscripts/debug.shscripts/lib/runtime.shscripts/nemoclaw-start.shscripts/setup.shscripts/start-services.shscripts/telegram-bridge.jstest/e2e/test-double-onboard.shtest/env.test.jstest/local-inference.test.jstest/onboard-readiness.test.jstest/onboard-selection.test.jstest/preflight.test.jstest/runtime-shell.test.jsuninstall.sh
💤 Files with no reviewable changes (1)
- scripts/telegram-bridge.js
✅ Files skipped from review due to trivial changes (7)
- test/preflight.test.js
- scripts/setup.sh
- test/local-inference.test.js
- docs/reference/port-configuration.md
- test/env.test.js
- nemoclaw-blueprint/blueprint.yaml
- nemoclaw-blueprint/orchestrator/runner.py
🚧 Files skipped from review as they are similar to previous changes (14)
- bin/lib/preflight.js
- test/onboard-selection.test.js
- test/onboard-readiness.test.js
- uninstall.sh
- scripts/brev-setup.sh
- test/runtime-shell.test.js
- scripts/nemoclaw-start.sh
- test/e2e/test-double-onboard.sh
- bin/lib/local-inference.js
- bin/lib/ports.js
- bin/lib/env.js
- scripts/check-ports.sh
- scripts/start-services.sh
- bin/lib/nim.js
| const path = require("path"); | ||
| const { spawn, spawnSync } = require("child_process"); | ||
| const { ROOT, SCRIPTS, run, runCapture, shellQuote } = require("./runner"); | ||
| const { DASHBOARD_PORT, GATEWAY_PORT, VLLM_PORT, OLLAMA_PORT } = require("./ports"); |
There was a problem hiding this comment.
This .env bootstrap cannot change the first onboarding run.
Line 13 resolves DASHBOARD_PORT and GATEWAY_PORT before preflight() copies .env.example, so the current process keeps using the already-loaded values. As written, this block only creates a future-run template, and it still copies the static defaults instead of persisting conflict-free ports.
Also applies to: 329-337
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bin/lib/onboard.js` at line 13, The code requires DASHBOARD_PORT and
GATEWAY_PORT before preflight() copies .env.example so the first onboarding run
still uses already-loaded values; move the env-dependent require or re-read the
env after preflight completes: call preflight() (and any dotenv config) first,
then require("./ports") or re-initialize DASHBOARD_PORT/GATEWAY_PORT (same fix
for the duplicate block around the 329-337 region), ensuring the ports are
resolved only after the .env.example copy/persist step so the first run uses the
persisted, conflict-free ports.
b14d4d9 to
7a522ff
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.env.example (1)
5-8: Optional: reorder keys to satisfydotenv-linterUnorderedKeywarning.This is non-blocking, but reordering avoids persistent lint noise.
Proposed diff
NEMOCLAW_DASHBOARD_PORT=18789 NEMOCLAW_GATEWAY_PORT=8080 -NEMOCLAW_VLLM_PORT=8000 NEMOCLAW_OLLAMA_PORT=11434 +NEMOCLAW_VLLM_PORT=8000🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.env.example around lines 5 - 8, Reorder the environment variable lines so they follow dotenv-linter's expected ordering (alphabetical by key) to remove the UnorderedKey warning; specifically reorder the keys NEMOCLAW_DASHBOARD_PORT, NEMOCLAW_GATEWAY_PORT, NEMOCLAW_OLLAMA_PORT, NEMOCLAW_VLLM_PORT into alphabetical order (e.g., NEMOCLAW_DASHBOARD_PORT, NEMOCLAW_GATEWAY_PORT, NEMOCLAW_OLLAMA_PORT, NEMOCLAW_VLLM_PORT → adjust as needed to be strictly sorted) and commit the updated .env.example. Ensure no other unrelated changes are made.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 184-191: The two consecutive blockquotes ("ℹ️ Note" and "⚠️
Network exposure") lack a separating blank line and the horizontal rule '---'
directly follows the second blockquote, causing MD028; insert a single blank
line between the two blockquote blocks and ensure there is one blank line before
the '---' delimiter so the blockquotes are properly separated from each other
and from the horizontal rule.
---
Nitpick comments:
In @.env.example:
- Around line 5-8: Reorder the environment variable lines so they follow
dotenv-linter's expected ordering (alphabetical by key) to remove the
UnorderedKey warning; specifically reorder the keys NEMOCLAW_DASHBOARD_PORT,
NEMOCLAW_GATEWAY_PORT, NEMOCLAW_OLLAMA_PORT, NEMOCLAW_VLLM_PORT into
alphabetical order (e.g., NEMOCLAW_DASHBOARD_PORT, NEMOCLAW_GATEWAY_PORT,
NEMOCLAW_OLLAMA_PORT, NEMOCLAW_VLLM_PORT → adjust as needed to be strictly
sorted) and commit the updated .env.example. Ensure no other unrelated changes
are made.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 665b3891-43eb-4cd8-a1d7-e3734f062246
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (29)
.env.exampleREADME.mdbin/lib/env.jsbin/lib/local-inference.jsbin/lib/nim.jsbin/lib/onboard.jsbin/lib/ports.jsbin/lib/preflight.jsbin/nemoclaw.jsdocs/reference/port-configuration.mddocs/reference/troubleshooting.mdnemoclaw-blueprint/blueprint.yamlnemoclaw-blueprint/orchestrator/runner.pyscripts/brev-setup.shscripts/check-ports.shscripts/debug.shscripts/lib/runtime.shscripts/nemoclaw-start.shscripts/setup.shscripts/start-services.shscripts/telegram-bridge.jstest/e2e/test-double-onboard.shtest/env.test.jstest/local-inference.test.jstest/onboard-readiness.test.jstest/onboard-selection.test.jstest/preflight.test.jstest/runtime-shell.test.jsuninstall.sh
💤 Files with no reviewable changes (1)
- scripts/telegram-bridge.js
✅ Files skipped from review due to trivial changes (12)
- test/preflight.test.js
- bin/lib/preflight.js
- test/onboard-selection.test.js
- scripts/setup.sh
- test/local-inference.test.js
- test/runtime-shell.test.js
- nemoclaw-blueprint/blueprint.yaml
- test/e2e/test-double-onboard.sh
- docs/reference/port-configuration.md
- test/env.test.js
- scripts/check-ports.sh
- scripts/brev-setup.sh
🚧 Files skipped from review as they are similar to previous changes (12)
- bin/nemoclaw.js
- scripts/start-services.sh
- docs/reference/troubleshooting.md
- scripts/debug.sh
- scripts/nemoclaw-start.sh
- test/onboard-readiness.test.js
- bin/lib/local-inference.js
- bin/lib/ports.js
- uninstall.sh
- bin/lib/nim.js
- nemoclaw-blueprint/orchestrator/runner.py
- bin/lib/onboard.js
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
bin/lib/nim.js (1)
188-209: Minor inconsistency in port coercion.In
waitForNimHealth(line 159), the port is coerced withNumber(port)before use, but innimStatus(line 200), the port is used directly in the template literal. While this works because the port should already be a number, consider applying consistent coercion for defensive coding.♻️ Optional consistency fix
function nimStatus(sandboxName, port = VLLM_PORT) { const name = containerName(sandboxName); + const safePort = Number(port); try { const state = runCapture( `docker inspect --format '{{.State.Status}}' ${shellQuote(name)} 2>/dev/null`, { ignoreError: true } ); if (!state) return { running: false, container: name }; let healthy = false; if (state === "running") { - const health = runCapture(`curl -sf http://localhost:${port}/v1/models 2>/dev/null`, { + const health = runCapture(`curl -sf http://localhost:${safePort}/v1/models 2>/dev/null`, { ignoreError: true, }); healthy = !!health; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bin/lib/nim.js` around lines 188 - 209, nimStatus uses the port directly in the curl template while waitForNimHealth coerces it via Number(port); make this consistent and defensive by coercing the port at the top of nimStatus (e.g., const p = Number(port) or similar) and use p when building the curl/runCapture call and any other place the port is interpolated; update nimStatus (function name) so the default param remains VLLM_PORT but all runtime uses use the numeric value to avoid string/formatting issues with runCapture/curl.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@uninstall.sh`:
- Around line 111-128: The _load_env function currently strips comments early
using line="${line%%#*}", which truncates quoted values containing # (e.g.,
KEY="value#with#hash"); modify _load_env so comment removal happens only after
splitting key and val and only when the value is unquoted or when the # is not
inside surrounding quotes: parse the line into key and val first (using the
existing key="${line%%=*}" and val="${line#*=}"), detect whether val is quoted
(starts and ends with " or '), and only strip trailing comments from unquoted
vals (or strip # outside quotes); preserve the existing trimming/unquoting logic
and the conditional export logic (export "$key=$val") so quoted values retain
embedded # characters.
---
Nitpick comments:
In `@bin/lib/nim.js`:
- Around line 188-209: nimStatus uses the port directly in the curl template
while waitForNimHealth coerces it via Number(port); make this consistent and
defensive by coercing the port at the top of nimStatus (e.g., const p =
Number(port) or similar) and use p when building the curl/runCapture call and
any other place the port is interpolated; update nimStatus (function name) so
the default param remains VLLM_PORT but all runtime uses use the numeric value
to avoid string/formatting issues with runCapture/curl.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b742ee98-5b6e-4d3b-8498-5d60f64c29b6
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (29)
.env.exampleREADME.mdbin/lib/env.jsbin/lib/local-inference.jsbin/lib/nim.jsbin/lib/onboard.jsbin/lib/ports.jsbin/lib/preflight.jsbin/nemoclaw.jsdocs/reference/port-configuration.mddocs/reference/troubleshooting.mdnemoclaw-blueprint/blueprint.yamlnemoclaw-blueprint/orchestrator/runner.pyscripts/brev-setup.shscripts/check-ports.shscripts/debug.shscripts/lib/runtime.shscripts/nemoclaw-start.shscripts/setup.shscripts/start-services.shscripts/telegram-bridge.jstest/e2e/test-double-onboard.shtest/env.test.jstest/local-inference.test.jstest/onboard-readiness.test.jstest/onboard-selection.test.jstest/preflight.test.jstest/runtime-shell.test.jsuninstall.sh
💤 Files with no reviewable changes (1)
- scripts/telegram-bridge.js
✅ Files skipped from review due to trivial changes (15)
- test/preflight.test.js
- bin/nemoclaw.js
- bin/lib/preflight.js
- test/onboard-readiness.test.js
- docs/reference/troubleshooting.md
- test/local-inference.test.js
- test/runtime-shell.test.js
- README.md
- nemoclaw-blueprint/blueprint.yaml
- docs/reference/port-configuration.md
- test/e2e/test-double-onboard.sh
- test/env.test.js
- bin/lib/env.js
- test/onboard-selection.test.js
- nemoclaw-blueprint/orchestrator/runner.py
🚧 Files skipped from review as they are similar to previous changes (5)
- scripts/brev-setup.sh
- scripts/setup.sh
- scripts/debug.sh
- bin/lib/local-inference.js
- bin/lib/onboard.js
7a522ff to
505df8f
Compare
Allow users to override default service ports (GATEWAY_PORT, REDIS_PORT, SANDBOX_PORT) through .env and .env.local files. This prevents conflicts when default ports are already in use on the host, without relying on ephemeral shell memory. New files: - bin/lib/env.js — .env/.env.local loader (dotenv) - bin/lib/ports.js — port defaults and validation - scripts/check-ports.sh — port diagnostic utility - docs/reference/port-configuration.md — user-facing reference - test/env.test.js — env loading tests - .env.example — documents available overrides Modified files: - bin/nemoclaw.js — load env at CLI entry point - bin/lib/onboard.js — port-conflict detection and .env bootstrap - bin/lib/preflight.js — pass port env vars to preflight checks - bin/lib/local-inference.js — use configured ports - bin/lib/nim.js — use configured ports - nemoclaw-blueprint/blueprint.yaml — parameterize service ports - nemoclaw-blueprint/orchestrator/runner.py — read port env vars - scripts/brev-setup.sh — source .env before start - scripts/debug.sh — source .env before start - scripts/lib/runtime.sh — source .env before start - scripts/nemoclaw-start.sh — source .env before start - scripts/setup.sh — source .env before start - scripts/start-services.sh — source .env before start - scripts/telegram-bridge.js — remove unused import - uninstall.sh — load env, use configured ports - README.md — add port configuration section - docs/reference/troubleshooting.md — add port override guidance - package-lock.json — lockfile update for dotenv - test/e2e/test-double-onboard.sh — use configurable ports - test/local-inference.test.js — use configurable ports - test/onboard-readiness.test.js — use configurable ports - test/onboard-selection.test.js — use configurable ports - test/preflight.test.js — use configurable ports - test/runtime-shell.test.js — use configurable ports
505df8f to
091002b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (3)
docs/reference/port-configuration.md (2)
24-24: Passive voice detected.Line 24 uses passive voice: "All ports are configurable."
Consider active voice: "You can configure all ports through environment variables or a
.envfile at the project root."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/reference/port-configuration.md` at line 24, Replace the passive sentence "All ports are configurable through environment variables or a `.env` file at the project root." with an active-voice instruction such as "You can configure all ports through environment variables or a `.env` file at the project root." in docs/reference/port-configuration.md to improve clarity.
54-54: Passive voice detected.Line 54 uses passive voice: "The
.envfile is gitignored and not committed to the repository."Consider: "Git ignores the
.envfile, so your changes remain local."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/reference/port-configuration.md` at line 54, Replace the passive sentence "The `.env` file is gitignored and not committed to the repository." with an active-voice version; for example, change it to "Git ignores the `.env` file, so your changes remain local." Update the exact string in the docs to use that active phrasing (refer to the sentence "The `.env` file is gitignored and not committed to the repository.") so the intent is clearer and uses active voice.scripts/start-services.sh (1)
19-24: Minor inconsistency with the documented fallback chain.The documented fallback chain (in
docs/reference/port-configuration.mdlines 73-76) is:
NEMOCLAW_DASHBOARD_PORTDASHBOARD_PORTPUBLIC_PORT18789This script's fallback omits
PUBLIC_PORT:DASHBOARD_PORT="${NEMOCLAW_DASHBOARD_PORT:-${DASHBOARD_PORT:-18789}}"If
PUBLIC_PORTis intentionally excluded here (since this script focuses on services rather than the dashboard itself), consider adding a comment to clarify. Otherwise:♻️ Align with the documented fallback chain
-DASHBOARD_PORT="${NEMOCLAW_DASHBOARD_PORT:-${DASHBOARD_PORT:-18789}}" +DASHBOARD_PORT="${NEMOCLAW_DASHBOARD_PORT:-${DASHBOARD_PORT:-${PUBLIC_PORT:-18789}}}"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/start-services.sh` around lines 19 - 24, The DASHBOARD_PORT assignment omits the documented PUBLIC_PORT fallback; update the expansion so DASHBOARD_PORT="${NEMOCLAW_DASHBOARD_PORT:-${DASHBOARD_PORT:-${PUBLIC_PORT:-18789}}}" to match the documented chain (referencing NEMOCLAW_DASHBOARD_PORT, DASHBOARD_PORT, PUBLIC_PORT), or if omission was intentional, add a short comment above the DASHBOARD_PORT line stating why PUBLIC_PORT is excluded to avoid confusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/reference/port-configuration.md`:
- Line 24: Replace the passive sentence "All ports are configurable through
environment variables or a `.env` file at the project root." with an
active-voice instruction such as "You can configure all ports through
environment variables or a `.env` file at the project root." in
docs/reference/port-configuration.md to improve clarity.
- Line 54: Replace the passive sentence "The `.env` file is gitignored and not
committed to the repository." with an active-voice version; for example, change
it to "Git ignores the `.env` file, so your changes remain local." Update the
exact string in the docs to use that active phrasing (refer to the sentence "The
`.env` file is gitignored and not committed to the repository.") so the intent
is clearer and uses active voice.
In `@scripts/start-services.sh`:
- Around line 19-24: The DASHBOARD_PORT assignment omits the documented
PUBLIC_PORT fallback; update the expansion so
DASHBOARD_PORT="${NEMOCLAW_DASHBOARD_PORT:-${DASHBOARD_PORT:-${PUBLIC_PORT:-18789}}}"
to match the documented chain (referencing NEMOCLAW_DASHBOARD_PORT,
DASHBOARD_PORT, PUBLIC_PORT), or if omission was intentional, add a short
comment above the DASHBOARD_PORT line stating why PUBLIC_PORT is excluded to
avoid confusion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 494c5533-6011-4d39-9dab-645355113cd4
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (29)
.env.exampleREADME.mdbin/lib/env.jsbin/lib/local-inference.jsbin/lib/nim.jsbin/lib/onboard.jsbin/lib/ports.jsbin/lib/preflight.jsbin/nemoclaw.jsdocs/reference/port-configuration.mddocs/reference/troubleshooting.mdnemoclaw-blueprint/blueprint.yamlnemoclaw-blueprint/orchestrator/runner.pyscripts/brev-setup.shscripts/check-ports.shscripts/debug.shscripts/lib/runtime.shscripts/nemoclaw-start.shscripts/setup.shscripts/start-services.shscripts/telegram-bridge.jstest/e2e/test-double-onboard.shtest/env.test.jstest/local-inference.test.jstest/onboard-readiness.test.jstest/onboard-selection.test.jstest/preflight.test.jstest/runtime-shell.test.jsuninstall.sh
💤 Files with no reviewable changes (1)
- scripts/telegram-bridge.js
✅ Files skipped from review due to trivial changes (14)
- test/onboard-readiness.test.js
- scripts/lib/runtime.sh
- .env.example
- bin/lib/local-inference.js
- test/local-inference.test.js
- bin/nemoclaw.js
- test/preflight.test.js
- README.md
- nemoclaw-blueprint/blueprint.yaml
- test/env.test.js
- test/runtime-shell.test.js
- bin/lib/ports.js
- scripts/check-ports.sh
- nemoclaw-blueprint/orchestrator/runner.py
🚧 Files skipped from review as they are similar to previous changes (7)
- test/onboard-selection.test.js
- scripts/setup.sh
- scripts/debug.sh
- bin/lib/preflight.js
- test/e2e/test-double-onboard.sh
- uninstall.sh
- bin/lib/onboard.js
Summary
NemoClaw service ports can already be overridden via shell exports, but those settings are ephemeral. This adds
.env/.env.localfile support so developers can persist port overrides (GATEWAY_PORT,REDIS_PORT,SANDBOX_PORT) per workstation without modifying tracked files.Solution
A
.envloader (bin/lib/env.js) runs at CLI startup before any module readsprocess.env. A centralbin/lib/ports.jsdefines defaults. All shell entry points source.envfiles, and the blueprint reads port values from the environment with fallbacks to the original defaults. Duringnemoclaw onboard, port-conflict detection offers to bootstrap a.envfile with available alternatives.Changes
New files:
bin/lib/env.js—.env/.env.localloader (dotenv)bin/lib/ports.js— port defaults and validationscripts/check-ports.sh— port diagnostic utilitydocs/reference/port-configuration.md— user-facing referencetest/env.test.js— env loading tests.env.example— documents available overridesModified:
bin/nemoclaw.js— load env at CLI entry pointbin/lib/onboard.js— port-conflict detection and.envbootstrapbin/lib/preflight.js,bin/lib/local-inference.js,bin/lib/nim.js— use configured portsnemoclaw-blueprint/blueprint.yaml,nemoclaw-blueprint/orchestrator/runner.py— parameterize service portsscripts/brev-setup.sh,scripts/debug.sh,scripts/lib/runtime.sh,scripts/nemoclaw-start.sh,scripts/setup.sh,scripts/start-services.sh— source.envbefore startscripts/telegram-bridge.js— remove unused importuninstall.sh— load env, use configured portsREADME.md,docs/reference/troubleshooting.md— port configuration docspackage-lock.json— lockfile update for dotenvtest/e2e/test-double-onboard.sh,test/local-inference.test.js,test/onboard-readiness.test.js,test/onboard-selection.test.js,test/preflight.test.js,test/runtime-shell.test.js— use configurable portsTest plan
install-preflight.test.jsreproduce onmain)nemoclaw onboardwith default ports — behavior unchangedGATEWAY_PORT=9090in.env.local, runnemoclaw onboard— gateway binds to 9090.envbootstrapSummary by CodeRabbit
New Features
Documentation
Tests