Skip to content

fix: close temp file handle before GCS blob download#6

Draft
Copilot wants to merge 2 commits intofeature/gcs-watch-sourcefrom
copilot/sub-pr-5
Draft

fix: close temp file handle before GCS blob download#6
Copilot wants to merge 2 commits intofeature/gcs-watch-sourcefrom
copilot/sub-pr-5

Conversation

Copy link

Copilot AI commented Feb 25, 2026

download_gcs_blob() called blob.download_to_filename(tmp.name) while the NamedTemporaryFile handle was still open, causing file-locking failures on Windows and potential write conflicts.

Change

Move tmp.close() to before the download call, releasing the handle before writing:

# Before
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=suffix, prefix="dmaf_gcs_")
blob.download_to_filename(tmp.name)  # handle still open
tmp.close()

# After
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=suffix, prefix="dmaf_gcs_")
tmp.close()  # release handle first
blob.download_to_filename(tmp.name)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: yhyatt <10474956+yhyatt@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on native GCS watch directory support fix: close temp file handle before GCS blob download Feb 25, 2026
Copilot AI requested a review from yhyatt February 25, 2026 12:22
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.

2 participants