colab_drive_auth: no consent window on a headless CLI, tool waits silently #14

Closed
opened 2026-11-12 10:42:34 +00:00 by dsh · 2 comments
Owner

Real-account report after the v0.1.3 timeout fix.

Observed

colab_drive_auth starts the handoff, but no browser window opens and the tool does not return until timeout_s expires. The consent URL is only visible in data.url after the timeout.

Root cause

  • CLI 0.7.5 does not open the consent page at all: commands/automation.py prints the URL and blocks on the Enter prompt; only 0.8.0's show_drive_auth_url() calls a browser opener.
  • A DSH service usually has no DISPLAY, so even 0.8.0's opener cannot show a window.
  • The tool surfaced data.url only in the final auth_pending result, so the operator had no actionable URL while the retry loop burned the budget.

Fix (0.1.4)

  • return auth_pending + URL after the first failed attempt by default; wait_for_consent: true keeps the old one-call loop;
  • best-effort browser launch (xdg-open/open) and data.browser {opened, reason} (no-display, not-installed, failed, launched) so the reason is diagnosable; disable with driveOpenBrowser: false;
  • recover the URL from colab log drive_auth_needed events when stdout does not carry it;
  • data.last_tail carries the redacted automation output; no URL ⇒ hint points at colab_session_status/colab_session_restart instead of asking for a nonexistent URL.

Still worth knowing

CLI 0.8.0 keeps its OAuth token in the OS keyring (0.7.5 used ~/.config/colab-cli/token.json). A headless host without a keyring backend prompts for OAuth on every invocation; use a keyring backend or colab --auth=adc there.

Real-account report after the v0.1.3 timeout fix. ## Observed `colab_drive_auth` starts the handoff, but no browser window opens and the tool does not return until `timeout_s` expires. The consent URL is only visible in `data.url` after the timeout. ## Root cause - CLI **0.7.5 does not open the consent page at all**: `commands/automation.py` prints the URL and blocks on the Enter prompt; only 0.8.0's `show_drive_auth_url()` calls a browser opener. - A DSH service usually has no `DISPLAY`, so even 0.8.0's opener cannot show a window. - The tool surfaced `data.url` only in the final `auth_pending` result, so the operator had no actionable URL while the retry loop burned the budget. ## Fix (0.1.4) - return `auth_pending` + URL after the first failed attempt by default; `wait_for_consent: true` keeps the old one-call loop; - best-effort browser launch (`xdg-open`/`open`) and `data.browser {opened, reason}` (`no-display`, `not-installed`, `failed`, `launched`) so the reason is diagnosable; disable with `driveOpenBrowser: false`; - recover the URL from `colab log` `drive_auth_needed` events when stdout does not carry it; - `data.last_tail` carries the redacted automation output; no URL ⇒ hint points at `colab_session_status`/`colab_session_restart` instead of asking for a nonexistent URL. ## Still worth knowing CLI 0.8.0 keeps its OAuth token in the OS keyring (0.7.5 used `~/.config/colab-cli/token.json`). A headless host without a keyring backend prompts for OAuth on every invocation; use a keyring backend or `colab --auth=adc` there.
Author
Owner

Fixed in 0.1.4 (6541015, tag v0.1.4; Forgejo registry and release page are live; npmjs staged).

  • colab_drive_auth returns auth_pending + data.url immediately after the first failed consent attempt instead of waiting out timeout_s at 180s. wait_for_consent: true restores the old one-call retry loop.
  • It tries to open the URL on the DSH host (xdg-open/open) and reports data.browser {opened, reason}: launched, no-display, not-installed, failed, disabled. Set driveOpenBrowser: false to skip the attempt.
  • The URL is recovered from colab log drive_auth_needed events if stdout does not contain it; data.last_tail carries the redacted automation tail.
  • If no URL was seen at all, the hint now points at colab_session_status / colab_session_restart rather than a nonexistent URL.

