fix: fall back to list_assignments when KeepAliveAssignment RPC fails with auth error#60
fix: fall back to list_assignments when KeepAliveAssignment RPC fails with auth error#60merlinran wants to merge 1 commit into
Conversation
… with auth error The KeepAliveAssignment gRPC-web RPC requires the caller to hold serviceusage.services.use on Colab's project (1014160490159), which OAuth2/ADC user credentials outside a browser typically lack. When the RPC returns USER_PROJECT_DENIED, CONSUMER_INVALID, or SERVICE_DISABLED, fall back to list_assignments — a call to the Colab web frontend that uses the same OAuth/ADC token and doubles as an implicit keep-alive. If the endpoint is absent from the assignments response, raise a synthetic 404 so the daemon treats it as a terminal error and exits cleanly.
|
I tested this PR branch locally against a real Colab session, and it looks promising. Environment / checkout:
Validation:
Result: I would still treat this as branch-level validation, not a released-package fix yet, but it is strong positive evidence for the approach. |
|
Clever but no thank you ;) there is an actual keep-alive call elsewhere, we don't need to overload list-assignments. Also, please see https://github.com/googlecolab/google-colab-cli/blob/main/CONTRIBUTING.md - especially on topics like this. I'd much rather have a short discussion and notify folks that we're already working on it rather than have folks spend brain effort (or tokens) on problems that we're already tackling. |
|
Thank you for the reminder and fix! This was an accident - I needed to have a quick fix for myself, and the agent sent the PR following what I asked it to do for another case. |
Summary
KeepAliveAssignmentgRPC-web RPC atcolab.pa.googleapis.comrequiresserviceusage.services.useon the consumer project set viaX-Goog-User-Project. OAuth2 and ADC user credentials outside a browser typically lack this permission, causing every keep-alive request to fail with 403USER_PROJECT_DENIED. The keep-alive daemon then exits after 2 consecutive failures (60 seconds), and the Colab backend idles the VM ~7-8 minutes later.USER_PROJECT_DENIED,CONSUMER_INVALID,SERVICE_DISABLED) and falls back tolist_assignmentson the Colab web frontend — which authenticates with the user's OAuth/ADC token alone and doubles as an implicit keep-alive.Test plan
keep_alive_startedappears withoutkeep_alive_errorin historycolab status