Skip to content

fix(extension): support flow.google.com migration and direct asset delivery - #16

Open
skanbark7 wants to merge 4 commits into
kodelyx:mainfrom
skanbark7:fix/flow-google-com-support
Open

skanbark7 wants to merge 4 commits into
kodelyx:mainfrom
skanbark7:fix/flow-google-com-support

Conversation

@skanbark7

Copy link
Copy Markdown

Summary

Google recently migrated Google Flow completely from labs.google/fx/tools/flow to https://flow.google.com/. As part of this migration:

  • Google replaced the React frontend with an Angular Boq frontend (boq_labs-ai-sandbox-frontend_...).
  • The frontend communicates via internal batchexecute RPCs instead of client-side Bearer ya29... REST calls to https://aisandbox-pa.googleapis.com.
  • Calling aisandbox-pa.googleapis.com directly without the token fails with 401 UNAUTHENTICATED, and requests with cookies or origin headers fail Google's internal XD3 check (Bad request: Origin doesn't match Host for XD3).
  • Generated image and video assets are now served as signed URLs on https://flow-content.google/image/....

Changes

  1. Active Flow Tab Automation:

    • Updated extension permissions for https://flow.google.com/* and https://*.google.com/*.
    • In background.js, automated the active Google Flow project tab via chrome.scripting.executeScript:
      • Selects Image mode and configures the requested aspect ratio (1:1, 9:16, 16:9, etc.) through Flow's settings menu.
      • Inputs prompt into the ProseMirror editor.
      • Triggers generation and monitors both DOM elements (img tags) and network performance entries for the new signed asset URL on flow-content.google/image/....
      • Returns the signed CDN URL to flow-agent for direct downloading.
  2. Diagnostics & Management:

    • Added /api/dev/reload and /api/dev/probe endpoints to the bridge and server routes to allow reloading the unpacked extension and diagnosing tab state programmatically.
    • Handled /credits requests to return instant 200 without blocking.
    • Updated rules.json to prevent synthetic CORS stalls on Flow's new origin.

Verification

  • Tested with image generation:
    flow image "a cute glowing origami fox sitting on an open book, soft warm studio lighting" --aspect square
  • Successfully generated, verified JPEG format, downloaded to output/, and recorded to history.json.

김우주 and others added 4 commits September 7, 2026 16:50
fix: recognize current Flow host and preserve upload failures
Generation had been failing for a week with CAPTCHA_FAILED: CONTENT_TIMEOUT
even though /health reported healthy. Three separate causes, all from the
move from labs.google/fx/tools/flow to flow.google.com:

- The Flow bearer is only observable during the labs.google -> flow.google.com
  handoff. Reloading a flow.google.com tab never re-captures it, so the
  token was never obtained (has_flow_key false) and could never refresh.
  Token refresh now drives an extension-owned tab through TOKEN_URL.
- reCAPTCHA Enterprise is only loaded on /project/<id> pages, never on the
  home page the old FLOW_URL now redirects to. On-demand tabs open the
  request's projectId (or the last project page seen), and project tabs
  are preferred over other Flow tabs.
- The first tab matching a Flow URL was used blindly. A tab with a dead
  bridge (opened before an extension reload, or never loaded injected.js)
  swallowed GET_CAPTCHA for 25s. Tabs are now pinged (PING_BRIDGE ->
  FLOW_AGENT_PING/PONG) before use and skipped if they do not answer.

Hardening found necessary while debugging:
- Every await on the tab-lookup path is bounded (withTimeout) so one
  Chrome API call that never settles cannot park the shared
  getOrOpenFlowTab promise and silently stall every later request.
- GET_CAPTCHA is re-dispatched until injected.js answers (it loads async;
  a first dispatch could be lost); injected.js dedups by requestId and
  caps grecaptcha.execute at 15s.
- The Google API fetch and callback delivery carry timeouts.
- The last 200 '[Flow Agent]' console lines persist to
  chrome.storage.local.debugLog so stalls can be diagnosed after the fact.

Verified end to end: a 4s text-to-video clip generated in 88s through the
extension (credits 1050 -> 1043).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GkWggBWEKrNTR4B5opZ3bo
… delivery

Google migrated Flow from React on labs.google to Angular Boq on flow.google.com, replacing direct client-side aisandbox-pa REST calls with batchexecute and signed CDN URLs on flow-content.google.

- Automate image generation in active Flow project tab via extension scripting (mode switch, aspect ratio selection, prompt entry, generate trigger)
- Add dual-layer detection of generated signed assets on flow-content.google via DOM img tags and performance resource entries
- Add extension reload and diagnostic endpoints (/api/dev/reload, /api/dev/probe) to bridge and server
- Update extension manifest and permissions for flow.google.com and flow-content.google
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