Retest: upgrade, restart the profile, then call colab_drive_auth(session=…, project=…). Expect an immediate auth_pending with the URL; open/approve it, then call again — the retry mounts.

Environment notes confirmed while reproducing: CLI 0.7.5 never opens the consent page (0.8.0 does), and 0.8.0 stores its OAuth token in the OS keyring. This box has no keyring backend and no display, so it cannot complete a full live mount; a headless host needs a keyring backend or colab --auth=adc.

Fixed in **0.1.4** (`6541015`, tag `v0.1.4`; Forgejo registry and release page are live; npmjs staged). - `colab_drive_auth` returns `auth_pending` + `data.url` immediately after the first failed consent attempt instead of waiting out `timeout_s` at 180s. `wait_for_consent: true` restores the old one-call retry loop. - It tries to open the URL on the DSH host (`xdg-open`/`open`) and reports `data.browser {opened, reason}`: `launched`, `no-display`, `not-installed`, `failed`, `disabled`. Set `driveOpenBrowser: false` to skip the attempt. - The URL is recovered from `colab log` `drive_auth_needed` events if stdout does not contain it; `data.last_tail` carries the redacted automation tail. - If no URL was seen at all, the hint now points at `colab_session_status` / `colab_session_restart` rather than a nonexistent URL. Retest: upgrade, restart the profile, then call `colab_drive_auth(session=…, project=…)`. Expect an immediate `auth_pending` with the URL; open/approve it, then call again — the retry mounts. Environment notes confirmed while reproducing: CLI **0.7.5 never opens the consent page** (0.8.0 does), and 0.8.0 stores its OAuth token in the OS keyring. This box has no keyring backend and no display, so it cannot complete a full live mount; a headless host needs a keyring backend or `colab --auth=adc`.
dsh closed this issue 2026-11-12 10:46:42 +00:00
Author
Owner

Follow-up in 0.1.6 after the real-account report that the plugin auto-propagated before consent and returned 400.

  • The handoff now starts colab drivemount, waits at its Enter prompt, and asks a blocking Next/Cancel question. Only Next writes the newline; Cancel terminates the child and returns auth_pending with the URL. This is the manual terminal flow encoded in the tool.
  • The clickable link is in the question's Markdown detail (the card's title is plain text, which is why the earlier card had no clickable URL).
  • colab_run forwards the calling agent so the same card works inside a recipe.
  • Headless profiles without a userQuestions answerer keep the timer fallback.

Verified on 2026-11-12 with a real CPU session on srvbtw: fresh session, real colab_drive_auth mounted /content/drive (attempts: 1, verified), a real colab_ls listed MyDrive, then the session was stopped. Account consent was already on file for this account, so that mount did not need a prompt; the Next/Cancel card path was exercised in the Web UI against the fake CLI backend. 101 tests pass on Node 26 and 22.6.

Follow-up in **0.1.6** after the real-account report that the plugin auto-propagated before consent and returned 400. - The handoff now starts `colab drivemount`, waits at its Enter prompt, and asks a blocking **Next/Cancel** question. Only **Next** writes the newline; **Cancel** terminates the child and returns `auth_pending` with the URL. This is the manual terminal flow encoded in the tool. - The clickable link is in the question's Markdown `detail` (the card's title is plain text, which is why the earlier card had no clickable URL). - `colab_run` forwards the calling agent so the same card works inside a recipe. - Headless profiles without a `userQuestions` answerer keep the timer fallback. Verified on 2026-11-12 with a real CPU session on srvbtw: fresh session, real `colab_drive_auth` mounted `/content/drive` (`attempts: 1`, verified), a real `colab_ls` listed `MyDrive`, then the session was stopped. Account consent was already on file for this account, so that mount did not need a prompt; the Next/Cancel card path was exercised in the Web UI against the fake CLI backend. 101 tests pass on Node 26 and 22.6.
Sign in to join this conversation.
No description provided.