feat(demo): auto-approve Google Drive mount consent (--auto-drive) - #24
Merged
Merged
Conversation
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>
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.
What this adds
Notebook cells calling
drive.mount(...)now work unattended: a new--auto-driveflag auto-approves the whole consent flow — Colab's Drive permission dialog and the realaccounts.google.compopup 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.mountitself 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: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"].jsname="LgbsSe"with Cancel first, Confirm last in DOM order;jsname="NakZHc"is a scroll-down affordance that must be dismissed first.browser/controller.py—BrowserController(auto_drive=...)spawns one watcher per tab (after the MCP dialog approval) and cancels it onclose/aclose.run_demo.py—--auto-driveflag threaded throughlive_phase.cpu-a.ipynb/t4.ipynb— demo cells that mount Drive and verify/content/drive/MyDriveexists.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_confirmedetc.).Verification
Live
run-notebooks --auto-approve --auto-driveon the 2-notebook config:demo-cpu-a: 3 cells,drive-mounted: Truedemo-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 liveFull suite green: 383 passed.
🤖 Generated with Claude Code