Skip to content

fix: handle files on different drives when finding the common root - #5939

Open
DZH166 wants to merge 1 commit into
Aider-AI:mainfrom
DZH166:codex/fix-common-root-cross-drive-20261102
Open

DZH166 wants to merge 1 commit into
Aider-AI:mainfrom
DZH166:codex/fix-common-root-cross-drive-20261102

Conversation

@DZH166

@DZH166 DZH166 commented Nov 2, 2026

Copy link
Copy Markdown

Summary

os.path.commonpath() raises ValueError when file paths are on different Windows drives. find_common_root() only catches OSError, so initializing a coder with those files can crash instead of using its existing current-directory fallback.

Catch ValueError alongside OSError. Add a regression test using the real ntpath.commonpath implementation, so the Windows case can also be exercised on other platforms.

Fixes #3704.

Validation

  • Against the original exception handler: 1 failed, with ValueError: Paths don't have the same drive.
  • python -m pytest tests/basic/test_find_common_root.py -q: 1 passed.
  • Repository-configured pre-commit hooks on both changed files: isort, Black, flake8 and codespell passed.
  • git diff --check passed.

The full suite and live model integrations were not run. This change was prepared with AI assistance and checked with the regression test above.

This branch has not been deployed

No deployments
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.

Uncaught ValueError in ntpath.py line 807

1 participant