fix: handle 403 and null files in kernels_output#951
fix: handle 403 and null files in kernels_output#9514kaws wants to merge 3 commits intoKaggle:mainfrom
Conversation
list_kernel_session_output returns 403 in known scenarios: - notebooks created via 'Copy & Edit' lose API accessibility regardless of their public/private visibility setting - private notebooks owned by another user - your own private notebooks (owner lacks API access to their own outputs) Previously this raised an opaque HTTPError with no actionable message. Now raises ValueError with a clear description of the known causes. Also guards response.files against None to prevent TypeError.
|
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. |
|
I have signed the Google CLA. Could a maintainer please trigger a rescan if this PR will be accepted? Thank you! |
|
/gcbrun |
|
@4kaws Just curious, after doing a copy and edit on a notebook, did you commit it (and run)? |
yes, i did run it and also added it to a benchmark page |
|
I cannot reproduce your issue with copy-edit notebooks, then failing to download their output. If it weren't that a large part of the error message in this PR is due to that problem, I probably would have approved it already. But I don't understand the problem. Do you have an example I can use to reproduce it? |
Hi! The issue is still reproducible as of today. I should have mentioned that this happens only for benchmark task notebooks. Here are concrete examples you can test with, all of these task notebooks are public but return Permission 'kernels.get' was denied: All of these are public notebooks created via Copy & Editkernels_status returns 401 (Unauthorized)list_kernel_session_output returns 403 (Forbidden) on the same notebooksYou can verify they are public by visiting (2 examples): https://www.kaggle.com/code/gpreda/byzantine-empire-citizens-name kernels_status → 401 Unauthorized |
Benchmark task notebooks created via 'Copy & Edit' can return either 401 (kernels_status) or 403 (list_kernel_session_output). Extend the error check to cover both status codes with the same actionable message.
7e7298a to
be044c0
Compare
Extend 401/403 handling to kernels_status in addition to kernels_output. Refine error message to clarify this is a known issue specific to benchmark task notebooks created via Copy & Edit.
Summary
list_kernel_session_outputandkernels_statusreturn 403 or 401 in several known scenarios that previously surfaced as an opaqueHTTPErrorwith no actionable information. This specifically affects benchmark task notebooks in the following cases:Changes
list_kernel_session_outputin atry/except HTTPErrorblock; on 401 or 403 raises aValueErrorwith a clear message describing the known causeskernels_statusin the sametry/except HTTPErrorblock with the same 401/403 handlingresponse.filesagainstNoneto prevent aTypeErrorcrash when the API returns an empty responseRepro