drive_auth: propagation fails with HTTP 400 after consent; tool reports cli_parse instead of auth_failed #13

Closed
opened 2026-11-12 05:56:43 +00:00 by dsh · 2 comments
Owner

Updated plugin (after #10/#11 fix) now waits for consent and surfaces the URL - good - but the credential propagation fails with an HTTP 400 and the tool reports the wrong error class.

Repro

Fresh T4 (gpu-t4-s-usw4b0-11e6sbxidtjpv), colab_drive_auth(session="hijack", project="hijack", timeout_s=300):

  1. CLI printed REQUIRED: Google Drive Authorization needed. Please visit: https://accounts.google.com/... (state token included) and waited for Enter - correct.
  2. Operator granted Drive consent in the browser.
  3. CLI then printed [colab] Authorizing VM... and got
    [colab] Error propagating: 400 <html>Error 400 (Bad Request)</html>.
  4. Notebook cell raised ValueError: mount failed; the tool returned code: cli_parse, message "colab drivemount exited successfully but the Drive mount is not visible inside the VM".

So: the tool's error mapping is wrong (this is an auth/propagation failure, not a parse failure), and more importantly the handoff itself fails.

Hypotheses

  • Enter was sent before the consent was actually complete (or before the gsession cookie was usable), so propagation raced the consent -> 400.
  • The state token in the URL is short-lived / single-use; a failed propagation invalidates it and the tool does not start a fresh drivemount (new token) before retrying.
  • The manual CLI path works (operator has done it repeatedly), so the difference is likely timing/PTY interaction, not the account: manual flow = CLI prints URL, human approves, human presses Enter (seconds later).
  • The CLI's Authorizing VM step talks to Colab with the ephemeral gsession; a stale/duplicate automation (from an earlier attempt in the same VM) may confuse it.

Suggested fixes

  1. Do not auto-send Enter on a timer; wait for a consent signal (e.g. the browser return state, or at least a generous operator-confirmed Enter), then send it.
  2. On Error propagating: 400: restart the whole drivemount (fresh URL + token, possibly force_remount/kernel restart) and retry up to N times; only then return auth_failed.
  3. Add typed error auth_failed with the propagation status; keep the last URL in data.url so the operator can retry immediately.
  4. If possible, detect the Colab-side event drive_auth_success (it appeared in colab log in earlier manual attempts) before/after propagation and use it as the success signal instead of just ls.
  5. Regression test with a fake PTY: URL prompt -> "consent done" -> successful propagation; and a 400 case -> one automatic retry with a fresh URL.

Impact

Drive mount is still the one manual fallback (colab drivemount -s <session> in a terminal), so the v0 goal (one tool call, one browser click) is not met yet.

Updated plugin (after #10/#11 fix) now waits for consent and surfaces the URL - good - but the credential propagation fails with an HTTP 400 and the tool reports the wrong error class. ## Repro Fresh T4 (`gpu-t4-s-usw4b0-11e6sbxidtjpv`), `colab_drive_auth(session="hijack", project="hijack", timeout_s=300)`: 1. CLI printed `REQUIRED: Google Drive Authorization needed. Please visit: https://accounts.google.com/...` (state token included) and waited for Enter - correct. 2. Operator granted Drive consent in the browser. 3. CLI then printed `[colab] Authorizing VM...` and got `[colab] Error propagating: 400 <html>Error 400 (Bad Request)</html>`. 4. Notebook cell raised `ValueError: mount failed`; the tool returned `code: cli_parse`, message "`colab drivemount` exited successfully but the Drive mount is not visible inside the VM". So: the tool's *error mapping* is wrong (this is an auth/propagation failure, not a parse failure), and more importantly the handoff itself fails. ## Hypotheses - Enter was sent before the consent was actually complete (or before the gsession cookie was usable), so propagation raced the consent -> 400. - The `state` token in the URL is short-lived / single-use; a failed propagation invalidates it and the tool does not start a **fresh** `drivemount` (new token) before retrying. - The manual CLI path works (operator has done it repeatedly), so the difference is likely timing/PTY interaction, not the account: manual flow = CLI prints URL, human approves, human presses Enter (seconds later). - The CLI's `Authorizing VM` step talks to Colab with the ephemeral gsession; a stale/duplicate automation (from an earlier attempt in the same VM) may confuse it. ## Suggested fixes 1. Do not auto-send Enter on a timer; wait for a *consent signal* (e.g. the browser return state, or at least a generous operator-confirmed Enter), then send it. 2. On `Error propagating: 400`: restart the whole `drivemount` (fresh URL + token, possibly `force_remount`/kernel restart) and retry up to N times; only then return `auth_failed`. 3. Add typed error `auth_failed` with the propagation status; keep the last URL in `data.url` so the operator can retry immediately. 4. If possible, detect the Colab-side event `drive_auth_success` (it appeared in `colab log` in earlier manual attempts) before/after propagation and use it as the success signal instead of just `ls`. 5. Regression test with a fake PTY: URL prompt -> "consent done" -> successful propagation; and a 400 case -> one automatic retry with a fresh URL. ## Impact Drive mount is still the one manual fallback (`colab drivemount -s <session>` in a terminal), so the v0 goal (one tool call, one browser click) is not met yet.
dsh added this to the v0 - CLI wrapper milestone 2026-11-12 05:56:43 +00:00
Author
Owner

Retried on the updated plugin (2026-11-12 14:40 CET), fresh T4 gpu-t4-s-use1c0-11rxf7qiq7lo3. Same failure:

  • tool printed the consent URL and immediately continued to [colab] Authorizing VM... -> [colab] Error propagating: 400; the operator was not given a chance to approve (the call returned in one block, no waiting window).
  • result: code: cli_parse, "colab drivemount exited successfully but the Drive mount is not visible inside the VM".

So the 5 s timeout is gone (good), but the timing problem remains: Enter/authorize is sent without waiting for actual consent. This strengthens hypothesis #1 in the ticket: on 400, restart drivemount with a fresh URL and wait for an explicit operator-confirmation signal (or poll for drive_auth_success in colab log) before propagating.

Workaround still manual: colab drivemount -s <session> in a real terminal works every time.

Retried on the updated plugin (2026-11-12 14:40 CET), fresh T4 `gpu-t4-s-use1c0-11rxf7qiq7lo3`. **Same failure**: - tool printed the consent URL and immediately continued to `[colab] Authorizing VM...` -> `[colab] Error propagating: 400`; the operator was not given a chance to approve (the call returned in one block, no waiting window). - result: `code: cli_parse`, "`colab drivemount` exited successfully but the Drive mount is not visible inside the VM". So the 5 s timeout is gone (good), but the timing problem remains: **Enter/authorize is sent without waiting for actual consent**. This strengthens hypothesis #1 in the ticket: on 400, restart `drivemount` with a fresh URL and wait for an explicit operator-confirmation signal (or poll for `drive_auth_success` in `colab log`) before propagating. Workaround still manual: `colab drivemount -s <session>` in a real terminal works every time.
Author
Owner

Verified fixed on the 2026-11-12 build. Fresh T4 gpu-t4-s-usw4b1-je4yptohph4i:

{"ok": true, "data": {"mounted": true, "verified": true, "drive_path": "/content/drive",
 "project_path": "/content/drive/MyDrive/hijack", "attempts": 1, "already": false}}

The ask-user handoff works: URL surfaced, consent completed, no premature propagation / 400, Enter handled by the tool. colab_upload also succeeded with a 13.6 MB bundle (verified: true, retries: 0) and colab_download/ls/stop/usage all worked in the same session. Closing from my side; the manual-terminal fallback is no longer needed.

**Verified fixed on the 2026-11-12 build.** Fresh T4 `gpu-t4-s-usw4b1-je4yptohph4i`: ```json {"ok": true, "data": {"mounted": true, "verified": true, "drive_path": "/content/drive", "project_path": "/content/drive/MyDrive/hijack", "attempts": 1, "already": false}} ``` The ask-user handoff works: URL surfaced, consent completed, no premature propagation / 400, Enter handled by the tool. `colab_upload` also succeeded with a 13.6 MB bundle (`verified: true, retries: 0`) and `colab_download`/`ls`/`stop`/`usage` all worked in the same session. Closing from my side; the manual-terminal fallback is no longer needed.
dsh closed this issue 2026-11-12 18:39:59 +00:00
Sign in to join this conversation.
No description provided.