fix: stream sandbox logs via tail (Fixes #253)#1039
fix: stream sandbox logs via tail (Fixes #253)#1039deepujain wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Signed-off-by: Deepak Jain <[email protected]>
📝 WalkthroughWalkthroughThe change replaces an unrecognized Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
test/cli.test.js (1)
141-148: Harden log-routing assertions to avoid false positives.
toContain(...)can still pass if extra unintended args are appended. Consider asserting exact argv tokens (and explicitly no-fin non-follow mode).Proposed test tightening
- expect(fs.readFileSync(markerFile, "utf8")).toContain("sandbox connect alpha -- tail -n 200 /tmp/gateway.log"); + const argv = fs.readFileSync(markerFile, "utf8").trim().split(/\s+/); + expect(argv).toEqual(["sandbox", "connect", "alpha", "--", "tail", "-n", "200", "/tmp/gateway.log"]); + expect(argv).not.toContain("-f"); ... - expect(fs.readFileSync(markerFile, "utf8")).toContain("sandbox connect alpha -- tail -n 200 -f /tmp/gateway.log"); + const followArgv = fs.readFileSync(markerFile, "utf8").trim().split(/\s+/); + expect(followArgv).toEqual(["sandbox", "connect", "alpha", "--", "tail", "-n", "200", "-f", "/tmp/gateway.log"]);Also applies to: 184-190
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/cli.test.js` around lines 141 - 148, The test currently uses expect(...).toContain(...) which can give false positives; update the assertion to parse the recorded command from markerFile (read via fs.readFileSync(markerFile, "utf8")), split it into argv tokens (e.g., by whitespace while preserving quoted tokens) and assert the token array equals the exact expected argv array for the non-follow case (e.g., ["sandbox","connect","alpha","--","tail","-n","200","/tmp/gateway.log"]) and also explicitly assert that the "-f" flag is not present; apply the same tightening to the other similar assertion around the runWithEnv usage at the later block (the 184-190 case) so both tests validate exact tokens rather than substring containment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/cli.test.js`:
- Around line 141-148: The test currently uses expect(...).toContain(...) which
can give false positives; update the assertion to parse the recorded command
from markerFile (read via fs.readFileSync(markerFile, "utf8")), split it into
argv tokens (e.g., by whitespace while preserving quoted tokens) and assert the
token array equals the exact expected argv array for the non-follow case (e.g.,
["sandbox","connect","alpha","--","tail","-n","200","/tmp/gateway.log"]) and
also explicitly assert that the "-f" flag is not present; apply the same
tightening to the other similar assertion around the runWithEnv usage at the
later block (the 184-190 case) so both tests validate exact tokens rather than
substring containment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d90c901d-27cb-48e5-a728-82314e810cfe
📒 Files selected for processing (2)
bin/nemoclaw.jstest/cli.test.js
Summary
nemoclaw <sandbox> logsno longer calls the unsupportedopenshell sandbox logssubcommand. It now streams the sandbox gateway log by connecting into the sandbox and runningtaildirectly, which works across affected OpenShell versions.Changes
bin/nemoclaw.js- replaced thelogsdispatch withopenshell sandbox connect <name> -- tail -n 200 /tmp/gateway.log, and added-fwhen--followis requested.test/cli.test.js- updated the logs test to assert the newsandbox connect ... tailinvocation and added coverage for--follow.Testing
npx vitest run test/cli.test.jspasses (24 passed).npm teststill has 2 pre-existing timeout failures intest/install-preflight.test.jsandtest/uninstall.test.js, unrelated to this change.Fixes #253
Summary by CodeRabbit
--followflag continues to work as expected for live log streaming.