Skip to content

feat: colab attach uses a web UI runtime as a local session - #20

Merged
arlinamid merged 1 commit into
mainfrom
feat/attach
Nov 20, 2026
Merged

arlinamid merged 1 commit into
mainfrom
feat/attach

Conversation

@arlinamid

Copy link
Copy Markdown
Owner

What

A runtime opened in the Colab web UI (or by colab on another computer) shows as [?] in colab sessions, but no command could work on it, so a file could not be uploaded to a notebook's runtime from the CLI.

  • colab attach --endpoint ID [-s NAME] saves it as a local session from the assignment's proxy URL and token (/tun/m/assignments). Then colab upload, colab exec, colab ssh and scp through colab ssh --proxy-mode work on it. The CLI runs code in its own kernel; /content is shared with the notebook. colab stop -s NAME stops it in the web UI too.
  • Default name web-<id>; already a session: says which (exit 0); unknown endpoint: exit 1; name taken: exit 2.
  • Tray: the card of such a runtime gets a Connect button (colab attach --endpoint), next to Stop.

Tests

  • tests/test_attach.py (saved fields, default name, errors), tray panel/actions tests. Full suite: 1294 passed.
  • Live: a runtime started in the web UI was attached; files uploaded with colab upload, over colab ssh -- sh -c 'cat > /content/...' and with Windows OpenSSH scp via ProxyCommand=colab ssh --proxy-mode; all three showed in the notebook's Files panel. Runtime stopped afterwards, colab sessions empty.

🤖 Generated with Claude Code

A runtime opened in the Colab web UI (or by colab on another computer)
is listed by `colab sessions` as `[?]`, but no command could work on it:
there was no way to upload a file to a notebook's runtime from the CLI.

`colab attach --endpoint ID [-s NAME]` saves it as a local session from
the assignment's proxy URL and token, so `colab upload`, `exec`, `ssh`
and scp through `colab ssh --proxy-mode` work on it. The CLI runs code in
its own kernel; files under /content are shared with the notebook.
In the tray, the card of such a runtime gets a Connect button.

Tested live: a runtime started in the web UI was attached, files were
uploaded with `colab upload`, over `colab ssh -- sh -c 'cat > ...'` and
with Windows OpenSSH scp, and all three showed in the notebook's Files
panel; the runtime was then stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arlinamid
arlinamid merged commit 2362664 into main Nov 20, 2026
11 checks passed
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.

1 participant