Skip to content

fix: recognize flow.google.com and surface upload bridge errors - #11

Open
ballz921 wants to merge 1 commit into
kodelyx:mainfrom
ballz921:fix/flow-domain-upload-errors
Open

fix: recognize flow.google.com and surface upload bridge errors#11
ballz921 wants to merge 1 commit into
kodelyx:mainfrom
ballz921:fix/flow-domain-upload-errors

Conversation

@ballz921

@ballz921 ballz921 commented Sep 7, 2026

Copy link
Copy Markdown

Summary

Related to #10partial remediation, not a claim that the new Flow generation API works end to end.

  • Add https://flow.google.com/* to the extension's host permissions, content script matches, and web-accessible resource matches, while retaining legacy Flow support.
  • Reuse new/legacy Flow tab patterns and check exact HTTPS hostnames / legacy Flow paths before content-script injection.
  • Return createdTab from the fresh-tab path instead of the undefined retryTabs[0].
  • Preserve upload response status and actionable scalar error messages instead of collapsing top-level bridge errors to Unknown. Do not serialize response objects into logs.
  • Add regression tests and document remaining compatibility limitations.

Observed failure

An installation at 206285a recorded these extension errors:

CAPTCHA_FAILED: Cannot access contents of url "https://flow.google.com/". Extension manifest must request permission to access this host.
retryTabs is not defined

The Python upload path reduced these errors to Image upload failed: Unknown, then the local API returned HTTP 500. That local 500 is not proof that Google's upload endpoint returned 500.

Validation

From flow-agent/:

python3 -m pytest -q tests/test_extension_flow_urls.py tests/test_media_storage.py
# 20 passed

WS_PORT=0 HTTP_PORT=0 python3 -m pytest -q
# 84 passed

node --check ../flow-extension/background.js
git diff --check
  • Tests were introduced before the implementation; initial focused run reproduced missing host/tab support and lost upload error details.
  • A separate local Node VM probe executed the actual URL predicate against 10 accepted/rejected URLs and exercised fresh-tab return plus post-redirect injection with mocked Chrome APIs; all passed. That probe is supplementary, not a live Chrome test.
  • The first full run inside a restricted sandbox could not bind lifecycle-test sockets. The complete suite was rerun successfully outside that sandbox with ephemeral test ports; no production service was restarted.
  • Manifest/background regression tests in this PR are source contracts, not browser end-to-end tests.

Deliberately out of scope

No cookie/batchexecute migration, authentication changes, CAPTCHA disabling/bypass, Origin/Referer changes, REST endpoint changes, or callback-secret handling changes. New-site token capture, CAPTCHA execution and live upload/generation remain unverified and may require follow-up work described in #10. This PR does not close that broader issue.

@santoshray02 santoshray02 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced both errors on a live deployment (backend 2.0.5 on a headless VPS, extension in a remote Chrome) on 2026-09-08:

  • CAPTCHA_FAILED: Cannot access contents of url "https://flow.google.com/" with a flow.google.com tab open
  • retryTabs is not defined on the fresh-tab path with no Flow tab open

This PR's manifest and background.js changes are exactly what fixes those two failures; I had hand-patched the same lines locally before finding this and reverted in favour of it. The isFlowUrl() predicate is cleaner than the old regex.

Two notes for whoever merges:

  1. As the description says, this does not make generation work on flow.google.com. #10 documents that the new site uses cookie auth, no grecaptcha, and a batchexecute RPC instead of the aisandbox-pa REST call. Worth keeping #10 open or re-linking it, since it is closed.
  2. https://labs.google/fx/tools/flow still serves the full app with no server-side redirect as of today, so with this PR the legacy path remains the working one when a labs.google tab is in the foreground.

Approving on the strength of the reproduced fix; the #10 port is separate work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants