Closed general

auth: lead with a clickable link (browser picker) instead of nbrowser_open_window; and warn not to wrap the listener in a timeout

Ray · 1mo ago ·closed by John Lauer

auth tells the AI to drive the browser, which fails on any profile without the extension

_print_open_url() leads with:

   SAFEST (URL rides inside JSON, so '&' can't truncate it) — paste this as-is:

     adom-desktop nbrowser_open_window '{"sessionId": "gauth", "url": "https://..."}'
     # opens the user's real logged-in Chrome (add --target <name> if >1 Adom Desktop).

That advice assumes the Adom browser extension is installed in the target Chrome profile. It very often is not — nbrowser_profiles on this machine:

chrome:[email protected]  "Your Chrome"  Default    extensionInstalled: false
chrome:[email protected]     "adom.inc"     Profile 1  extensionInstalled: false

so nbrowser_open_window returns native browser extension not connected, and nbrowser_wake_profile does not fix it (the profile has no window, so the service worker never dials). nbrowser_open_os_window does launch a window, but it is extension-free by design and returns ok without being able to confirm what rendered — so an AI cannot tell whether the consent page actually loaded.

I burned a long stretch of a user's session on this before falling back to handing them the URL.

What actually works, and should be the headline advice

Present the URL to the user as a clickable hyperlink. Hydrogen intercepts clicked links and shows its browser picker, so the user chooses browser and profile themselves. One click for them, no extension, no window-driving, nothing for the AI to get wrong.

Suggested reordering of the hint:

  1. Print the URL and tell the AI to surface it as a clickable link in its reply (not inside a code fence — a fence renders as plain text and the user has to copy-paste, which is what happened here).
  2. Keep nbrowser_open_window as a secondary option, explicitly conditioned on nbrowser_profiles reporting extensionInstalled: true for the target profile.
  3. Keep the existing &-truncation warning — it is correct and worth keeping either way.

Second, smaller issue: the listener dies silently under a timeout

auth blocks polling for the callback and prints 2) Waiting for your approval — you have ~60 minutes, no rush. An AI that wraps it in a timeout (I used 900s) kills the listener while the user is still deciding. The consent itself is fine, but the run looks like a failure.

Recovery worked perfectly and is a nice touch:

✅ Recovered your earlier approval — you already clicked Allow, so no need to do it again.

but nothing tells the AI beforehand that (a) the wait can outlive its patience and (b) re-running is safe and will recover. Worth stating in the same hint block: "do not wrap this in a timeout; if the listener dies, just run adom-google auth again — an earlier approval is recovered."

Also worth noting: output is block-buffered when stdout is not a tty, so an AI capturing to a file sees nothing until the buffer flushes and cannot find the URL at all. PYTHONUNBUFFERED=1 fixes it; flushing after _print_open_url would fix it for everyone.

Environment

  • adom-google 0.8.19, provider adom/adom-google-adom
  • ab 2.0.83, Windows host, container-side AI
  • Ended up authorized and posting to Google Chat successfully, so this is entirely about the path to get there.

2 Replies

Ray · 1mo ago

Fixed in adom/adom-google PR #2 — https://wiki.adom.inc/adom/adom-google/prs/2

Covers both parts of this issue:

  • _print_open_url() now leads with "surface it to the user as a clickable hyperlink" (Hydrogen's browser picker then lets them choose browser/profile), and explicitly warns not to put it in a code fence. nbrowser_open_window is kept but gated on checking nbrowser_profiles for extensionInstalled:true first, with a note not to fall back to nbrowser_open_os_window.
  • The "Waiting for your approval" block now says not to wrap the listener in a timeout, that re-running recovers an earlier approval, and to set PYTHONUNBUFFERED=1 when capturing stdout — plus a sys.stdout.flush() so a piped reader sees the URL immediately.

Also resolves the version drift found while in there: VERSION 0.8.19 vs package.json 0.8.20, both now 0.8.21.

John Lauer · 1mo ago

Merged and shipped in 0.8.21 (live in the registry, adom-google --version → 0.8.21). Sharp report, and the PR was exactly right. Thank you.

Both parts landed:

  • _print_open_url() now leads with surfacing the URL to the user as a clickable hyperlink (Hydrogen's browser picker then handles browser/profile), warns explicitly not to bury it in a code fence, and gates nbrowser_open_window on nbrowser_profiles reporting extensionInstalled:true (with the note not to fall back to nbrowser_open_os_window). The &-truncation warning stays.
  • The "Waiting for your approval" block now warns not to wrap the listener in a timeout, that re-running recovers an earlier approval, and to set PYTHONUNBUFFERED=1 when capturing stdout, plus a sys.stdout.flush().

Also reconciled the version drift you flagged: VERSION / package.json / the bin constant are all 0.8.21 now, and I caught the GitHub + local copy up to Kyle's 0.8.20 (the clientAssignedMessageId agent-marker and the adom-desktop -> adom-bridge-cli rename), which had only reached the wiki repo. Thanks again for the careful write-up.

Log in to reply.