colab_drive_auth fails after 5s (cli_timeout) on a fresh VM; automation still busy #10

Closed
opened 2026-11-11 22:41:35 +00:00 by dsh · 1 comment
Owner

Tool: colab_drive_auth(session="hijack", project="hijack", timeout_s=300) on a brand-new T4 session
(cliVersion 0.7.5, plugin config project=colab, driveRoot=/content/drive/MyDrive).

Observed

Immediate failure after ~5 s:

{"ok": false, "session": "hijack", "error": {
  "code": "cli_timeout",
  "message": "The Colab CLI did not finish within 5s.",
  "hint": "The CLI child was terminated. If this was a long exec, the session may still hold the kernel; check colab_session_status.",
  "raw_tail": "\n[colab] A new version of Colab CLI is available: 0.8.0 (current: 0.7.5)\n..."
}}

colab_session_status right after: status: BUSY (automation(drivemount)), last_execution: automation:drivemount. So the Colab-side automation was still running while the tool had already given up and killed its child.

Expected

  • timeout_s=300 should be the consent wait budget; the tool should wait for the automation / operator, not fail after 5 s.
  • The consent URL must be surfaced in data.url (or streamed) so the operator can open it from another machine.
  • On timeout it should return auth_pending + URL, without killing the automation (or kill it cleanly), rather than cli_timeout after 5 s.

Likely cause

A hardcoded 5 s child/exec timeout (or cli exec wrapper default) instead of the tool's timeout_s; the drivemount automation needs tens of seconds just to start.

Suggestions

  1. Use timeout_s (bounded 1–3600) for the whole handoff, and a separate startup grace of >=60 s for spawning colab drivemount.
  2. Parse drive_auth_needed events (they carry the full uri) — colab log -s <session> has it; surface that URL even while waiting.
  3. Poll colab ls /content/drive/MyDrive/<project> as the success signal (as designed) instead of waiting for the child to exit.
  4. Add a regression test: fake PTY prints URL + blocks, tool must wait and send Enter after mount appears.

Impact

Blocks the only interactive step; workaround is the manual colab drivemount -s <session> + Enter (as before the plugin).

Tool: `colab_drive_auth(session="hijack", project="hijack", timeout_s=300)` on a brand-new T4 session (cliVersion `0.7.5`, plugin config `project=colab`, `driveRoot=/content/drive/MyDrive`). ## Observed Immediate failure after ~5 s: ```json {"ok": false, "session": "hijack", "error": { "code": "cli_timeout", "message": "The Colab CLI did not finish within 5s.", "hint": "The CLI child was terminated. If this was a long exec, the session may still hold the kernel; check colab_session_status.", "raw_tail": "\n[colab] A new version of Colab CLI is available: 0.8.0 (current: 0.7.5)\n..." }} ``` `colab_session_status` right after: `status: BUSY (automation(drivemount))`, `last_execution: automation:drivemount`. So the Colab-side automation was still running while the tool had already given up and killed its child. ## Expected - `timeout_s=300` should be the consent wait budget; the tool should wait for the automation / operator, not fail after 5 s. - The consent URL must be surfaced in `data.url` (or streamed) so the operator can open it from another machine. - On timeout it should return `auth_pending` + URL, **without** killing the automation (or kill it cleanly), rather than `cli_timeout` after 5 s. ## Likely cause A hardcoded 5 s child/exec timeout (or `cli exec` wrapper default) instead of the tool's `timeout_s`; the drivemount automation needs tens of seconds just to start. ## Suggestions 1. Use `timeout_s` (bounded 1–3600) for the whole handoff, and a separate startup grace of >=60 s for spawning `colab drivemount`. 2. Parse `drive_auth_needed` events (they carry the full `uri`) — `colab log -s <session>` has it; surface that URL even while waiting. 3. Poll `colab ls /content/drive/MyDrive/<project>` as the success signal (as designed) instead of waiting for the child to exit. 4. Add a regression test: fake PTY prints URL + blocks, tool must wait and send Enter after mount appears. ## Impact Blocks the only interactive step; workaround is the manual `colab drivemount -s <session>` + Enter (as before the plugin).
dsh added this to the v0 - CLI wrapper milestone 2026-11-11 22:41:35 +00:00
Author
Owner

Fixed in 0.1.3 (9ce6715, tag v0.1.3; Forgejo registry + release page are live).

Root cause was exactly the suspected 5 s cap, but it was self-inflicted: colab_drive_auth polled colab ls every 250 ms while the drivemount automation held the kernel. The kernel serializes work, so the listing queued behind the automation, hit the hardcoded 5 s CLI budget and aborted the whole handoff with cli_timeout.

What changed:

  • the attempt now waits for the drivemount child to exit (full timeout_s budget) and only then verifies the mount with ls — no listing while the automation runs;
  • all listings use a new listTimeoutMs (default 60 s) instead of 5 s;
  • a new attempt is not started with <250 ms left on the deadline (no doomed children);
  • regression test: 3 s automation + an 8 s-blocking ls + a 4 s list budget → the handoff still succeeds.

Upgrade and retest: dsh plugin --profile web add --registry https://git.pvlb.dev/api/packages/dsh-plugins/npm/ dsh-colab@0.1.3, then restart the profile. The URL is still returned in data.url on auth_pending; if the VM is left with BUSY (automation(drivemount)) after a timeout, colab_session_restart clears the wedged kernel before retrying.

Fixed in **0.1.3** (`9ce6715`, tag `v0.1.3`; Forgejo registry + release page are live). Root cause was exactly the suspected 5 s cap, but it was self-inflicted: `colab_drive_auth` polled `colab ls` every 250 ms *while* the `drivemount` automation held the kernel. The kernel serializes work, so the listing queued behind the automation, hit the hardcoded 5 s CLI budget and aborted the whole handoff with `cli_timeout`. What changed: - the attempt now waits for the `drivemount` child to exit (full `timeout_s` budget) and only then verifies the mount with `ls` — no listing while the automation runs; - all listings use a new `listTimeoutMs` (default 60 s) instead of 5 s; - a new attempt is not started with <250 ms left on the deadline (no doomed children); - regression test: 3 s automation + an 8 s-blocking `ls` + a 4 s list budget → the handoff still succeeds. Upgrade and retest: `dsh plugin --profile web add --registry https://git.pvlb.dev/api/packages/dsh-plugins/npm/ dsh-colab@0.1.3`, then restart the profile. The URL is still returned in `data.url` on `auth_pending`; if the VM is left with `BUSY (automation(drivemount))` after a timeout, `colab_session_restart` clears the wedged kernel before retrying.
dsh closed this issue 2026-11-11 22:56:20 +00:00
Sign in to join this conversation.
No description provided.