perf: batch of low-risk fixes for hangs and unnecessary FS work#187
Conversation
fetchNpmVersion had no timeout/AbortSignal, so an unreachable or slow npm registry could block `intent stale` indefinitely. Bound it to 5s; timeout/error still falls through to the existing null fallback.
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds bounded timeouts to npm registry staleness checks and global package-manager detection to prevent hangs, replaces workspace skill-file enumeration with an early-exit existence check, adds a startup cold-start benchmark, and includes a changeset documenting the patch. ChangesHang Prevention and Skill-Check Optimization
Estimated code review effort: 2 (Simple) | ~12 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
View your CI Pipeline Execution ↗ for commit 0e95961
☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit 102d81b
☁️ Nx Cloud last updated this comment at |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/intent/startup.bench.ts`:
- Around line 14-21: The runNode helper currently calls spawnSync without any
timeout, so a hung CLI process can block the benchmark indefinitely. Update the
spawnSync invocation in runNode to pass a reasonable timeout and keep the
existing failure path in place so the benchmark fails fast on regressions. Use
the runNode symbol to locate the helper and ensure the timeout applies to all
benchmarked CLI launches.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 06544825-3dc1-4311-9926-721627e81f12
📒 Files selected for processing (5)
.changeset/nine-pigs-laugh.mdbenchmarks/intent/startup.bench.tspackages/intent/src/setup/workspace-patterns.tspackages/intent/src/shared/utils.tspackages/intent/src/staleness/check.ts
Summary
Batches four low-risk, independently-scoped performance/robustness fixes identified in the TanStack Intent perf audit. Each was implemented and verified as an isolated commit.
c2dd89c) — the staleness check'sfetchNpmVersionhad no timeout, sointent listand other staleness checks could hang indefinitely against a slow or unreachable registry. Now aborts viaAbortSignal.timeout(5_000).975275b) —detectGlobalNodeModules'sexecFileSynccall had no timeout, so it could hang indefinitely if the environment's globalnode_modulesresolution stalled. AddedGLOBAL_NODE_MODULES_COMMAND_TIMEOUT_MSand passedtimeouttoexecFileSync.17fb035) —getWorkspaceInfocalledfindSkillFiles(...).length > 0, which fully enumerates every skill file in a package just to check existence. AddedhasAnySkillFile(), which returns on the first match, reducing unnecessary filesystem walks in large monorepos.ec6475b) — existing benches (list/load/stale/validate) reuse a warm module graph via in-processmain()calls, so none measured actual process cold start. Addedbenchmarks/intent/startup.bench.ts, which spawns a fresh Node process per sample (intent --helpvs. an empty-node baseline) to isolate intent's own startup overhead.Summary by CodeRabbit
Bug Fixes
Tests