fix(kernels): check HTTP status when downloading outputs - #1176
Merged
stevemessick merged 1 commit intoAug 20, 2026
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
sridipbasu
force-pushed
the
fix/kernels-output-http-error
branch
from
August 15, 2026 16:02
a9a487c to
897040c
Compare
Collaborator
Author
|
@google-cla |
sridipbasu
marked this pull request as draft
August 15, 2026 17:43
sridipbasu
marked this pull request as ready for review
August 16, 2026 12:50
Contributor
|
/gcbrun |
Contributor
|
Great! Thanks, again. |
stevemessick
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When running
kaggle kernels output, the CLI downloads each output file from a signed storage URL. The response from that request was written directly to the output file without checking the HTTP status first.Because of this, if the storage request returned an error such as
403or5xx, the error response itself could be saved as the output file. The CLI would then print that the file was downloaded successfully even though the file actually contained the error response.This was especially problematic for scripts or automated workflows that rely on the command succeeding and then use the downloaded file.
Fix
Added
raise_for_status()after the storage request so failed downloads are stopped before anything is written to disk.The existing CLI error handling already handles
HTTPError, so no other changes to the download flow were needed.Also added a regression test to make sure a failed download raises the expected error and does not create the output file.
Tests
Added a test covering a failed output file download with a
403response.Ran:
pytest tests/unit/test_kernels_logs.py::TestKernelsLogs::test_kernels_output_failed_download_is_not_written -vpytest tests/unit/test_kernels_logs.py -k "output" -vpytest tests/unit -qThe regression test was also verified to fail before the fix and pass after the fix.
All unit tests pass with 1289 tests passing.