-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(cli): add timeout to downloadSandboxConfig in dashboard recovery #2470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ba471df
a6ae606
5df75c6
25679a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,9 +282,14 @@ else | |
| fi | ||
|
|
||
| # 3d: nemoclaw status works | ||
| if status_output=$(nemoclaw "$SANDBOX_NAME" status 2>&1); then | ||
| rm -f /tmp/nemoclaw-status-diag.log | ||
| if status_output=$(timeout 60 nemoclaw "$SANDBOX_NAME" status 2>&1); then | ||
| pass "nemoclaw $SANDBOX_NAME status exits 0" | ||
| else | ||
| echo "[diag] nemoclaw status exit code: $?" | ||
| echo "[diag] status output: ${status_output:0:500}" | ||
| echo "[diag] diag log:" | ||
| cat /tmp/nemoclaw-status-diag.log 2>/dev/null || echo "(no diag log)" | ||
| fail "nemoclaw $SANDBOX_NAME status failed: ${status_output:0:200}" | ||
|
Comment on lines
+285
to
293
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Portability issue: Line 286 uses command -v timeout >/dev/null 2>&1 && TIMEOUT_STATUS="timeout 120"
command -v gtimeout >/dev/null 2>&1 && TIMEOUT_STATUS="gtimeout 120"Consider applying the same pattern here for consistency: Proposed fix for timeout portability # 3d: nemoclaw status works
rm -f /tmp/nemoclaw-status-diag.log
-if status_output=$(timeout 60 nemoclaw "$SANDBOX_NAME" status 2>&1); then
+TIMEOUT_CMD=""
+command -v timeout >/dev/null 2>&1 && TIMEOUT_CMD="timeout 60"
+command -v gtimeout >/dev/null 2>&1 && TIMEOUT_CMD="gtimeout 60"
+if status_output=$($TIMEOUT_CMD nemoclaw "$SANDBOX_NAME" status 2>&1); then
pass "nemoclaw $SANDBOX_NAME status exits 0"Alternatively, extract a helper function since this pattern is used multiple times. 🤖 Prompt for AI Agents |
||
| fi | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In Node.js child_process.spawnSync, when atimeoutis hit, what fields are populated in the return object (error,status,signal), and iserror.codeset toETIMEDOUT?💡 Result:
When child_process.spawnSync hits a timeout, it kills the child process with the killSignal (default 'SIGTERM'), waits for it to exit, and returns an object with: - error: populated with an Error instance where error.code === 'ETIMEDOUT' - status: null (since terminated by signal) - signal: the kill signal used (e.g., 'SIGTERM') To detect timeout: check if (result.error && result.error.code === 'ETIMEDOUT').
Citations:
timeoutoption's improper behavior sindresorhus/execa#726🏁 Script executed:
# First, check if the file exists and get its size wc -l src/lib/openshell.tsRepository: NVIDIA/NemoClaw
Length of output: 84
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 756
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 704
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 376
🏁 Script executed:
# Check git history to see if this is new timeout handling git log --oneline -n 20 -- src/lib/openshell.tsRepository: NVIDIA/NemoClaw
Length of output: 142
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 199
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 299
🏁 Script executed:
# Check the actual commit that added timeout handling git show a6ae606 --statRepository: NVIDIA/NemoClaw
Length of output: 35863
🏁 Script executed:
# Look at the full diff of the timeout commit git show a6ae606Repository: NVIDIA/NemoClaw
Length of output: 50375
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 41
🏁 Script executed:
# Also check the full test file to understand test coverage wc -l src/lib/openshell.test.ts head -50 src/lib/openshell.test.tsRepository: NVIDIA/NemoClaw
Length of output: 1301
🏁 Script executed:
# Read the entire test file to check for timeout tests cat src/lib/openshell.test.tsRepository: NVIDIA/NemoClaw
Length of output: 4468
Timeout errors still cause hard exit instead of returning failed status for recovery.
When
spawnSynctimes out, it populatesresult.errorwithcode === "ETIMEDOUT"andstatus === null. Currently, lines 93 and 118 route allresult.errorcases tohandleSpawnError(), which exits with status 1. This bypasses any recovery flow the caller might implement.The timeout parameter was added to prevent
nemoclaw statusfrom hanging indefinitely, but the current code exits immediately on timeout instead of allowing the caller to handle it. Add a timeout-specific check before callinghandleSpawnError():Suggested fix
Also applies to: 116-119
🤖 Prompt for AI Agents