diff --git a/src/services/code-index/processors/file-watcher.ts b/src/services/code-index/processors/file-watcher.ts index 3f04a73072..c0bacc621d 100644 --- a/src/services/code-index/processors/file-watcher.ts +++ b/src/services/code-index/processors/file-watcher.ts @@ -525,7 +525,7 @@ export class FileWatcher implements IFileWatcher { // Check if file should be ignored const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath) if ( - !this.ignoreController.validateAccess(filePath) || + !this.ignoreController.validateAccess(relativeFilePath) || (this.ignoreInstance && this.ignoreInstance.ignores(relativeFilePath)) ) { return { diff --git a/src/services/code-index/processors/scanner.ts b/src/services/code-index/processors/scanner.ts index 3da6fc364f..aab95d7511 100644 --- a/src/services/code-index/processors/scanner.ts +++ b/src/services/code-index/processors/scanner.ts @@ -86,7 +86,9 @@ export class DirectoryScanner implements IDirectoryScanner { // IMPORTANT: do not create a file watcher here (scan is short-lived). let allowedPaths: string[] { - const ignoreController = new RooIgnoreController(directoryPath, { watch: false }) + // Root the controller at the effective workspace to ensure `.rooignore` checks + // are consistent with other workspace-relative filtering. + const ignoreController = new RooIgnoreController(scanWorkspace, { watch: false }) try { await ignoreController.initialize() // Filter paths using .rooignore