Repository navigation
feat(transport): experimental direct_http image transport (one direct ogiZ0b POST) #1442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
e2e8040
feat(transport): freeze the ogiZ0b frame builder contract
ffroliva 959c396
feat(transport): add GeneratedImage.transport to the contract
ffroliva 135f23d
Record generated image transport in asset metadata
ffroliva b327f11
Add direct_can_serve strategy selector and unit tests
ffroliva bfef801
Builds pure ogiZ0b request bodies
ffroliva 716938d
feat(transport): build the ogiZ0b T2I body as a pure function (T1.1)
ffroliva c84c032
Record transport telemetry fact and report map
ffroliva b1d8023
Extract ogiz0b_reply_images reply mapper from _mc_submit_observe
ffroliva a5966b4
Bump notice version to 4, name transport in notice and docs
ffroliva 0fc2fe7
Implement DirectHttpTransport with fallback and direct HTTP runner
ffroliva 7cd2c3c
feat(telemetry): record the image transport in asset metadata and the…
ffroliva 7f378cf
fix(telemetry): keep the transport enum to the values a caller produces
ffroliva 7ef67f3
Register direct_http transport in experimental transports
ffroliva b8abd74
Add offline BDD scenario for direct_http image transport
ffroliva 7817505
feat(transport): add the direct_http image transport adapter (T1.2-T1.5)
ffroliva eebc858
fix(transport): send the migrated wire model name on the direct path
ffroliva aa27157
test(e2e): a plain t2i on direct_http is made by one direct POST; 16:…
ffroliva c37b73d
test(e2e): the queued MCP worker path runs a t2i on direct_http (T1.7)
ffroliva df44a5e
test: mirror GeneratedImage.transport on the worker test fakes
ffroliva 6e71af6
feat(transport): serve every aspect and up to two images on the direc…
ffroliva c41cc8a
feat(transport): serve a single in-project reference on the direct pa…
ffroliva b2576e8
fix(transport): wait for reCAPTCHA after navigating before a direct mint
ffroliva 1014171
feat(transport): serve one named character on the direct path (T2.2)
ffroliva be46d25
test(e2e): a named character is generated by the direct transport (T2.2)
ffroliva d51389e
docs: the direct_http image transport — user doc, Gate 0 findings, pl…
ffroliva fb4be23
fix(transport): direct_http review round — fallbacks, token cache, pa…
ffroliva 419b2a8
fix(transport): serve catalogued in-project refs again; cover local-f…
ffroliva 1e9f679
feat(transport): serve a bare @Name mention on the direct path
ffroliva ed7689e
feat(transport): serve every image count Flow offers on the direct path
ffroliva 1e4cca2
fix(transport): match Flow cookies per RFC 6265; address CodeRabbit o…
ffroliva 1b73233
fix(transport): verify refs and characters before a direct POST (seco…
ffroliva e24787e
feat(telemetry): count runs by image transport in the weekly report (…
ffroliva c26c296
feat(transport): upload local files with one direct maseQ POST (Phase 4)
ffroliva e7bb383
fix(transport): take the upload MIME type from the image bytes
ffroliva a11b9cb
Merge remote-tracking branch 'origin/develop' into feature/direct-htt…
ffroliva 512004e
Merge remote-tracking branch 'origin/develop' into feature/direct-htt…
ffroliva 7a3c637
Merge remote-tracking branch 'origin/develop' into feature/direct-htt…
ffroliva d16c961
refactor(transport): return one character pair from the direct read path
ffroliva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Direct HTTP image transport (`direct_http`, experimental) | ||
|
|
||
| `direct_http` generates images on `flow.google.com` with one direct HTTP request to Flow's | ||
| `ogiZ0b` RPC instead of driving the composer page. The browser is still started and still | ||
| needed: it mints the reCAPTCHA token and holds the signed-in session. It no longer types | ||
| the prompt, opens the settings pane or clicks Generate. | ||
|
|
||
| It is experimental. It is off unless you select it, and any request it cannot build | ||
| exactly goes to the default `ui_automation` transport before anything is sent. | ||
|
|
||
| ## Turning it on | ||
|
|
||
| ```bash | ||
| GFLOW_CLI_TRANSPORT=direct_http gflow image t2i "a paper boat on a pond" | ||
| ``` | ||
|
|
||
| The setting applies to `gflow image t2i` / `i2i` / `generate`, to the MCP image tool | ||
| (in-process and as a queued job), and to each row of `gflow run` (from the environment, or | ||
| `"transport": "direct_http"` in the config; a `"ref": "batch:N"` row is served too). | ||
| `gflow image batch` resolves to the same transport, but its rows run the inherited UI batch | ||
| method, which flow.google.com refuses on every transport. | ||
|
|
||
| ## What it serves | ||
|
|
||
| A request goes direct only when every slot of the frame it needs has been measured against | ||
| Flow's own submit. Everything else is routed to `ui_automation` before any request is sent. | ||
|
|
||
| | Request | Direct | Measured by | | ||
| |---|---|---| | ||
| | Text-to-image, model `nano2` / `nano21` (sent as `BELUGA`) | yes | 10 consecutive live generations | | ||
| | Aspect 9:16, 16:9 | yes | live generations (768x1376, 1376x768) | | ||
| | Aspect 1:1, 4:3, 3:4 | yes | captures of Flow's own submit | | ||
| | Count 1 to 4 | yes | live generations: 2, 3 and 4 entries in one request returned 2, 3 and 4 images | | ||
| | One ref made in this run: a `gflow run` row's `"ref": "batch:N"`, one image | yes | a live `gflow run` | | ||
| | One `--ref ./photo.png` (a local file not yet in the catalog), one image | yes | uploaded by one direct `maseQ` request (reCAPTCHA action `UPLOAD_IMAGE`), then generated directly; a live generation | | ||
| | One `--reference-entity` with its `--reference-entity-name` | yes | a live generation | | ||
| | One `@Name` mention of a character in the project | yes, when exactly one character has that name (trimmed, case-insensitive, as the UI picker matches) | the id is read from the project; a live generation | | ||
| | Any other model (`nano-pro`, `nano2-lite`, `imagen4`) | no | wire name not captured | | ||
| | Several refs, several characters, a ref plus a character, or a ref or character with count 2-4 | no | not captured | | ||
| | A mention whose name matches no character, or several | no | the UI picker decides | | ||
| | Agent-mode instructions, or `--ui-mode agentic` | no | not captured | | ||
| | A configured proxy (gflow's, the environment's or the OS's) | no | the browser and the request could leave by different routes | | ||
|
|
||
| ## Failure behaviour | ||
|
|
||
| | What happens | Before the request is sent? | Result | | ||
| |---|---|---| | ||
| | The browser's cookies, the session tokens or the reCAPTCHA mint are unavailable | yes | the same request runs on `ui_automation` | | ||
| | The connection cannot be opened (or opening it timed out) | yes | the same request runs on `ui_automation` | | ||
| | The account is served on labs.google, or `GFLOW_CLI_FLOW_HOST=labs.google` | yes | the same request runs on `ui_automation` | | ||
| | Flow answers a redirect, HTTP 401 or HTTP 403 | no: it was sent once and refused | the request is submitted a second time, through `ui_automation`'s own page | | ||
| | A timeout, a dropped connection or any other HTTP status | no | the run stops with a network error (`next_action: reconcile`); gflow does **not** resend, because Flow may have made the image | | ||
| | Flow refuses the prompt | no | the same refusal error as the UI path | | ||
| | A `--ref` found in the local catalog (a media id, or a file used before) | yes: the selector routes it before any request | the request runs on `ui_automation`; the catalog may be stale, and the UI path proves the image still exists before it submits, refusing at $0 | | ||
|
|
||
| A sent request is never retried. Every rejected reply drops the cached session token, so a | ||
| stale one cannot stick in a long-running MCP server or worker. A reCAPTCHA mint is retried | ||
| for up to 10 seconds while the page loads its reCAPTCHA script, because a mint spends | ||
| nothing. The page is parked after every direct run, as after a UI run. | ||
|
|
||
| ## What it records | ||
|
|
||
| - Each image's catalog row carries `"transport": "direct_http"` in its `metadata_json`. | ||
| - Log events: `direct.frame_built`, `direct.image_post` (status, `mint_ms`, `post_ms`, | ||
| `total_ms`) and `direct.fallback_to_ui` (reason). Set `GFLOW_CLI_LOG_LEVEL=INFO` to see | ||
| them. Tokens, cookies, prompts and signed URLs are never logged. | ||
|
|
||
| ## Refusals observed | ||
|
|
||
| On 2026-11-23 the test profile made about 90 image generations in one day. Late in that day | ||
| Flow answered some requests with a WAF refusal (exit 10, `WafRejectionError`), on direct and | ||
| plain requests alike, including a plain text-to-image with no reference; the identical | ||
| request usually went through minutes later. The refusals followed the day's volume, not a | ||
| request shape: Flow's own submit for each refused shape was captured and matches what the | ||
| direct path sends. Those refusals came back as a refusal reply (exit 10): nothing was billed, | ||
| and gflow did not resend them. This differs from an HTTP 403, a redirect or a 401 on the | ||
| direct POST, where Flow accepted nothing and the request is submitted once more through | ||
| `ui_automation` (see the failure table). | ||
|
|
||
| ## Speed | ||
|
|
||
| Measured on one profile, ten generations each, same prompt and model: the direct path took | ||
| a median of 18.6 s from mint to reply, the warm UI transport 20.7 s. Flow's own generation | ||
| time dominates both. The case for the transport is that it does not depend on the | ||
| composer's DOM, so selector changes and UI locale do not affect it. | ||
|
|
||
| Evidence: [`docs/superpowers/spikes/2026-11-22-direct-image-gate0.md`](superpowers/spikes/2026-11-22-direct-image-gate0.md). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.