Repository navigation
feat: add nemoclaw debug command for collecting diagnostics - #502
Conversation
Add a debug command that collects system, GPU, Docker, OpenShell, and network diagnostics to help triage bug reports. Supports --quick for a minimal subset and --output to produce a tarball for GitHub issues. Also updates the bug report issue template to prompt users for debug output. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant CLI as "nemoclaw CLI"
participant Script as "scripts/debug.sh"
participant Docker as "Docker / Containers"
participant GPU as "NVIDIA / GPU"
participant FS as "Filesystem / Tarball"
User->>CLI: run `nemoclaw debug [--quick] [--output FILE]`
CLI->>Script: spawn `scripts/debug.sh` with args + env SANDBOX_NAME
Script->>Docker: collect docker ps/logs/inspect (if available)
Script->>GPU: run nvidia-smi (if available)
Script->>FS: write collected files to temp dir
alt --output specified
Script->>FS: create gzip tarball at FILE
Script-->>CLI: print tarball path and summary
else
Script-->>CLI: stream collected output to stdout and remove temp dir
end
CLI-->>User: exit with script's exit code and output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/debug.sh`:
- Line 214: The current pipeline pipes collect's stdout into tail, so the
archived dmesg.txt still contains the full dmesg output; change the invocation
so collect receives the truncated output instead (e.g., run collect "dmesg" with
a shell command that executes dmesg | tail -100 so the collector archives only
the last 100 lines). Update the command around the existing collect "dmesg"
invocation to invoke a shell (-c) that runs dmesg | tail -100 so the saved
diagnostics reflect the intended truncation.
- Around line 218-234: Add an explicit sensitive-data warning before prompting
users to attach the tarball: when OUTPUT is set and right after the info
"Tarball written to ${OUTPUT}" (and similarly before the final guidance lines
that show the --output example), call the info logger to print a short warning
about potentially sensitive information in the archive (e.g., "Warning: this
tarball may contain sensitive data — review and redact logs/configs before
uploading."). Use the existing info function and the variables OUTPUT and
COLLECT_DIR to provide context, and ensure the warning appears both immediately
after writing the tarball and before the final "Done..."/usage lines.
- Around line 101-106: Add a runtime check for the presence of a timeout binary
and use it only when available: detect "timeout" or "gtimeout" once at script
start (set a TIMEOUT_CMD variable to the found command or empty), then replace
the direct call to timeout 30 "$@" > "$outfile" 2>&1 in the block using
"$outfile" with a conditional invocation that uses "$TIMEOUT_CMD" when non-empty
and falls back to running the command without any timeout when empty; ensure the
detection runs early (before the timeout invocation) and export or use the
TIMEOUT_CMD variable in the scope where the timeout is called.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7f7510c8-e5dd-4104-ad63-4b730c96dfb8
📒 Files selected for processing (4)
.github/ISSUE_TEMPLATE/bug_report.ymlbin/nemoclaw.jsscripts/debug.shtest/cli.test.js
- Add timeout/gtimeout detection for macOS compatibility - Wrap piped commands in sh -c so collect() captures full pipeline - Add sensitive data warning before tarball attachment prompt Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
@coderabbitai review again? |
|
✅ Actions performedFull review triggered. |
|
Review comments:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/debug.sh (1)
74-77: Unknown flags should fail fast, not continue.At Line 75, the script only warns and proceeds. A typo like
--ouptutcan silently produce the wrong artifact/behavior while still exiting successfully.Suggested change
*) - warn "Unknown option: $1" - shift + fail "Unknown option: $1 (run --help for usage)" ;;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/debug.sh` around lines 74 - 77, The default case in the option-parsing switch currently calls warn "Unknown option: $1" and shift which allows the script to continue on unknown flags; change the default handler so unknown options cause an immediate non-zero exit (e.g., call the script's error/fatal function or invoke exit with a non-zero code) instead of shifting and continuing; update the block that references warn and shift to log the unknown option and then exit (or call any existing usage()/fatal() helper) to fail fast.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/debug.sh`:
- Around line 191-199: The OpenShell section collects metadata but misses
in-sandbox diagnostics; update the block that uses SANDBOX_NAME (and respects
QUICK) to exec into the sandbox (via the same mechanism used by openshell
sandbox get/logs) and run/collect process and memory snapshots (e.g., ps aux,
top -b -n1, /proc/meminfo, free -h), open file lists (lsof), and short
dmesg/syslog excerpts, storing each as distinct collect entries like
"openshell-sandbox-ps", "openshell-sandbox-top", "openshell-sandbox-meminfo",
"openshell-sandbox-lsof", etc.; ensure these new collect calls run only when
SANDBOX_NAME is set and QUICK=false and reuse the existing collect wrapper so
outputs integrate with the rest of the debug bundle.
---
Nitpick comments:
In `@scripts/debug.sh`:
- Around line 74-77: The default case in the option-parsing switch currently
calls warn "Unknown option: $1" and shift which allows the script to continue on
unknown flags; change the default handler so unknown options cause an immediate
non-zero exit (e.g., call the script's error/fatal function or invoke exit with
a non-zero code) instead of shifting and continuing; update the block that
references warn and shift to log the unknown option and then exit (or call any
existing usage()/fatal() helper) to fail fast.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8ccf8d94-4931-453e-a26a-7984bd2bfa24
📒 Files selected for processing (4)
.github/ISSUE_TEMPLATE/bug_report.ymlbin/nemoclaw.jsscripts/debug.shtest/cli.test.js
Runs ps, free, top, and gateway log collection inside the sandbox when it is reachable, addressing the full diagnostic scope from issue #500. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Redact known sensitive patterns (API keys, tokens, passwords) from all collected output before saving to files or tarball - Exit non-zero on unknown options instead of silently skipping - Fix curl|bash example to use `bash -s -- --quick` syntax - Add tests for `debug --quick` (runs collectors, exits 0) and unknown option rejection Linux-specific commands (free, ss, vmstat, etc.) are already handled gracefully by collect() which skips missing commands. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Thanks for adding this debug command, it will make it easier for users to collect and share diagnostics information when reporting issues. |
1 similar comment
|
Thanks for adding this debug command, it will make it easier for users to collect and share diagnostics information when reporting issues. |
|
Thanks for the feedback! All addressed in 1851ad7 — added sensitive data warning, fixed dmesg piping inside collect, and made unknown flags fail fast. Ready for re-review! |
|
Thanks for following through on the review feedback. I re-reviewed the latest tip and the remaining blockers are resolved:
I also re-validated the latest revision locally, including the quick diagnostic path and tarball creation, and it looks good to merge. Let it rip 🤙 |
…#502) * feat: add `nemoclaw debug` command for collecting diagnostics (NVIDIA#500) Add a debug command that collects system, GPU, Docker, OpenShell, and network diagnostics to help triage bug reports. Supports --quick for a minimal subset and --output to produce a tarball for GitHub issues. Also updates the bug report issue template to prompt users for debug output. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: address CodeRabbit review feedback on debug script - Add timeout/gtimeout detection for macOS compatibility - Wrap piped commands in sh -c so collect() captures full pipeline - Add sensitive data warning before tarball attachment prompt Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat: collect in-sandbox diagnostics via openshell sandbox exec Runs ps, free, top, and gateway log collection inside the sandbox when it is reachable, addressing the full diagnostic scope from issue NVIDIA#500. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: address Aaron's review feedback - Redact known sensitive patterns (API keys, tokens, passwords) from all collected output before saving to files or tarball - Exit non-zero on unknown options instead of silently skipping - Fix curl|bash example to use `bash -s -- --quick` syntax - Add tests for `debug --quick` (runs collectors, exits 0) and unknown option rejection Linux-specific commands (free, ss, vmstat, etc.) are already handled gracefully by collect() which skips missing commands. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
…#502) * feat: add `nemoclaw debug` command for collecting diagnostics (NVIDIA#500) Add a debug command that collects system, GPU, Docker, OpenShell, and network diagnostics to help triage bug reports. Supports --quick for a minimal subset and --output to produce a tarball for GitHub issues. Also updates the bug report issue template to prompt users for debug output. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: address CodeRabbit review feedback on debug script - Add timeout/gtimeout detection for macOS compatibility - Wrap piped commands in sh -c so collect() captures full pipeline - Add sensitive data warning before tarball attachment prompt Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat: collect in-sandbox diagnostics via openshell sandbox exec Runs ps, free, top, and gateway log collection inside the sandbox when it is reachable, addressing the full diagnostic scope from issue NVIDIA#500. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: address Aaron's review feedback - Redact known sensitive patterns (API keys, tokens, passwords) from all collected output before saving to files or tarball - Exit non-zero on unknown options instead of silently skipping - Fix curl|bash example to use `bash -s -- --quick` syntax - Add tests for `debug --quick` (runs collectors, exits 0) and unknown option rejection Linux-specific commands (free, ss, vmstat, etc.) are already handled gracefully by collect() which skips missing commands. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Summary
nemoclaw debugCLI command and standalonescripts/debug.shthat collects system, GPU, Docker, OpenShell, and network diagnostics for bug reports--quickfor minimal diagnostics and--outputto save a tarball for GitHub issuesRelated Issue
Closes #500
Changes
scripts/debug.sh— New standalone bash script collecting diagnostics across system, processes, GPU, Docker, OpenShell, network, and kernel categories. Gracefully skips unavailable commands.bin/nemoclaw.js— Registerdebugas a global command, delegate to the bash script with the default sandbox name, add "Troubleshooting" section to help text..github/ISSUE_TEMPLATE/bug_report.yml— Add "Debug Output" field prompting users to attachnemoclaw debugoutput.test/cli.test.js— Add tests fordebug --helpand help text mentioning the debug command.Type of Change
Testing
npm testpasses (new tests + all existing CLI tests green).nemoclaw debug --helpshows usage and exits 0.Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests
debug(help, quick mode, invalid option) and updated top-level help assertions to reference Troubleshooting/debug.Chores