fix: reduce auto-pair timeout and add skip/configure env vars#538
fix: reduce auto-pair timeout and add skip/configure env vars#538brianwtaylor wants to merge 2 commits intoNVIDIA:mainfrom
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:
📝 WalkthroughWalkthroughstart_auto_pair() in Changes
Sequence Diagram(s)sequenceDiagram
participant Shell as Shell (scripts/nemoclaw-start.sh)
participant Watcher as Python Watcher (nohup python3 -)
participant CLI as External CLI (openclaw)
participant Devices as Devices / JSON
Shell->>Shell: Check NEMOCLAW_SKIP_AUTO_PAIR\nIf set -> return
Shell->>Shell: Read & validate NEMOCLAW_AUTO_PAIR_TIMEOUT\nExport & echo TIMEOUT
Shell->>Watcher: Launch watcher with TIMEOUT env
Watcher->>Watcher: Compute DEADLINE = now + TIMEOUT\nPrint startup message
loop until DEADLINE or approvals complete
Watcher->>Watcher: remaining = DEADLINE - time.time()
alt remaining <= 0
Watcher->>Watcher: return (124, '', 'watcher deadline exceeded')
else
Watcher->>CLI: run("openclaw devices", timeout=remaining)
CLI-->>Watcher: devices JSON or (TimeoutExpired)
alt TimeoutExpired
Watcher->>Watcher: return (124, '', 'subprocess timed out after Xs')
else
Watcher->>Watcher: parse devices JSON
alt pending approvals found
Watcher->>CLI: run("openclaw approve ...", timeout=remaining)
CLI-->>Watcher: approve result or (TimeoutExpired)
end
end
end
Watcher->>Watcher: sleep then retry
end
Watcher-->>Shell: exit when DEADLINE reached or all approvals done
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/nemoclaw-start.sh`:
- Around line 123-137: The echo currently prints pair_timeout from the shell
which can differ from the Python-normalized timeout (the Python code coerces
invalid/<=0 values to 120 using timeout and DEADLINE); update the script so the
logged timeout reflects the effective value — either validate/coerce
NEMOCLAW_AUTO_PAIR_TIMEOUT in the shell before setting pair_timeout or move the
echo after the Python normalization and have the Python block print the
effective timeout (use the same environment key NEMOCLAW_AUTO_PAIR_TIMEOUT and
the Python variable timeout/DEADLINE to produce the logged value) so the message
shows the actual watcher timeout.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 087d654f-9b57-41ec-acee-f885a765801f
📒 Files selected for processing (1)
scripts/nemoclaw-start.sh
b671da2 to
19111ce
Compare
|
Thanks for the proposed fix to reduce the auto-pair timeout and add configuration options, which could help improve the security and usability of our CLI. |
19111ce to
ba72b64
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/nemoclaw-start.sh`:
- Around line 103-110: The run function currently computes remaining = max(1,
int(DEADLINE - time.time())) which becomes 1 after the deadline and still
launches subprocesses; change run to compute remaining = DEADLINE - time.time()
and if remaining <= 0 immediately return (124, '', f'subprocess timed out after
0s') instead of calling subprocess.run, otherwise call subprocess.run with
timeout=remaining (or int(max(1, remaining)) if an int is required). Update the
TimeoutExpired handling to preserve the existing return format; references:
function run, variable DEADLINE, subprocess.run, and subprocess.TimeoutExpired.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9cb34af1-182e-4ec2-8e1f-f977d26ae541
📒 Files selected for processing (1)
scripts/nemoclaw-start.sh
ba72b64 to
144450d
Compare
Replace max(1, ...) clamp with early return when deadline has passed. Prevents launching subprocesses after the configured timeout. Use raw float for more precise timeout bound. Signed-off-by: Brian Taylor <brian.taylor818@gmail.com>
144450d to
a6f80a3
Compare
Summary
NEMOCLAW_AUTOPAIR_TIMEOUTenv var to configure timeoutNEMOCLAW_AUTOPAIR_SKIPenv var to skip auto-pair entirelyrun()helper to prevent indefinite blockingRelated to #430 — the indefinite blocking during sandbox startup is partly caused by the auto-pair watcher having no timeout; this adds configurable timeouts and a skip option
Test plan
Automated Tests
Summary by CodeRabbit
New Features
Improvements