Repository navigation
Sync: Google's changes up to #259 (ssh --force, example imports) - #18
Merged
Merged
Conversation
* fix: hint `--force` in HTTP 429 error messages Both 429 variants (with and without session limit) now tell the user to retry with `--force` when a previous client died. * feat: add _killStaleSshd helper for force-reconnect Executes `pkill -P <sshd-parent-pid>` on the runtime kernel to kill stale per-connection sshd children left behind by a dead client, then waits 2s for the port to free. * feat: add --force flag to `colab ssh` Wires `--force` into all four ssh() code paths (cmd, proxy+cmd, proxy, interactive). When set, kills stale sshd children on the runtime before connecting, resolving HTTP 429 when a previous client died. Closes googlecolab#242 * test: add --force flag tests for colab ssh Covers interactive mode, proxy mode, no-force skip, and both 429 message variants mentioning --force. * fix: prevent kernel leak in _killStaleSshd Pass kernel_id to ColabRuntime and call rt.stop() in a finally block so the websocket is always closed. Simplify the kernel snippet to os.system, unquote the type annotation, and move the sleep outside the try block. Update --force help text to reflect that all SSH sessions are killed, not only stale ones. * refactor: remove dead --force in proxy+cmd child path _proxy_command() never forwards --force, so force is always False in the hidden --colab-internal-mode cmd branch. * refactor: consolidate --force tests into parametrized test Replace three separate tests + a redundant 429 message test with one parametrized test covering interactive, proxy-mode, cmd, and no-force paths. Add a body-coverage test that asserts kernel_id is forwarded and rt.stop() is called. * fix: remove time.sleep(2) from _killStaleSshd
…ooglecolab#212) When the Drive consent is approved for a Google account other than the one the CLI authenticated as, the propagation POST returns 400. The hook assumed every failure was an auth challenge, so it printed the raw response body (HTML), waited for the user to approve again, and retried forever. If the body was not JSON, parsing raised inside the websocket hook, which swallows the exception — leaving drive.mount() blocked until the 600s timeout. - Parse propagation responses defensively; HTML, plain text, empty and non-object bodies become an empty dict instead of raising. - Only show the consent prompt when the server returns an `unauthorized_redirect_uri`; other failures are reported directly. - Never echo the raw body. Print the status, a short server detail when present, and the multi-account guidance (select the account from `colab whoami`); log the body to the history file. - Answer the intercepted kernel request on failure too, so the command exits promptly rather than hanging. Co-authored-by: Seth Troisi <sethtroisi@google.com>
Brings in Google's commits since the last sync: - googlecolab#254 `colab ssh --force`: kills the runtime's stale SSH sessions before connecting. Kept next to the fork's -L/-N/--no-keep-alive options; it works on every ssh path of the fork. - googlecolab#222 example imports annotated after the runtime pip install (replaces the fork's own comment for the same thing). - googlecolab#212 / googlecolab#259 Drive propagation failures: the fork already handles these in drive_auth.perform_drive_authorization (defensive parsing, multi-account guidance, an error reply to the kernel), so the fork's hook and tests are kept; docs/04 says so. Also lists, in docs/01 TODO, the fork code keyed by endpoint that has to follow upstream googlecolab#260 (Public API assign/unassign) once it lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/04_automation_and_utility.md
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.
Merges
googlecolab/google-colab-climain up to googlecolab#259 into the fork, keeping every fork feature.colab ssh --force: kills the runtime's stale SSH sessions before connecting (for a dead client that holds the slot and causes HTTP 429). Kept next to the fork's-L/-N/--no-keep-alive; it runs on every ssh path (shell, forwards,-- CMD,--proxy-mode). Documented in README and docs/06.drive_auth.perform_drive_authorization(defensive parsing, multi-account guidance, an error reply to the kernel), so the fork's hook and tests are kept; docs/04 says so.endpointthat has to follow upstream Implement assign, unassign, list from Public API googlecolab/google-colab-cli#260 (Public API assign/unassign) once it is merged.Tests: 1288 passed, 11 skipped; ruff clean.
🤖 Generated with Claude Code