refactor(cli): replace spawnSync("sleep") with native wait utility#2111
refactor(cli): replace spawnSync("sleep") with native wait utility#2111jyaunches wants to merge 12 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaces ad-hoc OS-level Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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)
src/lib/nim.ts (1)
276-277: Remove stale ESLint suppression near the new sleep call.The suppression targets
no-require-imports, but this line no longer usesrequire.🧹 Proposed cleanup
- // eslint-disable-next-line `@typescript-eslint/no-require-imports` sleepSeconds(intervalSec);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/nim.ts` around lines 276 - 277, Remove the stale ESLint suppression placed directly above the sleepSeconds call: delete the comment "// eslint-disable-next-line `@typescript-eslint/no-require-imports`" that precedes sleepSeconds(intervalSec); in the code (referencing the sleepSeconds invocation) so the file no longer silences a rule that isn’t relevant; if other nearby lines still require suppressions, replace with the appropriate rule only where needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/lib/nim.ts`:
- Around line 276-277: Remove the stale ESLint suppression placed directly above
the sleepSeconds call: delete the comment "// eslint-disable-next-line
`@typescript-eslint/no-require-imports`" that precedes sleepSeconds(intervalSec);
in the code (referencing the sleepSeconds invocation) so the file no longer
silences a rule that isn’t relevant; if other nearby lines still require
suppressions, replace with the appropriate rule only where needed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a25186c7-8d8b-4293-92f3-8fd79ab6378f
📒 Files selected for processing (7)
src/lib/agent-onboard.tssrc/lib/deploy.tssrc/lib/nim.tssrc/lib/onboard.tssrc/lib/wait.tssrc/nemoclaw.tstest/wait.test.ts
Summary
Replaces all
spawnSync("sleep", ...)subprocess calls with a native Node.jssleepSeconds()utility backed byAtomics.wait. This eliminates the overhead of spawning a child process for every delay and removes a platform dependency on thesleepbinary.Related Issue
Refs #2001 (Phase 2: replace sleeps with event-driven waits)
Supersedes #2027
Changes
src/lib/wait.ts—sleepMs()andsleepSeconds()primitives usingAtomics.wait(SharedArrayBuffer)for CPU-friendly synchronous blockingspawnSync("sleep", ...)insrc/nemoclaw.ts,src/lib/onboard.ts,src/lib/deploy.ts,src/lib/agent-onboard.ts, andsrc/lib/nim.tstest/wait.test.ts— timing accuracy, edge cases (zero, negative, NaN, Infinity)Type of Change
Verification
npx prek run --all-filespassesnpm testpassesAI Disclosure
Signed-off-by: Test User test@example.com
Summary by CodeRabbit
Refactor
Tests