[PR #336] Fix Cursor multi-root workspace detection - aka multiple repos in same workspace #414

Closed
opened 2026-03-02 04:13:33 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/336

State: closed
Merged: No


Previously, git-ai always used the first workspace root when processing Cursor's multi-root workspace feature, causing attribution failures for files in non-primary workspaces.

This commit implements intelligent workspace selection that:

Matches file paths to the correct workspace root
Handles trailing slashes in workspace paths
Validates path separators (Unix / and Windows )
Prevents ambiguous prefix matching (e.g., workspace1 vs workspace10)
Falls back gracefully to first workspace if no match found
Added comprehensive test coverage with 7 edge case scenarios:

File in non-first workspace
File path doesn't match any workspace (fallback)
No file path provided
Workspace roots with trailing slashes
Ambiguous prefix scenarios
Path separator edge cases
Immediate file after workspace root
All tests passing (10/10 cursor tests). No regressions.

**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/336 **State:** closed **Merged:** No --- Previously, git-ai always used the first workspace root when processing Cursor's multi-root workspace feature, causing attribution failures for files in non-primary workspaces. This commit implements intelligent workspace selection that: Matches file paths to the correct workspace root Handles trailing slashes in workspace paths Validates path separators (Unix / and Windows ) Prevents ambiguous prefix matching (e.g., workspace1 vs workspace10) Falls back gracefully to first workspace if no match found Added comprehensive test coverage with 7 edge case scenarios: File in non-first workspace File path doesn't match any workspace (fallback) No file path provided Workspace roots with trailing slashes Ambiguous prefix scenarios Path separator edge cases Immediate file after workspace root All tests passing (10/10 cursor tests). No regressions.
kerem 2026-03-02 04:13:33 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#414
No description provided.