Skip to content

feat(demo): auto-approve Google Drive mount consent (--auto-drive) - #24

Merged
henrik253 merged 1 commit into
fix/colab-gpu-runtime-bindingfrom
feat/auto-drive-mount
Jul 21, 2026
Merged

feat(demo): auto-approve Google Drive mount consent (--auto-drive)#24
henrik253 merged 1 commit into
fix/colab-gpu-runtime-bindingfrom
feat/auto-drive-mount

Conversation

@henrik253

Copy link
Copy Markdown
Owner

Stacked on #21 — diff shown against fix/colab-gpu-runtime-binding; will retarget to main once #21 merges.

What this adds

Notebook cells calling drive.mount(...) now work unattended: a new --auto-drive flag auto-approves the whole consent flow — Colab's Drive permission dialog and the real accounts.google.com popup with its consent screens.

Why a watcher, not a one-shot flow

Live probing showed the surfaces are conditional: the first mount raises the dialog + a 2-screen OAuth popup, but once consent is granted, later mounts show neither. And drive.mount itself times out after ~2 minutes (a human-speed manual flow on a remote desktop actually hit that timeout during probing). So the automation is a background watcher per managed tab: it approves each surface if and when it appears, idles otherwise, and runs concurrently with cell execution.

Implementation

  • browser/adapters/colab/drive_mount.py (new) — the watcher. Verified UI contracts from the live probe:
    • The Colab dialog is a generic mwc-dialog.yes-no-dialog (no distinctive class, unlike the MCP connect dialog) — identified by its "Google Drive" text. Confirm via JS click on [dialogaction="ok"].
    • Popup consent screens are locale-dependent in text (this account renders "Weiter", not "Continue") but structurally stable: footer buttons carry jsname="LgbsSe" with Cancel first, Confirm last in DOM order; jsname="NakZHc" is a scroll-down affordance that must be dismissed first.
    • The popup closing itself is the success signal, never the click — same philosophy as the MCP dialog approval.
  • browser/controller.pyBrowserController(auto_drive=...) spawns one watcher per tab (after the MCP dialog approval) and cancels it on close/aclose.
  • run_demo.py--auto-drive flag threaded through live_phase.
  • cpu-a.ipynb / t4.ipynb — demo cells that mount Drive and verify /content/drive/MyDrive exists.

Security posture

Granting this consent lets notebook code read and modify all of the user's Drive files. The flag is therefore off by default and deliberately separate from --auto-approve, following the project's explicit-consent pattern (preservation_confirmed etc.).

Verification

Live run-notebooks --auto-approve --auto-drive on the 2-notebook config:

  • demo-cpu-a: 3 cells, drive-mounted: True
  • demo-t4: 3 cells, Tesla T4 / 14912 MB VRAM, Mounted at /content/drive, drive-mounted: True — this one ran on a fresh VM, so the watcher handled the full dialog + popup flow live

Full suite green: 383 passed.

🤖 Generated with Claude Code

A cell calling drive.mount raises Colab's Drive permission dialog and then a
real accounts.google.com popup with consent screens; drive.mount itself gives
up after about two minutes, so on a server the flow has to be automated. Once
consent is granted, later mounts show neither surface — so the automation is
a background watcher per managed tab, not a one-shot flow: it approves each
surface if and when it appears and idles otherwise.

- browser/adapters/colab/drive_mount.py (new): the watcher. The Colab dialog
  is a generic yes-no mwc-dialog identified by its "Google Drive" text; the
  popup consent screens are locale-dependent in text but structurally stable
  (footer buttons jsname="LgbsSe", Cancel first / Confirm last in DOM order;
  jsname="NakZHc" is a scroll affordance dismissed first). The popup closing
  itself is the success signal, never the click.
- browser/controller.py: BrowserController(auto_drive=...) spawns one watcher
  per tab after the MCP dialog is approved, and cancels it on close/aclose.
  Off by default: the consent lets notebook code modify the user's Drive
  files, so it needs an explicit opt-in.
- run_demo.py: --auto-drive flag, threaded through live_phase; separate from
  --auto-approve on purpose.
- cpu-a.ipynb / t4.ipynb: drive-mount demo cells.

Verified live: run-notebooks with --auto-drive on the 2-notebook config; both
notebooks report drive-mounted: True (T4 on a fresh VM went through the full
dialog + popup flow). Suite green: 383 passed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@henrik253
henrik253 merged commit 533f338 into fix/colab-gpu-runtime-binding Jul 21, 2026
1 check failed
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