Skip to content

fix(cursor): bound slug path resolution - #81

Open
yardenhochman wants to merge 1 commit into
yigitkonur:mainfrom
yardenhochman:fix/cursor-slug-backtracking
Open

fix(cursor): bound slug path resolution#81
yardenhochman wants to merge 1 commit into
yigitkonur:mainfrom
yardenhochman:fix/cursor-slug-backtracking

Conversation

@yardenhochman

@yardenhochman yardenhochman commented Jul 30, 2026

Copy link
Copy Markdown

Summary

  • cap filesystem probes while resolving ambiguous Cursor project slugs
  • preserve existing candidate precedence and fallback behavior
  • add a regression test for dash-heavy missing paths

Problem

cwdFromSlug() tries /, ., and literal - for every dash. When a Cursor project points to a deleted temporary path, the exhaustive search grows as 3^n; a 21-dash scratchpad slug can peg a CPU core and leave the session picker on “Loading sessions.”

Verification

  • pnpm test — 918 passed, 2 platform skips
  • pnpm exec biome check src/utils/slug.ts src/__tests__/cwd-from-slug.test.ts
  • pnpm run build

The repository-wide pnpm run check currently reports pre-existing formatter drift in src/parsers/antigravity.ts, src/parsers/copilot.ts, and src/parsers/droid.ts; this branch does not touch those files.


Summary by cubic

Bound path resolution for Cursor project slugs to prevent exponential filesystem checks and session picker hangs. Adds a 10,000-check cap in cwdFromSlug while keeping existing precedence and fallbacks.

  • Bug Fixes
    • Cap candidate filesystem probes at 10,000 to stop 3^n blowups on dash-heavy, missing paths.
    • Preserve existing resolution order and OS-specific fallbacks.
    • Add regression test that mocks fs.existsSync and verifies the cap and Unix fallback path.

Written for commit 83673be. Summary will update on new commits.

Review in cubic

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