Skip to content

fix: validate tool download destination before network - #6

Merged
lukisch merged 1 commit into
mainfrom
codex/mailprocessor-download-destination-20261004
Oct 3, 2026
Merged

lukisch merged 1 commit into
mainfrom
codex/mailprocessor-download-destination-20261004

Conversation

@lukisch

@lukisch lukisch commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

download_tool() contacted GitHub for release metadata before checking whether the local destination was usable. A regular file or a destination whose metadata check raises OSError could therefore produce a network error instead of the local destination error.

This change checks the destination and existing parents before any network request, keeps the existing Download error: cannot prepare destination: prefix, and leaves existing destination contents untouched. The later mkdir remains as the race-time guard.

Validation

  • Destination preflight tests: 2 passed.
  • tests/test_tool_manager.py: 26 passed.
  • Full suite: 104 passed, 6 subtests passed.
  • Ruff, Python AST parse, and git diff --check: passed.

@lukisch
lukisch marked this pull request as ready for review October 3, 2026 22:41
@lukisch
lukisch merged commit 5a36900 into main Oct 3, 2026
12 checks passed
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