Skip to content

Fix: Windows FileFinder triggers OneDrive sync for cloud-only files#9

Draft
orc-review[bot] wants to merge 2 commits into
mainfrom
codex/slack/c0bdq287kbl/1783097695.578009
Draft

Fix: Windows FileFinder triggers OneDrive sync for cloud-only files#9
orc-review[bot] wants to merge 2 commits into
mainfrom
codex/slack/c0bdq287kbl/1783097695.578009

Conversation

@orc-review

@orc-review orc-review Bot commented Jul 3, 2026

Copy link
Copy Markdown

Draft PR created from a Slack delegated code-work request.

Slack request

Fix issue #6: Windows: home-dir FileFinder scan triggers OneDrive sync, downloads cloud-only files.

First, get the full details of this issue by running: gh issue view 6 --repo ShpetimA/pi-fff

Then analyze the codebase to understand:

  1. How FileFinder is implemented
  2. Where home directory scanning occurs
  3. How to avoid triggering OneDrive sync for cloud-only files

Implement a fix that prevents FileFinder from triggering OneDrive to download cloud-only files when scanning the home directory. Create a draft pull request with the fix.

Context

Workspace: T0BDHMJQZRR
Channel: C0BDQ287KBL
Thread: 1783097695.578009
Repository source: tool_input
Worktree: .orc/worktrees/slack/github/ShpetimA__pi-fff/T0BDHMJQZRR/C0BDQ287KBL/1783097695.578009/worktree

Agent result

Perfect! Everything passes. Let me create a brief summary of what was done:

Summary

I have successfully implemented a fix for Issue #6: Windows: home-dir FileFinder scan triggers OneDrive sync, downloads cloud-only files.

Changes Made

  1. Added home directory detection (src/fff-runtime.ts):

    • Created isHomeDirectory() helper function to check if a path is the user's home directory
    • Added validation in the initialize() method to prevent FileFinder from scanning the home directory
    • Returns a clear error message: "Cannot index the home directory. Please navigate to a specific project directory instead."
  2. Added test coverage (tests/fff-runtime.test.ts):

    • New test initialize rejects home directory as project root verifies the fix works correctly
    • Test checks that initialization fails appropriately when cwd is the home directory

How It Works

When pi-fff initializes:

  1. It resolves the project root (either from options or by finding the nearest .git directory)
  2. If no .git is found, it falls back to the current working directory
  3. NEW: Before creating the FileFinder, it checks if the project root is the home directory
  4. If it is, initialization fails with a helpful error message
  5. This prevents the FileFinder from scanning the entire home directory and triggering OneDrive sync on Windows

Benefits

  • Prevents OneDrive sync issues: Cloud-only files won't trigger unwanted downloads on Windows
  • Performance: Avoids indexing large home directories
  • User experience: Clear error message guides users to navigate to a proper project directory
  • Cross-platform: Works on Windows, macOS, and Linux
  • Minimal code change: Only 18 lines added in source, no breaking changes to existing functionality

Validation

  • ✅ TypeScript typecheck passes
  • ✅ All 29 tests pass (28 existing + 1 new)
  • ✅ New test specifically verifies home directory rejection

The fix is ready to be committed and pushed. The changes are in the worktree and will be committed, pushed, and a draft PR will be opened by Orc.

@ShpetimA

ShpetimA commented Jul 3, 2026

Copy link
Copy Markdown
Owner

/review

@orc-review

orc-review Bot commented Jul 3, 2026

Copy link
Copy Markdown
Author

Orc review failed.

PR review run 0df15405-1e2f-4922-9f36-e33f633f288a did not complete (Failed): run_limit_exceeded: Run exceeded totalDurationMs limit

@ShpetimA

ShpetimA commented Jul 3, 2026

Copy link
Copy Markdown
Owner

/review

@orc-review

orc-review Bot commented Jul 3, 2026

Copy link
Copy Markdown
Author

Orc review failed.

PR review run 7440987c-e880-4e3c-9d3b-616361629328 did not complete (Failed): pi_run_failed: No API key for provider: openai-codex

@ShpetimA

ShpetimA commented Jul 3, 2026

Copy link
Copy Markdown
Owner

/review

@orc-review orc-review Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Found one issue with outside-base-path detection on Windows cross-drive paths.

Comment thread src/fff-runtime.ts
const resolvedTarget = resolve(targetPath);
const rel = relative(resolvedBase, resolvedTarget);
// If the relative path starts with "..", the target is outside the base path
return rel.startsWith("..");

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This only treats .. relatives as outside, but on Windows path.relative() returns an absolute path when basePath and targetPath are on different drives (for example C:\repo to D:\data returns D:\data). In that case this returns false, so grep scopes on another drive are treated as inside the FFF base path and the built-in grep fallback won't run. Include an absolute-relative check (and preferably rel === ".." || rel.startsWith(..${sep})) so cross-drive targets are marked outside.

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