Skip to content

perf: batch of low-risk fixes for hangs and unnecessary FS work#187

Merged
LadyBluenotes merged 6 commits into
mainfrom
perf/quick-wins-batch
Jul 2, 2026
Merged

perf: batch of low-risk fixes for hangs and unnecessary FS work#187
LadyBluenotes merged 6 commits into
mainfrom
perf/quick-wins-batch

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Jul 2, 2026

Copy link
Copy Markdown
Member

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.

  • Bound npm registry fetch with a timeout (c2dd89c) — the staleness check's fetchNpmVersion had no timeout, so intent list and other staleness checks could hang indefinitely against a slow or unreachable registry. Now aborts via AbortSignal.timeout(5_000).
  • Bound global package-manager detection with a timeout (975275b) — detectGlobalNodeModules's execFileSync call had no timeout, so it could hang indefinitely if the environment's global node_modules resolution stalled. Added GLOBAL_NODE_MODULES_COMMAND_TIMEOUT_MS and passed timeout to execFileSync.
  • Early-exit skill-file check (17fb035) — getWorkspaceInfo called findSkillFiles(...).length > 0, which fully enumerates every skill file in a package just to check existence. Added hasAnySkillFile(), which returns on the first match, reducing unnecessary filesystem walks in large monorepos.
  • Process-level cold-start benchmark (ec6475b) — existing benches (list/load/stale/validate) reuse a warm module graph via in-process main() calls, so none measured actual process cold start. Added benchmarks/intent/startup.bench.ts, which spawns a fresh Node process per sample (intent --help vs. an empty-node baseline) to isolate intent's own startup overhead.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability in slow or large environments by preventing certain checks from hanging indefinitely.
    • Added time limits to registry lookups and environment detection steps so the app can continue instead of waiting forever.
    • Reduced unnecessary filesystem scanning in large workspaces, helping speed up startup and related commands.
  • Tests

    • Added a benchmark to measure cold-start performance.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@LadyBluenotes, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2fb0f274-ab8d-4e7e-bf5a-06797cac391f

📥 Commits

Reviewing files that changed from the base of the PR and between 102d81b and 0e95961.

📒 Files selected for processing (1)
  • benchmarks/intent/startup.bench.ts
📝 Walkthrough

Walkthrough

This 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.

Changes

Hang Prevention and Skill-Check Optimization

Layer / File(s) Summary
Skill existence check optimization
packages/intent/src/shared/utils.ts, packages/intent/src/setup/workspace-patterns.ts
Adds exported hasAnySkillFile helper doing an early-exit recursive search for SKILL.md, replacing findSkillFiles(...).length > 0 usage in workspace skill detection.
Timeout bounds for network and subprocess calls
packages/intent/src/staleness/check.ts, packages/intent/src/shared/utils.ts
Adds a 5s AbortSignal.timeout to the npm registry fetch in fetchNpmVersion, and a timeout option to execFileSync calls used for global node_modules detection.
Benchmark and changelog
benchmarks/intent/startup.bench.ts, .changeset/nine-pigs-laugh.md
Adds a Vitest cold-start benchmark comparing an empty Node process to intent --help, and a changeset describing the patch.

Estimated code review effort: 2 (Simple) | ~12 minutes

Suggested reviewers: KevinVandy, schiller-manuel

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the PR’s main focus on performance fixes for hangs and filesystem work.
Description check ✅ Passed The description clearly covers the four changes and their motivation, but it omits the template’s checklist and release impact sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/quick-wins-batch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 0e95961

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-02 01:46:44 UTC

@nx-cloud

nx-cloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 102d81b

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-02 01:12:13 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jul 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/TanStack/intent/@tanstack/intent@187

commit: 0e95961

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b7920e9 and 102d81b.

📒 Files selected for processing (5)
  • .changeset/nine-pigs-laugh.md
  • benchmarks/intent/startup.bench.ts
  • packages/intent/src/setup/workspace-patterns.ts
  • packages/intent/src/shared/utils.ts
  • packages/intent/src/staleness/check.ts

Comment thread benchmarks/intent/startup.bench.ts
@LadyBluenotes LadyBluenotes merged commit fb3c08b into main Jul 2, 2026
9 checks passed
@LadyBluenotes LadyBluenotes deleted the perf/quick-wins-batch branch July 2, 2026 01:46
@github-actions github-actions Bot mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant