diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 7e51e82d0..7bf7e92be 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "gflow", - "version": "0.105.1", + "version": "0.106.0", "description": "Reusable development and operations workflows for gflow-cli", "author": { "name": "Flavio Oliva", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 148bf132e..dd0c7265b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: with: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Audit locked dependencies for known CVEs # Fails the build on any known advisory. Accept later via: pip-audit --ignore-vuln # @@ -91,7 +91,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Audit workflows (zizmor) # --offline: the online audits need a GH token and reach the network, so @@ -127,7 +127,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -186,7 +186,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install ${{ matrix.python-version }} @@ -276,7 +276,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -382,7 +382,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -456,7 +456,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -491,7 +491,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -524,7 +524,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -621,7 +621,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.12 diff --git a/.github/workflows/deps-watch.yml b/.github/workflows/deps-watch.yml index cb455b5b3..e5484d1cc 100644 --- a/.github/workflows/deps-watch.yml +++ b/.github/workflows/deps-watch.yml @@ -38,7 +38,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Set up Python run: uv python install 3.13 @@ -103,7 +103,7 @@ jobs: persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Compare pins with PyPI and open or update issues env: diff --git a/.github/workflows/governance-advisory.yml b/.github/workflows/governance-advisory.yml index c6672cf61..533fb0353 100644 --- a/.github/workflows/governance-advisory.yml +++ b/.github/workflows/governance-advisory.yml @@ -25,7 +25,7 @@ jobs: fetch-depth: 0 # full history so `git diff origin/..HEAD` resolves - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Classify touched paths (advisory, never blocks) # BASE_REF arrives through `env:`, never interpolated into the script diff --git a/.github/workflows/governance-benchmark.yml b/.github/workflows/governance-benchmark.yml index a698cf4ee..938b6150c 100644 --- a/.github/workflows/governance-benchmark.yml +++ b/.github/workflows/governance-benchmark.yml @@ -24,7 +24,7 @@ jobs: fetch-depth: 0 # full history — the backtest replays every commit - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 - name: Run backtest (advisory; writes to job summary) run: uv run python scripts/dev/materiality_backtest.py >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a7f184fe..a35287c41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: fetch-depth: 0 - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 with: # This is the one workflow that publishes artefacts (PyPI + GitHub # Release), so it must not restore a cache any other workflow can diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e78f16aa3..34244397c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: Run analysis - uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0 with: results_file: results.sarif results_format: sarif diff --git a/CHANGELOG.md b/CHANGELOG.md index fc1a1fd8b..343986f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.106.0] — 2026-11-23 + +### Added + +- **The weekly usage report counts runs by the image transport that made their images.** A new field, `transports` (`direct`, `ui`, `other`), counts each run that generated an image once, by its last generation. The privacy notice moves to version 4 and names the image transport; in the EU and EEA, consent given to an earlier notice version no longer counts, and uploads stop until `gflow telemetry on` is run again. Uploads pause in every region until the new notice has been shown; the telemetry endpoint accepts the new key. +- **An experimental `direct_http` image transport ([docs/DIRECT_TRANSPORT.md](docs/DIRECT_TRANSPORT.md)).** With `GFLOW_CLI_TRANSPORT=direct_http`, an image on `flow.google.com` is generated by one direct request to Flow's `ogiZ0b` RPC; the browser only mints the reCAPTCHA token and holds the session. It serves text-to-image with `nano2`/`nano21`, every aspect, one to four images, one ref made in this run (a `gflow run` `"ref": "batch:N"`, or a local file, which is itself uploaded by one direct `maseQ` request), or one character (`--reference-entity` with its name, or an `@Name` mention), each with one image; any other request runs on the UI transport before anything is sent. A sent request is never resent: a timeout or an unexpected status stops the run with `next_action: reconcile`, and a redirect, HTTP 401 or HTTP 403 (Flow accepted nothing) falls back to the UI transport. Each generated image records `"transport": "direct_http"` in its catalog metadata. + +### Fixed + +- **`gflow video captions` centres the caption box on the text ([#1431](https://github.com/ffroliva/gflow-cli/issues/1431)).** The text was drawn from its layout origin while the box was laid out around its ink, so the box sat above the glyphs and descenders touched or crossed its bottom edge. The text is now drawn so its ink lands where the box expects it, with the same padding above and below. Thanks to @rayw-lab ([#1444](https://github.com/ffroliva/gflow-cli/pull/1444)). +- **Burned-in captions wrap text that has no spaces to break at ([#1446](https://github.com/ffroliva/gflow-cli/issues/1446)).** `gflow video captions` and `gflow_video_captions` only broke lines at spaces, so Chinese or Japanese text, or a long URL, stayed on one line and ran off the right edge of the frame. A token wider than the line is now broken between characters, and closing punctuation is kept off the start of a line. Text with spaces wraps as before. Thanks to @rayw-lab ([#1447](https://github.com/ffroliva/gflow-cli/pull/1447)). +- **`image batch` reports a failure before or during the batch instead of crashing ([#1452](https://github.com/ffroliva/gflow-cli/issues/1452)).** On an account served `flow.google.com`, `image batch` raised `FlowHostMigratedError` out of the command as a traceback with exit 1; it now prints the error and its hint and exits 36, as `docs/USAGE.md` documents. A fail-fast stop after some prompts finished (`BatchPartialError`) lists the images already saved, then the error, and exits with its code. Thanks to @rayw-lab ([#1454](https://github.com/ffroliva/gflow-cli/pull/1454)). +- **A new-project button that will not take the click on `flow.google.com` is exit 23, not a crash ([#1434](https://github.com/ffroliva/gflow-cli/issues/1434)).** Generating without `--project` creates a project first. When the projects page's button rendered but the click timed out, Playwright's timeout escaped as an unhandled error (exit 1). gflow now checks whether the create request left the page: if it did not, the run stops with exit 23 and `charged: no`, saying no create request was sent and suggesting `--project` (MCP `project`); if it did, Flow may have made the project, so gflow waits for Flow's reply or reads the new project back, and reports exit 7 (not retryable) only if neither confirms it. + +### Documentation and tests + +- **`docs/ERRORS.md` lists the confirmation-required envelope ([#1407](https://github.com/ffroliva/gflow-cli/issues/1407)).** The MCP `gflow_media_trash` tool answers a call without `confirm: true` with a `confirmation_required` envelope; the error reference now has its row. Thanks to @aryankalantri ([#1441](https://github.com/ffroliva/gflow-cli/pull/1441)). +- **The `--showlocals` redaction test ignores memory addresses ([#1429](https://github.com/ffroliva/gflow-cli/issues/1429)).** It strips hexadecimal object addresses before checking that no token fragment appears, so a random address can no longer fail it. Thanks to @aryankalantri ([#1440](https://github.com/ffroliva/gflow-cli/pull/1440)). + ## [0.105.1] — 2026-11-22 ### Fixed @@ -7368,7 +7387,8 @@ shell-script template that branches on these codes. First skeleton. Not functional end-to-end yet. -[Unreleased]: https://github.com/ffroliva/gflow-cli/compare/v0.105.1...HEAD +[Unreleased]: https://github.com/ffroliva/gflow-cli/compare/v0.106.0...HEAD +[0.106.0]: https://github.com/ffroliva/gflow-cli/compare/v0.105.1...v0.106.0 [0.105.1]: https://github.com/ffroliva/gflow-cli/compare/v0.105.0...v0.105.1 [0.105.0]: https://github.com/ffroliva/gflow-cli/compare/v0.104.0...v0.105.0 [0.104.0]: https://github.com/ffroliva/gflow-cli/compare/v0.103.1...v0.104.0 diff --git a/docker/Dockerfile b/docker/Dockerfile index 42ade8108..6b37cb358 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -45,7 +45,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Deliberately NOT pinned: google-chrome-stable. Chrome's apt repo keeps only the current # build, so a pinned version stops resolving within weeks. The trade-off is that this # layer caches indefinitely and a rebuild is what picks up a newer Chrome. -ARG GFLOW_VERSION=0.105.1 +ARG GFLOW_VERSION=0.106.0 RUN pip install --no-cache-dir "gflow-cli==${GFLOW_VERSION}" VOLUME ["/data"] diff --git a/docs/DIRECT_TRANSPORT.md b/docs/DIRECT_TRANSPORT.md new file mode 100644 index 000000000..adc802406 --- /dev/null +++ b/docs/DIRECT_TRANSPORT.md @@ -0,0 +1,91 @@ +# 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). +The environment route needs nothing else. Naming the transport in a `gflow run` config, or +with `--transport direct_http` on an image command, also needs +`GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1`, as for every experimental transport; without it the +config is refused with exit 11 and the option does not list the value. +`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 resent on the direct transport: only a redirect, HTTP 401 or HTTP 403, which Flow refused without making anything, is submitted again, once, through `ui_automation`. 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). diff --git a/docs/ERRORS.md b/docs/ERRORS.md index b8784db48..d563fce12 100644 --- a/docs/ERRORS.md +++ b/docs/ERRORS.md @@ -238,6 +238,7 @@ members. They have no exit code of their own. |---|---|---|---|---| | `https://gflow-cli.dev/errors/unknown` | MCP and worker, an unclassified failure (the message is never shared; the worker's `detail` is its SHA-256 and `class` names the exception class; after the submit the worker stores the job `indeterminate` and sets `next_action: reconcile`) | — | `maybe` | `none` | | `https://gflow-cli.dev/errors/bad-parameter` | MCP, a tool argument it refuses | — | `no` | `fix_input` | +| `https://gflow-cli.dev/errors/confirmation-required` | MCP `gflow_media_trash` without `confirm=true`; CLI `gflow media trash` without `--yes` in non-interactive `--json` mode (exits 2, and its envelope omits `next_action`) | — | `no` | `fix_input` | | `https://gflow-cli.dev/errors/no-profile` | MCP, no profile, or its directory is missing | — | `no` | `reauth` | | `https://gflow-cli.dev/errors/no-default-profile` | MCP, several profiles and no default | — | `no` | `fix_input` | | `https://gflow-cli.dev/errors/profile-marker-missing` | MCP `gflow_auth_status` | — | `no` | `reauth` | diff --git a/docs/INDEX.md b/docs/INDEX.md index 670c980fe..e55bc385c 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -42,6 +42,7 @@ Welcome to the `gflow-cli` documentation. This index is the routing layer: it te | **[docs/DATA_LAYER.md](DATA_LAYER.md)** | Local SQLite catalog: goals, schema, recording flow, redaction, `gflow data` CLI, migrations, extension guide | Anything touching `gflow_cli.data`, debugging missing rows, building I2V/repair tooling, auditing what is stored | | **[docs/TELEMETRY.md](TELEMETRY.md)** | Usage data and privacy notice: local counters, the weekly report and exactly what it contains, EU/EEA consent, kill switches, `gflow telemetry on\|off\|status\|show` | Auditing what is counted and sent, turning uploads off or on, or giving EU/EEA consent | | **[docs/CHARACTER.md](CHARACTER.md)** | Characters feature spec & system design: domain model, endpoint/cost matrix, sequence diagrams, JSON payloads (I/O), CLI surface, reuse via `referenceEntities` (#145) | Working on `gflow character`, reusing a character in generations, or understanding Flow's character wire protocol | +| **[docs/DIRECT_TRANSPORT.md](DIRECT_TRANSPORT.md)** | The experimental `direct_http` image transport: one direct `ogiZ0b` request instead of the composer page, which requests it serves, its fallback and no-resend rules, what it records, measured speed | Turning it on with `GFLOW_CLI_TRANSPORT=direct_http`, or finding out why a request went to the UI transport | | **[docs/REFERENCE_STRATEGIES.md](REFERENCE_STRATEGIES.md)** | How to reference an asset: `@Name` mention vs `--reference-entity` vs `--ref` — the two-axis model (identity vs image), same-wire+dedupe rule, per-path support matrix, image-less-entity prerequisite, agent rule | Deciding how to tag a saved character/asset in a prompt, or wiring `@`-mentions into a generation | | **[docs/MEDIA_LIBRARY.md](MEDIA_LIBRARY.md)** | Flow's media library as a component: asset-kind taxonomy (`media[]`/`workflows[]`/preset voices), UUID-vs-displayName identity rules (AI caption ≤~35 chars, mutable, async, non-unique), the `projectInitialData` listing endpoint (complete, direct-GET-able), picker UI facts (virtualized grid, per-picker project, no a11y tree, single-click attach) + full pitfall table | Touching any picker/listing/reference code, or debugging why an asset "isn't found" | | **[docs/MOVIE.md](MOVIE.md)** | `gflow movie` — multi-scene character-consistent films: manifest format, run lifecycle (browser stays open through generate→poll→download), entity-attach mechanism (Personagens right-click), resume/handoff, credits | Working on `gflow movie`, debugging scene generation, or understanding the character-entity attach + consistency model | @@ -177,7 +178,7 @@ Slash commands for Claude Code, stored in `.claude/commands/gflow/`. All prefixe **"A command failed — where is the incident bundle and what's in it?"** → [DEBUGGING § Automatic incident bundles](DEBUGGING.md#automatic-incident-bundles) (layout, triggers, review-before-sharing); privacy boundaries: [SECURITY § Automatic incident bundles](SECURITY.md#automatic-incident-bundles-gflow_cli_incident_capture-default-on); disable via [CONFIGURATION § GFLOW_CLI_INCIDENT_CAPTURE](CONFIGURATION.md#gflow_cli_incident_capture) **"Flow's UI broke a selector — how do I diagnose it?"** → [DEBUGGING § Inspecting Flow's live UI](DEBUGGING.md#inspecting-flows-live-ui) **"What does each `ui_automation.*` log event mean?"** → [DEBUGGING § Listener & HTTP-layer debugging](DEBUGGING.md#listener--http-layer-debugging) -**What was actually live-verified for the latest release?** → latest: [LIVE_VERIFICATION_v0.105.1](LIVE_VERIFICATION_v0.105.1.md) (**2026-11-22, 1 Omni 1.2 generation (4 credits).** Plain t2v on the release tree at 360p, 4 s, x1, after a `--max-credits 0` probe refused a 4-credit quote with exit 45; catalog migration 0011 applied to a copy of an existing v0.105.0 catalog, the `gflow data` readers on it, and superseded copies hidden from them; the credit-free e2e credit-cap refusals (#1408) passed; the #1299 extend write path recorded as not run live (every extend is billed), and #1111, #1159 and #1416 as not verifiable on demand, with reasons.) Previous: [LIVE_VERIFICATION_v0.105.0](LIVE_VERIFICATION_v0.105.0.md) (**2026-11-22, 1 Omni 1.2 generation (4 credits).** Plain t2v on the release tree at 360p, 4 s, x1, after a `--max-credits 0` probe refused a 4-credit quote with exit 45; `character create --image` / `--body-image` on CLI and the MCP twin through the credit-free e2e on a test account; no-replace publishing (#1406) through `audio narrate` and `video assemble` on NTFS; the no-hard-link fallback, #1336's labs arm and #1382 (test-only) recorded as not verifiable, with reasons.) Previous: [LIVE_VERIFICATION_v0.104.0](LIVE_VERIFICATION_v0.104.0.md) (**2026-11-22, 1 veo-lite generation (10 credits).** Plain t2v on the release tree; `--max-credits 0` refused before submit with exit 45 at a 10-credit quote, balance unchanged; `media trash` and `restore` round-tripped the fresh clip at 0 credits; `audio narrate` (Edge), `video captions` and `video assemble` on that clip, locally; transcription, the #1387 agent-only driver and #1400's macOS path recorded as not verified, with reasons.) Previous: [LIVE_VERIFICATION_v0.103.1](LIVE_VERIFICATION_v0.103.1.md) (**2026-11-20, 1 veo-lite generation.** Agent panel and Agent switch recovery on Flow's 2026-11-20 build (#1384, #1374): the gate, the CLI video door and the MCP queued door all reach the classic composer from an open panel, 5/5 e2e on the release tree with the panel proven open first; the #749 A/B control on the moved `AgentModeMixin`; #1369 closed as stale on a $0 spike; plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.103.0](LIVE_VERIFICATION_v0.103.0.md) (**2026-11-19, 14 video generations (Omni 1.1, Omni 1.2, veo-lite).** Model retirement (#1375): `model.retiring` on CLI stderr and the MCP `warnings` field live on the merged head, `retires_on` in the catalog, a leaving model not refused on the date (exit 37 on a credit-limited account, $0), e2e moved off the leaving models, plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.102.1](LIVE_VERIFICATION_v0.102.1.md) (**2026-11-19, 16 video generations (veo-lite and the agent default).** Agent-only video named from the project listing when the page shows only `/asb/` media (#1354): unmodified CLI t2v on an agent-only page logged `video_named_by_listing`; agent-only BDD e2e CLI + MCP t2v 6/6 on the merged tree; 14 of 15 video runs across the fix's trees; plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.102.0](LIVE_VERIFICATION_v0.102.0.md) (**2026-11-18, paid extends, video exports and one veo-lite generation.** Reliability wave: charged-no before submit, indeterminate after it, re-extend, typed exits 32/35/22, extras-preserving update, engine and host telemetry.) Previous: [LIVE_VERIFICATION_v0.101.2](LIVE_VERIFICATION_v0.101.2.md) (**2026-11-17, one veo-lite generation.** patchright close hang fixed (#1324): the disabled-feature parse reads patchright 1.64's exclusion filter and each launch site names its engine; live t2i + auth renew + MCP queued job on patchright with no close error, plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.101.1](LIVE_VERIFICATION_v0.101.1.md) (**2026-11-17, two veo-lite generations.** patchright extra 1.61.2 -> 1.64.4 so `.last` locators resolve (#1319): engine contract RED on 1.61.2 / GREEN on 1.64.4, live t2i + i2v + MCP queued job on patchright, plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.101.0](LIVE_VERIFICATION_v0.101.0.md) (**2026-11-16, 0 Veo credits.** Universal -o/--output [json|table|id] format selector, --out-file PATH strictly enforced for file targets, MCP output removed, #1158; 44 format/remediation tests + 5 BDD scenarios green; --out-file verified at .) Previous: [LIVE_VERIFICATION_v0.100.1](LIVE_VERIFICATION_v0.100.1.md) (**2026-11-16, 0 Veo credits.** Locale-invariant count selector for settings pane on flow.google.com under German locale (`?hl=de`, #1312, #1315); 221 unit tests green; settings pane verified at $0.) Previous: [LIVE_VERIFICATION_v0.100.0](LIVE_VERIFICATION_v0.100.0.md) (**2026-11-15, 4 Veo lite clips.** t2v on the release tree to a file; `image generate` resolves t2i and i2i, `video generate` a t2v; `gflow cancel` and `--help --json` offline (no Flow surface); `e2e_update` 4/4 on real pip/uv venvs incl. a held launcher; character list/show MCP 3/3 on flow.google.com; a new `--resume-from` chain e2e; extend 3/3 at $0.) Previous: [LIVE_VERIFICATION_v0.99.0](LIVE_VERIFICATION_v0.99.0.md) (**2026-11-14, 1 Veo lite clip.** t2v on the release tree written with `--out-file`; `--out-file` / `-o` e2e 3/3 incl. the cloud-storage refusal; MCP `out_file` e2e 1/1; exit codes unchanged by default with `exit_code_legacy`.) Previous: [LIVE_VERIFICATION_v0.98.0](LIVE_VERIFICATION_v0.98.0.md) (**2026-11-12, 1 Veo lite clip.** t2v on the release tree; `gflow capabilities` and its MCP twin (e2e 3/3); `gflow models list/show`; an error envelope with `charged`/`next_action`; image e2e 4/4 and the duration e2e for the sent-once and selector fixes.) Previous: [LIVE_VERIFICATION_v0.97.0](LIVE_VERIFICATION_v0.97.0.md) (**2026-11-10, 1 Veo lite clip.** Credits read without a browser, p50 2.72 s over 5 runs, 0 Chrome launched; browser read 10.7 s; doctor `auth.wire_read` accepted; credits/wire/auth-status e2e 10/10 on CLI and MCP; extend e2e 3/3; t2v.) Previous: [LIVE_VERIFICATION_v0.96.1](LIVE_VERIFICATION_v0.96.1.md) (**2026-11-08, 1 Omni 1.2 + 1 lite clip.** Omni 1.2 start+end lands with matching first/last frames; route guard e2e 4/4 on CLI and MCP; t2v.) Previous: [LIVE_VERIFICATION_v0.96.0](LIVE_VERIFICATION_v0.96.0.md) (**2026-11-07, 1 Veo lite clip on the release tree.** t2v; Omni 1.2 durations 3–15 and its MCP twin; Omni r2v 4/6/10s; agent-only reload on CLI and MCP; paid Omni clips on the PR #1174 head.) Previous: [LIVE_VERIFICATION_v0.95.0](LIVE_VERIFICATION_v0.95.0.md) (**2026-11-07, 1 Veo lite clip.** t2v on the release tree; weekly upload e2e against the live endpoint 8/8 incl. EU consent and 410; local telemetry e2e 6/6; production D1 left at 0 rows; byte-exact `mcp setup` backup.) Previous: [LIVE_VERIFICATION_v0.94.0](LIVE_VERIFICATION_v0.94.0.md) (**2026-11-07, 1 Veo lite clip.** t2v on the release tree, local usage counters and telemetry e2e, CLI and MCP usage stats.) Previous: [LIVE_VERIFICATION_v0.93.0](LIVE_VERIFICATION_v0.93.0.md) (**2026-11-05, 82 Veo credits over the session.** Video delivery after #1153, lost t2v reply on CLI and MCP, revoked session.) Previous: [LIVE_VERIFICATION_v0.92.1](LIVE_VERIFICATION_v0.92.1.md) (**2026-10-30, $0.** MCP schema, #1121.). Previous: [LIVE_VERIFICATION_v0.92.0](LIVE_VERIFICATION_v0.92.0.md) (**2026-10-29, no Veo credits.** GHSA-hqfj-4jww-76f2: MCP `output` / `out_dir` / `profile` escapes refused live on the release head, an inside `output` lands; MCP upscale e2e and the #1035 BDD re-run 3/3. #1114 measured on real mounts, Linux and Windows) · previous: [LIVE_VERIFICATION_v0.91.0](LIVE_VERIFICATION_v0.91.0.md) (**2026-10-26/28.** Release-tree e2e 7/7: #1097 MCP `wait=false` runs and #1102 SEP-2663 `tasks/get` over stdio; selector drift; auth verification. Paid on their PRs: #723 r2v with a character 3/3, #1112 lost video submit reply 2/2. #988 blocked: no profile here is served the agent-only composer) · previous: [LIVE_VERIFICATION_v0.90.0](LIVE_VERIFICATION_v0.90.0.md) (**2026-10-25, no Veo credits in the release run.** Release-tree e2e 15/15: #772 a local `--ref` uploaded once per project (CLI, MCP, and a recorded image the project no longer holds); #1091 unwritable output exit 11; #934 `run --resume`; #745 credit shortfall; #1083 selector drift; the two re-armed canary tests; #796 and #481 verified at $0 on their PRs; #941 on its PR with one veo-lite clip) · previous: [LIVE_VERIFICATION_v0.89.1](LIVE_VERIFICATION_v0.89.1.md) (**2026-10-24, no Veo credits.** Release-tree e2e 9 passed, 1 skipped (credit-spending video case): lost image replies recovered from the grid on t2i and i2i (#1075), upscale straight after generating with no pause (#1067), visible model picker, auth and pre-submit regressions; hidden-picker, `/about` and declined-upload paths offline, blockers named) · previous: [LIVE_VERIFICATION_v0.89.0](LIVE_VERIFICATION_v0.89.0.md) (**2026-10-23, no Veo credits.** Release-tree e2e 20/20 (one re-run after #1010's lost reply body): #1039 default project CLI+MCP; #974/#1053 a missing project is exit 11 on generation, upscale and extend; #1038 nano2.1; #914 warm-client upscale; #892 pre-submit gate; #927 window position; #984/#1059 held profile exit 11 on the PR branches) · previous: [LIVE_VERIFICATION_v0.88.0](LIVE_VERIFICATION_v0.88.0.md) (**2026-10-22, no Veo credits.** #1036 browser proxy through a local proxy; #1037 slow-link create; #992 lost-reply readback; #1035 failed image download keeps the ids; #1041 quiet output; #1026 internal login) · previous: [LIVE_VERIFICATION_v0.87.1](LIVE_VERIFICATION_v0.87.1.md) (**2026-10-22, $0 apart from one Veo lite clip for the #795 spike.** #795: `gflow credits` balance equals Flow's account menu on two accounts, CLI and MCP; #1027: 2K image upscale and both video exports pass with the shared blob capture; project create/rename re-run for the shared `_rpc_reply`) · older: [LIVE_VERIFICATION_v0.87.0](LIVE_VERIFICATION_v0.87.0.md) (**2026-10-22, Veo lite clips under the e2e grant.** #1023: auth status/renew/MCP twin verify again after labs' session URL went 410; #1010: a lost submit reply makes one submit and a non-retryable exit 9, image and video; #1013, #995, #997, #986, #1014 e2e passed on the release tree; image-upscale body loss filed as #1027) · older: [LIVE_VERIFICATION_v0.86.0](LIVE_VERIFICATION_v0.86.0.md) (**2026-10-17/18, 2 Veo extends (owner-approved).** #991: `video extend` on flow.google.com — paid single-segment extend passed on the release tree, plus 3 $0 route-guard e2e; #989: agent-only composer — classic-composer regression 11 passed, agent-only path blocked externally (no account in that cohort; run live by 3 outside users); #982: `auth renew` 4 passed incl. stale→readable and /about) · previous: [LIVE_VERIFICATION_v0.85.0](LIVE_VERIFICATION_v0.85.0.md) (**2026-10-14, 0 credits.** #723/#979: `@Character` on flow.google.com images — 4-scenario e2e (CLI t2i, MCP, i2i + character, id-only refusal) passed on the release tree; #975: multi-prompt `t2i --project-name` — e2e passed) · previous: [LIVE_VERIFICATION_v0.84.0](LIVE_VERIFICATION_v0.84.0.md) (**2026-10-12, 0 credits.** #970: `gflow run --project` generates every row into an existing project — e2e passed on our account and the contributor's; #971: multi-prompt `t2i --project` — new e2e passed; no MCP twin for either) · previous: [LIVE_VERIFICATION_v0.83.2](LIVE_VERIFICATION_v0.83.2.md) (**2026-10-11, 0 credits.** #963: `--duration` binds in a Vietnamese pane — locale e2e failed on develop and passed after the fix, and a notice-only cookie bar is now acknowledged; #957: image upscale e2e passed on the CLI and over MCP; #962: `auth status` probe uses the profile's channel, unverified on a host without Chrome) · previous: [LIVE_VERIFICATION_v0.83.1](LIVE_VERIFICATION_v0.83.1.md) (**2026-10-08, 0 credits.** #958: the default image model `nano2` runs Nano Banana 2.1 on flow.google.com — e2e failed on develop and passed after the fix; CLI and MCP twins each wrote a JPEG; 2.1 measured as replacing 2 on two accounts) · previous: [LIVE_VERIFICATION_v0.83.0](LIVE_VERIFICATION_v0.83.0.md) (**2026-10-06/07.** #948: a billed flow.google.com video run no longer exits 7 — t2v, i2v and r2v e2e passed after the fix, reproduced before it; `data download` e2e 2 passed after a 302 regression was caught and fixed; #922: image and video upscale e2e passed, CLI and MCP image twins wrote the same JPEG, MCP video wrote 1920x1080, a 1080p export measured 0 credits) · previous: [LIVE_VERIFICATION_v0.82.1](LIVE_VERIFICATION_v0.82.1.md) (**2026-10-02.** A reCAPTCHA mint failure typed with a live-measured retry flag (#915, e2e 2 passed, $0); a busy catalog no longer fails a successful generation (#900, real SQLite, no Flow surface); a video's workflow id recorded (#898, 1 veo-lite clip)) · previous: [LIVE_VERIFICATION_v0.82.0](LIVE_VERIFICATION_v0.82.0.md) (**2026-10-01.** `"ref": "batch:N"` and local-file refs on `gflow run` verified by a BDD e2e on flow.google.com: in place, no re-upload, lineage recorded; 1 veo-lite clip for the #926 e2e) · previous: [LIVE_VERIFICATION_v0.81.0](LIVE_VERIFICATION_v0.81.0.md) (**2026-09-30, 3 veo-lite clips.** The off-screen generation browser (#923) measured unchanged for image and video, window placement read back from Chrome, focus-steal measured and documented; #919 verified at merge) · previous: [LIVE_VERIFICATION_v0.80.0](LIVE_VERIFICATION_v0.80.0.md) (**2026-09-29, 0 Veo credits.** `--resolution` 360p/720p proven by driving the real settings pane on `omni_flash` and refusing the credit-spending submit, on the CLI transport **and** the MCP twin; `nano2-lite` e2e 2 passed; #891 measured before/after — `gflow run` `[nano2, imagen4]` went from exit 1 `RecaptchaError` with a lost results table to exit 36 naming the model, plus 3 e2e (fresh, warm, MCP) with a spy asserting zero client mints; #896 `e2e_data` 2 passed, its failure path offline-only. Named blockers: rendered resolution (needs a billed clip), the `/about` re-check arm, labs-served accounts.) · previous: [LIVE_VERIFICATION_v0.79.1](LIVE_VERIFICATION_v0.79.1.md) (**the signed-media download survives a dropped connection, verified 2026-09-22 at $0.** All three download sites route through one new shared helper, and that helper was driven through a real Flow clip route and a real signed CDN transfer by `pytest -m e2e_data` — 2 passed in 20.74 s, `ftyp` magic, byte length equal to the size Flow reports, and **no `url=` on any log event**. The retry itself could not wait for an organic reset — 20/20 clean here against the reporter's 2-in-6 — so it was **measured against a real TCP RST with an A/B control**: with `max_retries` the transfer recovers on a second connection, with it disabled the identical fault kills the call, and three attempts at a 5 s timeout finish in 1.57 s rather than ~15 s, proving the backoff shares one budget. **Two sites are NOT live-verified and name their blockers:** the composer call site needs a billed generation and `gflow credits` answers 401 on this account (#795), so no credits were spent; and the labs download cannot be reached at all from here (HTTP 308, 6/6 profiles). Offline: 21 new tests, full sweep 2143 passed.) · earlier: [LIVE_VERIFICATION_v0.79.0](LIVE_VERIFICATION_v0.79.0.md) (**the migrated host stops echoing a model it never observed, verified 2026-09-18 at $0.** `model_name_type` is `null` on `flow.google.com` in a real `image t2i --json`, with every sibling field populated — which is what makes the null a result rather than an empty envelope; the first read of it was flat rather than into `images[]` and returned `None` for everything, and that instrument error was discarded rather than reported. Both surfaces ran: `test_e2e_t2i_runs_on_a_moved_account` and `test_e2e_mcp_i2i_runs_on_the_migrated_host`, 2 passed in 86 s. **`gflow data download` was tested on an image and failed** — 45 s, then a message blaming the project, the trash and your prompt; recovery is video-only and the release notes now say so (#877). **#803 is NOT live-verified and names its blocker:** reaching those raise sites needs a non-JSON or token-less aisandbox reply, and the labs route refuses first with a 404 — itself a misleading error, filed as #875. Offline: 4 new unit tests, 1775 passed.) · previous: [LIVE_VERIFICATION_v0.78.0](LIVE_VERIFICATION_v0.78.0.md) (**generating with no project on `flow.google.com` — and video from a start frame — verified 2026-09-17.** The release exists because labs.google's `project.createProject` is retired — 404 *"Flow RPCs have been deprecated and disabled"* with a labs token, 401 without, 0 successes in 12 across four profiles — and gflow reported the 401 as an expired login. Creation and rename are driven on flow.google.com and read back from Flow's own `jHPbke` / `o8DA4` replies; the CLI and the MCP twin are each exercised separately, and both video paths reach a real submit that is aborted before Flow can bill it. Two failures are recorded and re-tested rather than explained away — one MCP image reply that did not reproduce under a four-run A/B, and a Chrome launch starved by a concurrent coverage run that passed in 36 s alone. The 3:4 image aspect is re-measured on the live radiogroup, five radios where 2026-09-08 saw four. Three items are NOT verified and each names its blocker: no labs-served account, no entitled `/about` account, no non-`en` locale. **#860 is the one thing here that cost credits, deliberately:** the only proof that a start frame binds is a real generation, so ten i2v clips were generated and downloaded on a live migrated account — `migrated.frame_uploaded` → `frame_bound` → `submit_observed` → `download`, the middle event being the one that could not fire before this release. **#859 is recorded as UNOBSERVED, not verified** — its dismissal ran on every one of those runs and no promo modal ever appeared, so the $0 route-intercepted e2e is what covers it. `gflow docs` (#861) is verified from the built wheel, which is its whole contract: 127 topics, `docs/FILE.md:LINE` search hits, no network and no checkout.) · previous: [LIVE_VERIFICATION_v0.77.1](LIVE_VERIFICATION_v0.77.1.md) (**a four-fix patch release, verified 2026-09-17 at ZERO cost.** The headline is #846: the published package could not run a single interactive command on a clean Windows install, because `ConsoleRenderer(colors=True)` needs `colorama` and nothing declared it. Verified as a controlled A/B on a fresh Python 3.13 venv — `SystemError` before, exit 33 after — plus an arm with stderr piped that shows why the AUTO/JSON split hid this from every CI job, and the MCP twin run separately. #848's import probe is exercised against a **deliberately broken venv** and an intact one, including the contract that a probe which cannot run reports nothing rather than reporting breakage. #852 is re-measured on the release head: 40 000 base64-shaped chars fall from 12.07 s to 0.020 ms with identical output on Workspace and custom domains. **#849 is a NAMED BLOCKER, not an omission** — its end-to-end behaviour needs a fresh interactive Google sign-in, which no agent can perform; its live A/B is recorded on PR #851 and its e2e file re-ran 4/4 here. **Seven live e2e failures are recorded rather than hidden**, and controlled: the release changes exactly four source files and none of them is a failing test's module.) · previous: [LIVE_VERIFICATION_v0.77.0](LIVE_VERIFICATION_v0.77.0.md) (**the migrated-host login lockout (#791), verified as a controlled A/B on a real Google **Workspace** account at ZERO cost — same profile, same cookies untouched between arms, so the only variable is the code: exit 8 with the Chrome marker rolled back and `channel_for_profile` collapsed to `None`, then exit 0 with the marker intact and the account recorded. The refusal path is measured too — of 10 local profiles, 5 reproduce #791 and exactly one carries both required cookies: 4 refusals, 1 upgrade, 0 false positives. v0.76.0 recorded this fix as **withdrawn**; the approach that shipped is a different one, server-attested on the landing URL rather than on client-rendered DOM. An earlier revision gated auth on an `@gmail.com`-only pattern that silently declined every custom domain — the account used here is one, which is why this is its verification. **#796 is reproduced and prevented**, not merely reported: it was filed as *'not yet reproduced end-to-end'*. **Two rows are named blockers, not omissions:** the MCP Registry publish (#841) cannot be rehearsed before a real tag push, so this release is its first exercise; and the migrated-host generation e2e cannot run here at all — every account bounces to `/about`, A/B-controlled against `develop` so it is not mistaken for a regression.) · previous: [LIVE_VERIFICATION_v0.76.0](LIVE_VERIFICATION_v0.76.0.md) (**a diagnostics-and-distribution release, verified 2026-09-16 at ZERO cost — no Veo credits, no image generation, no Flow submit.** The decisive arm is #833's **negative** control, run first-hand on two real accounts rather than relayed: `flow-pinhole-unavailable-screen` is **0** on both `ffroliva` and `denon82` while `aisandbox-root` is **1**, so the guard does not fire on accounts that HAVE Flow access and the zero is a real absence rather than a page that never booted — a guard with only a positive arm is indistinguishable from one that is permanently on. Both accounts settled at **`/about`**, which is the state that broke this release's *withdrawn* #791 oracle, and the exit-39 signal reads a component that only exists on the unavailable screen, so `/about` cannot mimic it. mcpservers.org is verified with a **404 negative control** because the listing 403s to `curl` and a naive check would have called the link dead. **#791 is NOT in this release and was withdrawn rather than deferred**: a fix passed eight council dimensions and was then refuted by a five-day-old spike nobody had routed to it — Flow's `/about` hop is decided client-side with zero requests to Flow, and *"the backend grants access while the frontend declines to open it"* (#756), so the probe would have reported authenticated users as logged out, reintroducing #791 as its own cure; the e2e caught it by going red on a live account whose state moved mid-session. **Two rows are blocked by the platform rather than by effort:** the Docker sign-in needs a WSL-integrated Docker host, and the MCP Registry publish cannot be observed until this very tag reaches `main`, since both triggers resolve the workflow from the default branch.) · previous: [LIVE_VERIFICATION_v0.75.0](LIVE_VERIFICATION_v0.75.0.md) (**a distribution-and-hardening release, verified 2026-09-15 on `ffroliva` at ZERO cost — no Veo credits, no image generation, no Flow submit.** The `gflow serve` token fix is an **A/B against the released 0.74.0 wheel from PyPI**, not a diff read: the token was *set* in both arms, so the probe measures whether it is checked — before, `no token 200/200` with 13 tools listed and `wrong 200/200`; after, `401/401` with zero tools and `WWW-Authenticate: Bearer realm="gflow"`, while the correct token still gets 200. Loopback DNS-rebinding was re-confirmed at **421**/**403** because the fix forwards the bind host and getting that wrong would silently disable protection that works today — and an earlier draft of the accompanying advisory claimed that protection was *disabled*, a false claim caught by measuring rather than re-reading. #813's guard is verified against a **real wheel in a real venv installed without extras**, the arm first proving it is in that state (`av present: False PIL present: False`); the decisive row is that a **nonexistent** manifest still exits **20** on the dependency error rather than file-not-found, which is what shows the guard precedes the manifest read and not merely the generation. The Rich escape fix is verified on the **console render separated from the structlog JSON** — matching the JSON line would have been a false pass, since `--json` was never affected — with a **neutered control** through the same Rich version reproducing the bug exactly: `UNESCAPED -> pip install 'gflow-cli'` against `ESCAPED -> pip install 'gflow-cli[chain]'`. Also: `gflow-cli.exe` exists in the built wheel so `uvx gflow-cli` resolves at all, and the wheel carries 138 entries with **zero** ZIP duplicates. **Three items recorded as NOT verified rather than omitted:** a successful multi-link `chain` run spends Veo credits and stays outstanding e2e debt on #813 — what changed is the refusal path, which *is* verified; `gflow credits` against a working balance is impossible here because the account still returns 401, pre-existing **#795** and unrelated to this release; and the SSE arm of the token fix was exercised on loopback only, a deliberate scope limit, since binding a LAN address to test it would put an authenticated daemon on a live network for the run. **Two rows are blocked by the platform rather than by effort:** the PyPI metadata and the MCP Registry listing are both unobservable until this release is uploaded — PyPI renders the last artefact's metadata, and `mcp-publisher` reads its ownership token out of the *published* README.) · previous: [LIVE_VERIFICATION_v0.74.0](LIVE_VERIFICATION_v0.74.0.md) (**the migrated driver's run-unique uploads and its Frames-picker confirm, plus the `credits` remediation, verified 2026-09-14 on `ffroliva` at ZERO cost — every arm is a read or an upload-and-stop.** The confirm branch is the interesting one: this cohort's picker closes on its own, so the branch would never execute against live Flow by accident, and the e2e drives `FRAME_COMMIT_GRACE_S` to **0.001** so the grace expires before Flow can auto-close and **every** run enters it — the difference between a named blocker and an unrun claim. A *genuinely stuck* picker still cannot be produced here and stays `Refs #792`, verifier the reporter. #795 was verified on the cohort it is for, because this account is now in it — `auth status` green, `credits user` exit **3** with `detail` `credits endpoint returned 401` and `route: credits`, where v0.73.2 printed the class-default *"SAPISID cookie missing… re-run `gflow auth login`"*, advice that is wrong in every word there and that can roll a profile's strategy marker back and start the #791 spiral; the `credits list --json` envelope carries the per-profile `remediation_hint` that used to be dropped. **Two items recorded as NOT verified rather than omitted:** #799's exit-25 raise site needs an account in the agent-only cohort — the maintainer's accounts are served `flow.google.com` but still have the recoverable agent chip, so the state is structurally unreachable on them, a named blocker and #799 stays open; and neither `r2v` nor `i2i` had its own attach path driven to completion — `r2v` was not attempted (its e2e spends Veo credits), while `i2i` **was** attempted twice and failed both times at exit 23, before reaching the code under test, because the `--project` UUID came from `gflow project list` (the aisandbox catalog) and those ids 404 on `flow.google.com` — a harness error, recorded rather than dropped, which left a side finding: gflow reports Flow's own `/404?reason=project` as `UiSelectorDriftError`, blaming our selectors for Flow's 404. **#791 is not fixed and was not attempted blind** — all nine local profiles were probed at $0 and none is in the #791 state (SAPISID + a live `flow.google.com` session + no labs NextAuth token); four print its exact symptom string and none of them is it, because that string is also what a stale profile says.) · previous: [LIVE_VERIFICATION_v0.73.2](LIVE_VERIFICATION_v0.73.2.md) (**the blank incident bundle, reproduced and then cured by a committed e2e test, 2026-09-12 on `ffroliva` at ZERO cost — every arm fails before submit.** The decisive layer is an **A/B run through the same instrument**, not an inspection: on `develop` the new test FAILS in 46.3 s and prints the bundle it got — `tag_counts.div = 0`, `title.length = 0`, `host_category = "other"`, a 4,254-byte screenshot — which is field-for-field the signature [#792](https://github.com/ffroliva/gflow-cli/issues/792) reported from a different account, a different OS and a different command; on the fix it PASSES in 37.8 s with `div` **25**, `title.length` **81**, `host_category` **`flow_app`**, `route` `/404` and a 38.4 KB screenshot. Both arms exit **23** on the same `.settings-trigger-button` drift at `flow.google.com/404?reason=project`, so the arms differ only in what was *captured*, never in what failed. **The reporter's own bundle contained the refutation of their diagnosis**: viewport 1280x720 is `client.py`'s client-owned page, not the 1920x1080 a stray transport tab would have — it was always the driven page, photographed one navigation too late, and the portrait correlation had no mechanism behind it. The existing quality benchmark could not have caught this: it captures deliberately on a **healthy** page, so it graded only bundles that were never at risk. **Recorded as NOT verified rather than omitted:** #796's `PROFILE_MARKER_MISSING` is offline-only because its live trigger is a cookie-store **decryption** failure, which does not occur on Windows/DPAPI — it is the macOS Keychain path of [#768](https://github.com/ffroliva/gflow-cli/issues/768), a **named external blocker**, and the issue stays open; a synthetic attempt to force it failed informatively, since a corrupt store raises `sqlite3.DatabaseError`, bypasses the marker gate and still prints "check network connectivity" — the same misdirection from a different trigger, untouched here. #795's remediation string is unit-asserted only, and the *other* half of #795 — `credits` being labs-only on migrated accounts — is **not fixed**.) · previous: [LIVE_VERIFICATION_v0.73.1](LIVE_VERIFICATION_v0.73.1.md) (**Google's `glue` consent bar covering the migrated composer, measured and then cured, 2026-09-11 on `ci-probe` for one image generation and no Veo credits.** The premise was nearly rejected: both prior sightings of that selector in this repo are labs.google, and the 2026-09-10 spike had read 159 DOM samples on this exact host and project and watched the click land 3/3 — it simply never looked for a cookie bar. Seventeen hours later the bar was up: `position: fixed`, `z-index: 1000`, spanning y 547-655 of a 655 px viewport, with `elementFromPoint` over the settings trigger AND over the image submit both returning `span#glue-cookie-notification-bar-1-label` in **0 of 5** rendered samples hit-testable. **The control arm is what makes it a cure rather than a coincidence**: the same probe re-run through the driver's own `_dismiss_cookie_bar` restored both controls to **4/4**, one attempt, no error. A full `gflow image t2i` then ran end to end on the merged code — `status: ok`, a 807,761-byte `ffd8ffe0` JPEG that Pillow reads as 1376x768 RGB, matching the requested 16:9 and the reply's own dimensions, with `migrated.editor_ready` at 2.0 s and **no** `cookie_bar_not_dismissed`. A side finding the control arm produced by accident: the bar's buttons are `__accept` then `__reject` in DOM order, so anything taking "the first button" accepts cookies for the operator — the shipped fix anchors on reject. **Three items recorded as NOT verified rather than omitted:** the cure against a live bar outside the browser, because this release's own control arm consumed the consent on the only profile that had it; **prevalence**, because the second profile never reached an editor (both arms redirected to `/about`) so it is one account blocked and one already-consented, and KNOWN_ISSUES says so rather than generalising from n=1; and the video path live, which shares the identical function on the identical control but spends Veo credits.) · previous: [LIVE_VERIFICATION_v0.73.0](LIVE_VERIFICATION_v0.73.0.md) (**four error paths that stopped lying about what went wrong, verified 2026-09-10 on `ci-probe` and `denon82` at $0 — no run below reaches a Veo submit.** The decisive arm is an **A/B**, not an inspection: the pre-fix run printed an `accounts.google.com` challenge URL together with the OAuth `state` and `client_id`, and the identical command after the fix gave the same exit 38 and the same landing named with **five secret matches down to zero** — reading the post-fix output alone would only have shown that *these* secrets were absent. A second arm **falsified a claim already written into PR #775's body**: it said the change fixed the RED canary, and the live run showed `denon82` had moved to `accounts.google.com` mid-run, a landing the classifier excluded **by design**, with a unit test encoding the wrong reason — the offline suite was green throughout and could not have caught it. #776's happy path is verified by a real `gflow image t2i` (exit 0, 367 135-byte JPEG, `image_settings_applied` and `prompt_typed` both present, so **three of the four converted click sites** clicked successfully through the new helper); its **failure** path is real Chromium driving a page we wrote, which proves the mechanism and explicitly **not** that Flow still produces that state. **Three items recorded as NOT verified rather than omitted:** the `/about` redirect stopped reproducing (**0/5**, reported as *unmeasured* rather than argued into a retry flag), the `/fx/api/auth/*` landing moved before the run reached it, and #764's *success* path — an external contribution whose error boundary this release verifies but whose auto-selection needs an account currently behind a Google password challenge. The fourth converted click site is the **video** submit, unrun because it spends Veo credits, named rather than implied.) · previous: [LIVE_VERIFICATION_v0.72.0](LIVE_VERIFICATION_v0.72.0.md) (**auto-closing `gflow auth login`, verified 2026-09-09 on a migrated account at $0 across six runs.** Four paths: auto-close fires (`probe=in_context` at `elapsed_s` **84.8**, reproduced 3x), a manual close still verifies from disk (exit 0, never exit 12), `--browser auto` selects and completes, and a window closed **mid-2FA** is noticed in **2 s** (exit 8) where it previously ran the full 600 s deadline with the session endpoint touched **zero** times. **Two runs were discarded rather than counted**, and that is the useful part: the first returned exit 0 at `elapsed_s: 0.2` because a throwaway profile had survived the previous session and nobody signed in — a cached session reading as a clean pass — and three attempts at the manual-close path all returned exit 0 while being the *auto-close* path in disguise, separable only by an **absent** `probe=in_context`. The manual path was obtained by widening the poll interval for one run so the competing branch could not fire; the 2FA path by killing the profile's own Chrome, because hand-timing lost every race on a host that completes passkey sign-in in ~15 s. **Recorded as NOT verified rather than omitted:** the migrated-host image slice (#692) was **re-run this cycle** — CLI `t2i` PASSED first-hand on a moved account, while the queued-MCP `i2i` twin failed with a typed non-retryable exit 27 whose **cause is unknown** — some dialog opened after the file was chosen and no `maseQ` left the page, on an account that has ALREADY consented, so the message's "most likely the one-time upload-terms dialog" does not fit; no incident bundle was written, so nothing names the dialog, and it is filed for a spike rather than guessed; the subprocess fallback is unit-tested only; and the OAuth-callback *mechanism* behind the poll fix is **inferred, not proven** — a host-only gate does not exclude NextAuth's callback, since it runs on the app's own origin, yet all four sign-ins passed under it, so #769 carries the spike that would settle it.) · previous: [LIVE_VERIFICATION_v0.71.1](LIVE_VERIFICATION_v0.71.1.md) (**two migrated-host error paths stopped blaming the wrong thing, 2026-09-08, $0 across three profiles.** The agent-mode recovery landed earlier in this same release (#749) and worked, but its first cut collapsed three outcomes into one message — chip clicked / chip found but click blocked / chip clicked and mode still on — so a modal eating the click sent users to toggle a chip that was never the problem, and genuine selector drift *after* the mode was left was filed under an account setting the driver had already changed. Verified by an e2e that drives the account INTO agent mode and carries its own neutered-selector control; run **twice**, because review fixes landed after the first run and it no longer covered the code. **The larger find:** an account's FIRST upload on this host is blocked by Flow's one-time *"Rights to use this image"* dialog, which renders *after* the file chooser hands the file over — so `_dismiss_dialog` never sees it and the driver spent 60 s waiting for a request the page had already declined to make, then advised re-encoding the image. Six runs on `ci-probe` close the chain: guard fires while the dialog is up → owner-authorised accept → uploads (`media_id 8914400f`) → fresh session uploads clean with `dialog: None`. The order was forced, because the dialog is one-off and accepting it destroys the failing state — so the guard was written and verified BEFORE anything was clicked, and its firing branch is now unrepeatable here. `maseQ` is confirmed **not** renamed (six uploads, three profiles), killing #719's top hypothesis. Also: Flow's queue listing is on **`Zzl0ze`**, not the `jwpduf`/`as29s` progress polls, and two `abra_r2v_8s` records sat at status 6 for ~20 h unseen by any CLI command (#741). Three documents are corrected rather than patched — a KNOWN_ISSUES entry that told #719's reader this dialog did not affect gflow-cli, and a v0.71.0 host label calling `ci-probe` *labs* when it is migrated, which helped a credit-based theory survive four runs. Recorded as NOT verified: #719's second failure shape — an upload request that leaves the page and is never answered, ~1 run in 4 — which is unfixed and keeps #719 open.) · previous: [LIVE_VERIFICATION_v0.71.0](LIVE_VERIFICATION_v0.71.0.md) (**`gflow character create --voice` verified end to end for the first time, 2026-09-07 on profile `ffroliva`.** Before this release a repo-wide grep for `--voice` across `tests/e2e/` matched **nothing** — every voice test was a unit test of the hardcoded `VOICES` constant and the one that looked live parsed a fixture, so a voice that silently failed to attach was invisible to the whole suite while the command exited 0. A live create + `character show` read-back settles a contradiction between two of our own documents: `sent='Charon' stored='Charon' identical=True`, so the Capitalized canonical form round-trips and `CHARACTER_RECON.md`'s "preset id is the lowercased name" does not describe today's wire. Both docs also now record that `personalityNotes` is **Agent-scoped** per Flow's own editor copy, not a control on the audio engine. **A claim that was in the code is overturned:** the `_unported_form` entity guard said the submit "never produces a reply" and that the backend refuses — in fact `MZZa6b` replies with a null payload and the generation is **accepted and queued** (Flow types it `abra_r2v_8s` and renders it); the failure is the *observer*, which waits out `SUBMIT_REPLY_BUDGET_S` (60 s, calibrated on 4.0–4.6 s replies against an idle queue) and exits 9 while the video is still rendering. The guard stays until the observer is fixed, because a timeout reported on a healthy generation is worse than an explicit refusal. Also verified: credit shortfall reports exit **37** with `_raise_if_out_of_credits` called from **both** give-up paths — and it is *short for the selected model*, not empty (the measured account held **50** and asked for `veo-quality`, which costs **100**); the "+ New project" CTA anchored structurally on `add` (Tier-1 matches **1** where every previous entry matched **0**, control 47 ligature nodes) after this same release first asserted the control did not exist and a $0 run disproved it in one click; and the incident-bundle DOM dump de-blinded — it queried `i.google-symbols` only, so **every bundle a migrated user sent carried an empty ligature list**, which is why #727 and #731 stayed invisible. One item recorded as NOT verified rather than omitted: whether a bound character's **voice reaches rendered audio** (#738) — attachment is proven, application is not, because no entity-bound generation has yet returned a file to measure. The blocker is no longer credits or account access but retrieval, and the measurement is pre-calibrated: plate-bound takes of one character gave **88 / 103 / 118 Hz** against a **4.3 Hz** engine noise floor, so an applied Algenib should sit near its sample's **163.3 Hz**.) · previous: [LIVE_VERIFICATION_v0.70.0](LIVE_VERIFICATION_v0.70.0.md) (**reference-to-video on the migrated `flow.google.com` host, verified 2026-09-06 on profile `denon82`.** Three r2v runs bound their references every time; the decisive one is semantic rather than structural — two hand-drawn reference images went in and the clip came back carrying the same marker strokes, face and paper texture, which is what separates "Flow bound the reference" from "Flow accepted and ignored it". A four-beat, two-character piece was then produced end to end and joined with the concat filter: 19.000s, 1280x576, `clip_qa` **ok**, A/V **+0.000s**, both actors recognisable across every cut from one face plate plus the canon repeated verbatim. Also verified as exit-code corrections on the real CLI: `-o ` now exits **2 in 0.8s** instead of exit 1 after ~2 min **and a billed, orphaned clip**; `character create` on a moved account exits **36 immediately** instead of a bare `RuntimeError` exit 1 after a 20s wait. Four items recorded as NOT verified rather than omitted: #692's original failure could not be reproduced [the reporter's own re-run was on a build without the fix, so it shows the failure is intermittent, not that the fix works]; Flow CHARACTER entities were never exercised because `character create` cannot run on any account available here; `image`/`scene`/`movie`/`extend` all exit 36 on the migrated host and no unmoved account exists here; and the sign-in-interstitial fidelity question from #699 has no bundle evidence either way.) · previous: [LIVE_VERIFICATION_v0.68.0](LIVE_VERIFICATION_v0.68.0.md) (`gflow update` self-upgrading a real `uv tool` and a real `pipx` install from their own running `gflow.exe` to the PyPI release, Windows 11, zero credits — see its own row below) · previous: [LIVE_VERIFICATION_v0.67.0](LIVE_VERIFICATION_v0.67.0.md) (the migrated `flow.google.com` driver — see its own row below) · previous: [LIVE_VERIFICATION_v0.64.0](LIVE_VERIFICATION_v0.64.0.md) (**#626 `--model omni-flash --end-frame` — first+last interpolation on Omni 1.1 Flash, verified 2026-09-02.** The guard this release removes was evidence-gated, so it was retired on evidence: a route-aborted submit capture on **two distinct Google accounts** (`ffroliva`, `denon82`) fired `video:batchAsyncGenerateVideoStartAndEndImage` with `startImage` AND `endImage` non-null at **zero credits**, ruling out a single-account artifact. The decisive layer is semantic, not structural: the paid 4s generation's **last frame IS the supplied end image** and its first frame is the start image — two visibly different subjects — which is the only check that distinguishes "Flow bound the end frame" from "Flow accepted and ignored it", and which layers 1–4 would pass either way. Render: 4.01s / 720×1280 / h264+aac / 2.4 MB, `MEDIA_GENERATION_STATUS_SUCCESSFUL`. The static capability table is **deleted**, not corrected — it went stale silently once and would again; a post-submit route check (`_assert_i2v_route`) now fails a run whose end frame Flow dropped back to the `StartImage` route, catching a rollback on any account without anyone re-reading a support page. One item is recorded as NOT verified rather than omitted: `--duration 10` + end frame is **submit-verified only** (`duration_set seconds=10` on the correct route with both images bound), because the status poll returned HTTP 401 mid-run and a retry 401'd at `project.create` before submitting — [#561](https://github.com/ffroliva/gflow-cli/issues/561), pre-existing, so verification was stopped rather than spending further credits on an environmental fault.) · previous: [LIVE_VERIFICATION_v0.63.0](LIVE_VERIFICATION_v0.63.0.md) (**`gflow video extend` — continuing a clip past Flow's 8s ceiling, verified 2026-09-01 on profile `ffroliva`, 20 Veo credits.** The decisive observation is that segment 2's `source_media_id` **is** segment 1's `media_id` (`0c9364f3…` seeded from `b9458021…`, then `648f9291…` seeded from `0c9364f3…`) — tail-only chaining, which no mock can establish; had it re-seeded from the source, the output would have been two divergent continuations of the same moment instead of one continuous shot. `extend_model_resolved` logged `candidate_count=99` against `SERVICE_TIER_INTERMEDIATE`, proving the key came from the live capability listing rather than a constant, and plan cost matched actual spend (`20 credits total, balance 875` → `Extended — 2/2 segment(s), 20 credits`). Render: 23.02s / 1280×720 / 24fps / h264+aac. **The run found a defect the offline suite is structurally incapable of seeing:** an extend segment carries **7.000000s** of content, not the 8 Flow advertises and bills, so server-side concat pads every internal seam with a frozen frame and digital silence (15s at −75.1 dB against −29 neighbours, reproduced on a second independent render) — filed in KNOWN_ISSUES with the three questions that must be answered before any clamp, and the reason `--extend N` on t2v/i2v was deliberately NOT shipped. Seven items are recorded as NOT verified rather than omitted: portrait `9:16`, `--aspect` against a mismatched source, chains longer than 2 segments, `--resume-from` against a live partial scene, the insufficient-credits refusal, a live Ctrl+C, and `OperationKind.EXTEND` rows.) · previous: [LIVE_VERIFICATION_v0.62.1](LIVE_VERIFICATION_v0.62.1.md) (**#604 `--model omni-flash` selects again after Flow's `Omni Flash` → `Omni 1.1 Flash` rename, verified 2026-08-30 on profile `ffroliva` at ZERO Veo credits.** The production `_select_video_model` was driven against the real picker: the shipped selector resolves verbatim — `model_selected model=omni_flash via="[role='menuitem']:has-text('Omni'):has-text('Flash'):not(:has-text('[Lower Priority]'))"` — and all six cases came back as expected: the four offered tiers SELECT, a tier Flow does not offer REFUSES, and a deliberately ambiguous selector REFUSES rather than resolving `.first`. Selection happens before submit, so the whole matrix is free. The transport's own refusal diagnostic read the live menu back as `Omni 1.1 Flash / Veo 3.1 - Lite / Fast / Quality`, independently corroborating the fixture. Four items are recorded as NOT verified rather than omitted: the rename *direction* [the `Omni Flash` baseline is a different account, locale and date], an actual `Omni ... [Lower Priority]` entry [Flow has never offered one], a full credit-spending generation on omni-flash, and #539's absence question, which stays open.) · previous: [LIVE_VERIFICATION_v0.62.0](LIVE_VERIFICATION_v0.62.0.md) (**#595 `auto` ≡ `classic` for images, verified 2026-08-28 on profile `ci-probe` — an account Flow had moved to the agentic cohort the day before — at ZERO Veo credits.** With no flags and no env vars the run logged `ui_driver.ui_mode.attempt_exit_agent` → `ui_driver.bound mode=classic ui_mode=classic` and generated a real 768x1376 JPEG (exit 0); the day before, the identical command on the same account bound `auto`→`agentic` and failed. The same log independently closed **#183**: `mode_switch_trigger` and `image_mode_tab`, the selectors it reported as unfindable, both matched. #591 was proven against the real 500-row catalog — **0** occurrences of the string `"None"`, 31 proper JSON `null`s, over a catalog holding 119 NULL-bearing rows. #592 shows exactly one `client.account_locale_cached` per command. Three items are recorded as NOT verified rather than omitted: the exit-28 abort on a *pinned* agentic account, the #597 batch inter-prompt guard, and any fresh announcement modal — the last two because all three accounts have already acked the current changelog, so no modal can be raised until Google ships the next one.) · previous: [LIVE_VERIFICATION_v0.61.0](LIVE_VERIFICATION_v0.61.0.md) (**#539 video-model refusal + #586 image-model refusal and server-side attribution, verified 2026-08-26/27 on profile `denon82`, ONE Veo generation total** — the video fix was proven by a **zero-credit A/B against the stashed pre-fix source running on live Flow**: the old code returned SELECTED for `veo-lite-lp`, a model Flow does not offer to this account, and for a deliberately ambiguous selector matching 3 entries; the new code refuses both with exit 18 naming what Flow offered. Model selection happens before submit, so refusals cost nothing and the A/B was free. The happy path still generates: `--model omni-flash` → exit 0, a real 2.2 MB `ftypisom` mp4, catalog recording `omni_flash`. Two items are recorded as NOT verified rather than omitted: three of #584's four navigation-settle sites were never exercised [no bearer refresh occurred in these runs], and #582's canary self-re-exec has its first real exercise tonight. Also falsified: #539's recorded note that the video picker uses a different trigger — the two constants are byte-identical strings, and the repeated empty menu captures were the capture's own fault.) · previous: [LIVE_VERIFICATION_v0.60.0](LIVE_VERIFICATION_v0.60.0.md) +**What was actually live-verified for the latest release?** → latest: [LIVE_VERIFICATION_v0.106.0](LIVE_VERIFICATION_v0.106.0.md) (**2026-11-23, 1 Omni 1.2 generation (4 credits).** Plain t2v on the release tree at 360p, 4 s, x1, after a `--max-credits 0` probe refused a 4-credit quote with exit 45; the `direct_http` image transport through 9 credit-free e2e tests (plain, three images, UI routing, character, mention, local-file upload, batch row ref, MCP worker); the telemetry endpoint's `transports` deployment; caption e2e (3 passed, transcription skipped without an endpoint); `image batch` exit 36 on flow.google.com; #1434 recorded as not verifiable on demand, with the reason.) Previous: [LIVE_VERIFICATION_v0.105.1](LIVE_VERIFICATION_v0.105.1.md) (**2026-11-22, 1 Omni 1.2 generation (4 credits).** Plain t2v on the release tree at 360p, 4 s, x1, after a `--max-credits 0` probe refused a 4-credit quote with exit 45; catalog migration 0011 applied to a copy of an existing v0.105.0 catalog, the `gflow data` readers on it, and superseded copies hidden from them; the credit-free e2e credit-cap refusals (#1408) passed; the #1299 extend write path recorded as not run live (every extend is billed), and #1111, #1159 and #1416 as not verifiable on demand, with reasons.) Previous: [LIVE_VERIFICATION_v0.105.0](LIVE_VERIFICATION_v0.105.0.md) (**2026-11-22, 1 Omni 1.2 generation (4 credits).** Plain t2v on the release tree at 360p, 4 s, x1, after a `--max-credits 0` probe refused a 4-credit quote with exit 45; `character create --image` / `--body-image` on CLI and the MCP twin through the credit-free e2e on a test account; no-replace publishing (#1406) through `audio narrate` and `video assemble` on NTFS; the no-hard-link fallback, #1336's labs arm and #1382 (test-only) recorded as not verifiable, with reasons.) Previous: [LIVE_VERIFICATION_v0.104.0](LIVE_VERIFICATION_v0.104.0.md) (**2026-11-22, 1 veo-lite generation (10 credits).** Plain t2v on the release tree; `--max-credits 0` refused before submit with exit 45 at a 10-credit quote, balance unchanged; `media trash` and `restore` round-tripped the fresh clip at 0 credits; `audio narrate` (Edge), `video captions` and `video assemble` on that clip, locally; transcription, the #1387 agent-only driver and #1400's macOS path recorded as not verified, with reasons.) Previous: [LIVE_VERIFICATION_v0.103.1](LIVE_VERIFICATION_v0.103.1.md) (**2026-11-20, 1 veo-lite generation.** Agent panel and Agent switch recovery on Flow's 2026-11-20 build (#1384, #1374): the gate, the CLI video door and the MCP queued door all reach the classic composer from an open panel, 5/5 e2e on the release tree with the panel proven open first; the #749 A/B control on the moved `AgentModeMixin`; #1369 closed as stale on a $0 spike; plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.103.0](LIVE_VERIFICATION_v0.103.0.md) (**2026-11-19, 14 video generations (Omni 1.1, Omni 1.2, veo-lite).** Model retirement (#1375): `model.retiring` on CLI stderr and the MCP `warnings` field live on the merged head, `retires_on` in the catalog, a leaving model not refused on the date (exit 37 on a credit-limited account, $0), e2e moved off the leaving models, plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.102.1](LIVE_VERIFICATION_v0.102.1.md) (**2026-11-19, 16 video generations (veo-lite and the agent default).** Agent-only video named from the project listing when the page shows only `/asb/` media (#1354): unmodified CLI t2v on an agent-only page logged `video_named_by_listing`; agent-only BDD e2e CLI + MCP t2v 6/6 on the merged tree; 14 of 15 video runs across the fix's trees; plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.102.0](LIVE_VERIFICATION_v0.102.0.md) (**2026-11-18, paid extends, video exports and one veo-lite generation.** Reliability wave: charged-no before submit, indeterminate after it, re-extend, typed exits 32/35/22, extras-preserving update, engine and host telemetry.) Previous: [LIVE_VERIFICATION_v0.101.2](LIVE_VERIFICATION_v0.101.2.md) (**2026-11-17, one veo-lite generation.** patchright close hang fixed (#1324): the disabled-feature parse reads patchright 1.64's exclusion filter and each launch site names its engine; live t2i + auth renew + MCP queued job on patchright with no close error, plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.101.1](LIVE_VERIFICATION_v0.101.1.md) (**2026-11-17, two veo-lite generations.** patchright extra 1.61.2 -> 1.64.4 so `.last` locators resolve (#1319): engine contract RED on 1.61.2 / GREEN on 1.64.4, live t2i + i2v + MCP queued job on patchright, plain t2v on the release tree.) Previous: [LIVE_VERIFICATION_v0.101.0](LIVE_VERIFICATION_v0.101.0.md) (**2026-11-16, 0 Veo credits.** Universal -o/--output [json|table|id] format selector, --out-file PATH strictly enforced for file targets, MCP output removed, #1158; 44 format/remediation tests + 5 BDD scenarios green; --out-file verified at .) Previous: [LIVE_VERIFICATION_v0.100.1](LIVE_VERIFICATION_v0.100.1.md) (**2026-11-16, 0 Veo credits.** Locale-invariant count selector for settings pane on flow.google.com under German locale (`?hl=de`, #1312, #1315); 221 unit tests green; settings pane verified at $0.) Previous: [LIVE_VERIFICATION_v0.100.0](LIVE_VERIFICATION_v0.100.0.md) (**2026-11-15, 4 Veo lite clips.** t2v on the release tree to a file; `image generate` resolves t2i and i2i, `video generate` a t2v; `gflow cancel` and `--help --json` offline (no Flow surface); `e2e_update` 4/4 on real pip/uv venvs incl. a held launcher; character list/show MCP 3/3 on flow.google.com; a new `--resume-from` chain e2e; extend 3/3 at $0.) Previous: [LIVE_VERIFICATION_v0.99.0](LIVE_VERIFICATION_v0.99.0.md) (**2026-11-14, 1 Veo lite clip.** t2v on the release tree written with `--out-file`; `--out-file` / `-o` e2e 3/3 incl. the cloud-storage refusal; MCP `out_file` e2e 1/1; exit codes unchanged by default with `exit_code_legacy`.) Previous: [LIVE_VERIFICATION_v0.98.0](LIVE_VERIFICATION_v0.98.0.md) (**2026-11-12, 1 Veo lite clip.** t2v on the release tree; `gflow capabilities` and its MCP twin (e2e 3/3); `gflow models list/show`; an error envelope with `charged`/`next_action`; image e2e 4/4 and the duration e2e for the sent-once and selector fixes.) Previous: [LIVE_VERIFICATION_v0.97.0](LIVE_VERIFICATION_v0.97.0.md) (**2026-11-10, 1 Veo lite clip.** Credits read without a browser, p50 2.72 s over 5 runs, 0 Chrome launched; browser read 10.7 s; doctor `auth.wire_read` accepted; credits/wire/auth-status e2e 10/10 on CLI and MCP; extend e2e 3/3; t2v.) Previous: [LIVE_VERIFICATION_v0.96.1](LIVE_VERIFICATION_v0.96.1.md) (**2026-11-08, 1 Omni 1.2 + 1 lite clip.** Omni 1.2 start+end lands with matching first/last frames; route guard e2e 4/4 on CLI and MCP; t2v.) Previous: [LIVE_VERIFICATION_v0.96.0](LIVE_VERIFICATION_v0.96.0.md) (**2026-11-07, 1 Veo lite clip on the release tree.** t2v; Omni 1.2 durations 3–15 and its MCP twin; Omni r2v 4/6/10s; agent-only reload on CLI and MCP; paid Omni clips on the PR #1174 head.) Previous: [LIVE_VERIFICATION_v0.95.0](LIVE_VERIFICATION_v0.95.0.md) (**2026-11-07, 1 Veo lite clip.** t2v on the release tree; weekly upload e2e against the live endpoint 8/8 incl. EU consent and 410; local telemetry e2e 6/6; production D1 left at 0 rows; byte-exact `mcp setup` backup.) Previous: [LIVE_VERIFICATION_v0.94.0](LIVE_VERIFICATION_v0.94.0.md) (**2026-11-07, 1 Veo lite clip.** t2v on the release tree, local usage counters and telemetry e2e, CLI and MCP usage stats.) Previous: [LIVE_VERIFICATION_v0.93.0](LIVE_VERIFICATION_v0.93.0.md) (**2026-11-05, 82 Veo credits over the session.** Video delivery after #1153, lost t2v reply on CLI and MCP, revoked session.) Previous: [LIVE_VERIFICATION_v0.92.1](LIVE_VERIFICATION_v0.92.1.md) (**2026-10-30, $0.** MCP schema, #1121.). Previous: [LIVE_VERIFICATION_v0.92.0](LIVE_VERIFICATION_v0.92.0.md) (**2026-10-29, no Veo credits.** GHSA-hqfj-4jww-76f2: MCP `output` / `out_dir` / `profile` escapes refused live on the release head, an inside `output` lands; MCP upscale e2e and the #1035 BDD re-run 3/3. #1114 measured on real mounts, Linux and Windows) · previous: [LIVE_VERIFICATION_v0.91.0](LIVE_VERIFICATION_v0.91.0.md) (**2026-10-26/28.** Release-tree e2e 7/7: #1097 MCP `wait=false` runs and #1102 SEP-2663 `tasks/get` over stdio; selector drift; auth verification. Paid on their PRs: #723 r2v with a character 3/3, #1112 lost video submit reply 2/2. #988 blocked: no profile here is served the agent-only composer) · previous: [LIVE_VERIFICATION_v0.90.0](LIVE_VERIFICATION_v0.90.0.md) (**2026-10-25, no Veo credits in the release run.** Release-tree e2e 15/15: #772 a local `--ref` uploaded once per project (CLI, MCP, and a recorded image the project no longer holds); #1091 unwritable output exit 11; #934 `run --resume`; #745 credit shortfall; #1083 selector drift; the two re-armed canary tests; #796 and #481 verified at $0 on their PRs; #941 on its PR with one veo-lite clip) · previous: [LIVE_VERIFICATION_v0.89.1](LIVE_VERIFICATION_v0.89.1.md) (**2026-10-24, no Veo credits.** Release-tree e2e 9 passed, 1 skipped (credit-spending video case): lost image replies recovered from the grid on t2i and i2i (#1075), upscale straight after generating with no pause (#1067), visible model picker, auth and pre-submit regressions; hidden-picker, `/about` and declined-upload paths offline, blockers named) · previous: [LIVE_VERIFICATION_v0.89.0](LIVE_VERIFICATION_v0.89.0.md) (**2026-10-23, no Veo credits.** Release-tree e2e 20/20 (one re-run after #1010's lost reply body): #1039 default project CLI+MCP; #974/#1053 a missing project is exit 11 on generation, upscale and extend; #1038 nano2.1; #914 warm-client upscale; #892 pre-submit gate; #927 window position; #984/#1059 held profile exit 11 on the PR branches) · previous: [LIVE_VERIFICATION_v0.88.0](LIVE_VERIFICATION_v0.88.0.md) (**2026-10-22, no Veo credits.** #1036 browser proxy through a local proxy; #1037 slow-link create; #992 lost-reply readback; #1035 failed image download keeps the ids; #1041 quiet output; #1026 internal login) · previous: [LIVE_VERIFICATION_v0.87.1](LIVE_VERIFICATION_v0.87.1.md) (**2026-10-22, $0 apart from one Veo lite clip for the #795 spike.** #795: `gflow credits` balance equals Flow's account menu on two accounts, CLI and MCP; #1027: 2K image upscale and both video exports pass with the shared blob capture; project create/rename re-run for the shared `_rpc_reply`) · older: [LIVE_VERIFICATION_v0.87.0](LIVE_VERIFICATION_v0.87.0.md) (**2026-10-22, Veo lite clips under the e2e grant.** #1023: auth status/renew/MCP twin verify again after labs' session URL went 410; #1010: a lost submit reply makes one submit and a non-retryable exit 9, image and video; #1013, #995, #997, #986, #1014 e2e passed on the release tree; image-upscale body loss filed as #1027) · older: [LIVE_VERIFICATION_v0.86.0](LIVE_VERIFICATION_v0.86.0.md) (**2026-10-17/18, 2 Veo extends (owner-approved).** #991: `video extend` on flow.google.com — paid single-segment extend passed on the release tree, plus 3 $0 route-guard e2e; #989: agent-only composer — classic-composer regression 11 passed, agent-only path blocked externally (no account in that cohort; run live by 3 outside users); #982: `auth renew` 4 passed incl. stale→readable and /about) · previous: [LIVE_VERIFICATION_v0.85.0](LIVE_VERIFICATION_v0.85.0.md) (**2026-10-14, 0 credits.** #723/#979: `@Character` on flow.google.com images — 4-scenario e2e (CLI t2i, MCP, i2i + character, id-only refusal) passed on the release tree; #975: multi-prompt `t2i --project-name` — e2e passed) · previous: [LIVE_VERIFICATION_v0.84.0](LIVE_VERIFICATION_v0.84.0.md) (**2026-10-12, 0 credits.** #970: `gflow run --project` generates every row into an existing project — e2e passed on our account and the contributor's; #971: multi-prompt `t2i --project` — new e2e passed; no MCP twin for either) · previous: [LIVE_VERIFICATION_v0.83.2](LIVE_VERIFICATION_v0.83.2.md) (**2026-10-11, 0 credits.** #963: `--duration` binds in a Vietnamese pane — locale e2e failed on develop and passed after the fix, and a notice-only cookie bar is now acknowledged; #957: image upscale e2e passed on the CLI and over MCP; #962: `auth status` probe uses the profile's channel, unverified on a host without Chrome) · previous: [LIVE_VERIFICATION_v0.83.1](LIVE_VERIFICATION_v0.83.1.md) (**2026-10-08, 0 credits.** #958: the default image model `nano2` runs Nano Banana 2.1 on flow.google.com — e2e failed on develop and passed after the fix; CLI and MCP twins each wrote a JPEG; 2.1 measured as replacing 2 on two accounts) · previous: [LIVE_VERIFICATION_v0.83.0](LIVE_VERIFICATION_v0.83.0.md) (**2026-10-06/07.** #948: a billed flow.google.com video run no longer exits 7 — t2v, i2v and r2v e2e passed after the fix, reproduced before it; `data download` e2e 2 passed after a 302 regression was caught and fixed; #922: image and video upscale e2e passed, CLI and MCP image twins wrote the same JPEG, MCP video wrote 1920x1080, a 1080p export measured 0 credits) · previous: [LIVE_VERIFICATION_v0.82.1](LIVE_VERIFICATION_v0.82.1.md) (**2026-10-02.** A reCAPTCHA mint failure typed with a live-measured retry flag (#915, e2e 2 passed, $0); a busy catalog no longer fails a successful generation (#900, real SQLite, no Flow surface); a video's workflow id recorded (#898, 1 veo-lite clip)) · previous: [LIVE_VERIFICATION_v0.82.0](LIVE_VERIFICATION_v0.82.0.md) (**2026-10-01.** `"ref": "batch:N"` and local-file refs on `gflow run` verified by a BDD e2e on flow.google.com: in place, no re-upload, lineage recorded; 1 veo-lite clip for the #926 e2e) · previous: [LIVE_VERIFICATION_v0.81.0](LIVE_VERIFICATION_v0.81.0.md) (**2026-09-30, 3 veo-lite clips.** The off-screen generation browser (#923) measured unchanged for image and video, window placement read back from Chrome, focus-steal measured and documented; #919 verified at merge) · previous: [LIVE_VERIFICATION_v0.80.0](LIVE_VERIFICATION_v0.80.0.md) (**2026-09-29, 0 Veo credits.** `--resolution` 360p/720p proven by driving the real settings pane on `omni_flash` and refusing the credit-spending submit, on the CLI transport **and** the MCP twin; `nano2-lite` e2e 2 passed; #891 measured before/after — `gflow run` `[nano2, imagen4]` went from exit 1 `RecaptchaError` with a lost results table to exit 36 naming the model, plus 3 e2e (fresh, warm, MCP) with a spy asserting zero client mints; #896 `e2e_data` 2 passed, its failure path offline-only. Named blockers: rendered resolution (needs a billed clip), the `/about` re-check arm, labs-served accounts.) · previous: [LIVE_VERIFICATION_v0.79.1](LIVE_VERIFICATION_v0.79.1.md) (**the signed-media download survives a dropped connection, verified 2026-09-22 at $0.** All three download sites route through one new shared helper, and that helper was driven through a real Flow clip route and a real signed CDN transfer by `pytest -m e2e_data` — 2 passed in 20.74 s, `ftyp` magic, byte length equal to the size Flow reports, and **no `url=` on any log event**. The retry itself could not wait for an organic reset — 20/20 clean here against the reporter's 2-in-6 — so it was **measured against a real TCP RST with an A/B control**: with `max_retries` the transfer recovers on a second connection, with it disabled the identical fault kills the call, and three attempts at a 5 s timeout finish in 1.57 s rather than ~15 s, proving the backoff shares one budget. **Two sites are NOT live-verified and name their blockers:** the composer call site needs a billed generation and `gflow credits` answers 401 on this account (#795), so no credits were spent; and the labs download cannot be reached at all from here (HTTP 308, 6/6 profiles). Offline: 21 new tests, full sweep 2143 passed.) · earlier: [LIVE_VERIFICATION_v0.79.0](LIVE_VERIFICATION_v0.79.0.md) (**the migrated host stops echoing a model it never observed, verified 2026-09-18 at $0.** `model_name_type` is `null` on `flow.google.com` in a real `image t2i --json`, with every sibling field populated — which is what makes the null a result rather than an empty envelope; the first read of it was flat rather than into `images[]` and returned `None` for everything, and that instrument error was discarded rather than reported. Both surfaces ran: `test_e2e_t2i_runs_on_a_moved_account` and `test_e2e_mcp_i2i_runs_on_the_migrated_host`, 2 passed in 86 s. **`gflow data download` was tested on an image and failed** — 45 s, then a message blaming the project, the trash and your prompt; recovery is video-only and the release notes now say so (#877). **#803 is NOT live-verified and names its blocker:** reaching those raise sites needs a non-JSON or token-less aisandbox reply, and the labs route refuses first with a 404 — itself a misleading error, filed as #875. Offline: 4 new unit tests, 1775 passed.) · previous: [LIVE_VERIFICATION_v0.78.0](LIVE_VERIFICATION_v0.78.0.md) (**generating with no project on `flow.google.com` — and video from a start frame — verified 2026-09-17.** The release exists because labs.google's `project.createProject` is retired — 404 *"Flow RPCs have been deprecated and disabled"* with a labs token, 401 without, 0 successes in 12 across four profiles — and gflow reported the 401 as an expired login. Creation and rename are driven on flow.google.com and read back from Flow's own `jHPbke` / `o8DA4` replies; the CLI and the MCP twin are each exercised separately, and both video paths reach a real submit that is aborted before Flow can bill it. Two failures are recorded and re-tested rather than explained away — one MCP image reply that did not reproduce under a four-run A/B, and a Chrome launch starved by a concurrent coverage run that passed in 36 s alone. The 3:4 image aspect is re-measured on the live radiogroup, five radios where 2026-09-08 saw four. Three items are NOT verified and each names its blocker: no labs-served account, no entitled `/about` account, no non-`en` locale. **#860 is the one thing here that cost credits, deliberately:** the only proof that a start frame binds is a real generation, so ten i2v clips were generated and downloaded on a live migrated account — `migrated.frame_uploaded` → `frame_bound` → `submit_observed` → `download`, the middle event being the one that could not fire before this release. **#859 is recorded as UNOBSERVED, not verified** — its dismissal ran on every one of those runs and no promo modal ever appeared, so the $0 route-intercepted e2e is what covers it. `gflow docs` (#861) is verified from the built wheel, which is its whole contract: 127 topics, `docs/FILE.md:LINE` search hits, no network and no checkout.) · previous: [LIVE_VERIFICATION_v0.77.1](LIVE_VERIFICATION_v0.77.1.md) (**a four-fix patch release, verified 2026-09-17 at ZERO cost.** The headline is #846: the published package could not run a single interactive command on a clean Windows install, because `ConsoleRenderer(colors=True)` needs `colorama` and nothing declared it. Verified as a controlled A/B on a fresh Python 3.13 venv — `SystemError` before, exit 33 after — plus an arm with stderr piped that shows why the AUTO/JSON split hid this from every CI job, and the MCP twin run separately. #848's import probe is exercised against a **deliberately broken venv** and an intact one, including the contract that a probe which cannot run reports nothing rather than reporting breakage. #852 is re-measured on the release head: 40 000 base64-shaped chars fall from 12.07 s to 0.020 ms with identical output on Workspace and custom domains. **#849 is a NAMED BLOCKER, not an omission** — its end-to-end behaviour needs a fresh interactive Google sign-in, which no agent can perform; its live A/B is recorded on PR #851 and its e2e file re-ran 4/4 here. **Seven live e2e failures are recorded rather than hidden**, and controlled: the release changes exactly four source files and none of them is a failing test's module.) · previous: [LIVE_VERIFICATION_v0.77.0](LIVE_VERIFICATION_v0.77.0.md) (**the migrated-host login lockout (#791), verified as a controlled A/B on a real Google **Workspace** account at ZERO cost — same profile, same cookies untouched between arms, so the only variable is the code: exit 8 with the Chrome marker rolled back and `channel_for_profile` collapsed to `None`, then exit 0 with the marker intact and the account recorded. The refusal path is measured too — of 10 local profiles, 5 reproduce #791 and exactly one carries both required cookies: 4 refusals, 1 upgrade, 0 false positives. v0.76.0 recorded this fix as **withdrawn**; the approach that shipped is a different one, server-attested on the landing URL rather than on client-rendered DOM. An earlier revision gated auth on an `@gmail.com`-only pattern that silently declined every custom domain — the account used here is one, which is why this is its verification. **#796 is reproduced and prevented**, not merely reported: it was filed as *'not yet reproduced end-to-end'*. **Two rows are named blockers, not omissions:** the MCP Registry publish (#841) cannot be rehearsed before a real tag push, so this release is its first exercise; and the migrated-host generation e2e cannot run here at all — every account bounces to `/about`, A/B-controlled against `develop` so it is not mistaken for a regression.) · previous: [LIVE_VERIFICATION_v0.76.0](LIVE_VERIFICATION_v0.76.0.md) (**a diagnostics-and-distribution release, verified 2026-09-16 at ZERO cost — no Veo credits, no image generation, no Flow submit.** The decisive arm is #833's **negative** control, run first-hand on two real accounts rather than relayed: `flow-pinhole-unavailable-screen` is **0** on both `ffroliva` and `denon82` while `aisandbox-root` is **1**, so the guard does not fire on accounts that HAVE Flow access and the zero is a real absence rather than a page that never booted — a guard with only a positive arm is indistinguishable from one that is permanently on. Both accounts settled at **`/about`**, which is the state that broke this release's *withdrawn* #791 oracle, and the exit-39 signal reads a component that only exists on the unavailable screen, so `/about` cannot mimic it. mcpservers.org is verified with a **404 negative control** because the listing 403s to `curl` and a naive check would have called the link dead. **#791 is NOT in this release and was withdrawn rather than deferred**: a fix passed eight council dimensions and was then refuted by a five-day-old spike nobody had routed to it — Flow's `/about` hop is decided client-side with zero requests to Flow, and *"the backend grants access while the frontend declines to open it"* (#756), so the probe would have reported authenticated users as logged out, reintroducing #791 as its own cure; the e2e caught it by going red on a live account whose state moved mid-session. **Two rows are blocked by the platform rather than by effort:** the Docker sign-in needs a WSL-integrated Docker host, and the MCP Registry publish cannot be observed until this very tag reaches `main`, since both triggers resolve the workflow from the default branch.) · previous: [LIVE_VERIFICATION_v0.75.0](LIVE_VERIFICATION_v0.75.0.md) (**a distribution-and-hardening release, verified 2026-09-15 on `ffroliva` at ZERO cost — no Veo credits, no image generation, no Flow submit.** The `gflow serve` token fix is an **A/B against the released 0.74.0 wheel from PyPI**, not a diff read: the token was *set* in both arms, so the probe measures whether it is checked — before, `no token 200/200` with 13 tools listed and `wrong 200/200`; after, `401/401` with zero tools and `WWW-Authenticate: Bearer realm="gflow"`, while the correct token still gets 200. Loopback DNS-rebinding was re-confirmed at **421**/**403** because the fix forwards the bind host and getting that wrong would silently disable protection that works today — and an earlier draft of the accompanying advisory claimed that protection was *disabled*, a false claim caught by measuring rather than re-reading. #813's guard is verified against a **real wheel in a real venv installed without extras**, the arm first proving it is in that state (`av present: False PIL present: False`); the decisive row is that a **nonexistent** manifest still exits **20** on the dependency error rather than file-not-found, which is what shows the guard precedes the manifest read and not merely the generation. The Rich escape fix is verified on the **console render separated from the structlog JSON** — matching the JSON line would have been a false pass, since `--json` was never affected — with a **neutered control** through the same Rich version reproducing the bug exactly: `UNESCAPED -> pip install 'gflow-cli'` against `ESCAPED -> pip install 'gflow-cli[chain]'`. Also: `gflow-cli.exe` exists in the built wheel so `uvx gflow-cli` resolves at all, and the wheel carries 138 entries with **zero** ZIP duplicates. **Three items recorded as NOT verified rather than omitted:** a successful multi-link `chain` run spends Veo credits and stays outstanding e2e debt on #813 — what changed is the refusal path, which *is* verified; `gflow credits` against a working balance is impossible here because the account still returns 401, pre-existing **#795** and unrelated to this release; and the SSE arm of the token fix was exercised on loopback only, a deliberate scope limit, since binding a LAN address to test it would put an authenticated daemon on a live network for the run. **Two rows are blocked by the platform rather than by effort:** the PyPI metadata and the MCP Registry listing are both unobservable until this release is uploaded — PyPI renders the last artefact's metadata, and `mcp-publisher` reads its ownership token out of the *published* README.) · previous: [LIVE_VERIFICATION_v0.74.0](LIVE_VERIFICATION_v0.74.0.md) (**the migrated driver's run-unique uploads and its Frames-picker confirm, plus the `credits` remediation, verified 2026-09-14 on `ffroliva` at ZERO cost — every arm is a read or an upload-and-stop.** The confirm branch is the interesting one: this cohort's picker closes on its own, so the branch would never execute against live Flow by accident, and the e2e drives `FRAME_COMMIT_GRACE_S` to **0.001** so the grace expires before Flow can auto-close and **every** run enters it — the difference between a named blocker and an unrun claim. A *genuinely stuck* picker still cannot be produced here and stays `Refs #792`, verifier the reporter. #795 was verified on the cohort it is for, because this account is now in it — `auth status` green, `credits user` exit **3** with `detail` `credits endpoint returned 401` and `route: credits`, where v0.73.2 printed the class-default *"SAPISID cookie missing… re-run `gflow auth login`"*, advice that is wrong in every word there and that can roll a profile's strategy marker back and start the #791 spiral; the `credits list --json` envelope carries the per-profile `remediation_hint` that used to be dropped. **Two items recorded as NOT verified rather than omitted:** #799's exit-25 raise site needs an account in the agent-only cohort — the maintainer's accounts are served `flow.google.com` but still have the recoverable agent chip, so the state is structurally unreachable on them, a named blocker and #799 stays open; and neither `r2v` nor `i2i` had its own attach path driven to completion — `r2v` was not attempted (its e2e spends Veo credits), while `i2i` **was** attempted twice and failed both times at exit 23, before reaching the code under test, because the `--project` UUID came from `gflow project list` (the aisandbox catalog) and those ids 404 on `flow.google.com` — a harness error, recorded rather than dropped, which left a side finding: gflow reports Flow's own `/404?reason=project` as `UiSelectorDriftError`, blaming our selectors for Flow's 404. **#791 is not fixed and was not attempted blind** — all nine local profiles were probed at $0 and none is in the #791 state (SAPISID + a live `flow.google.com` session + no labs NextAuth token); four print its exact symptom string and none of them is it, because that string is also what a stale profile says.) · previous: [LIVE_VERIFICATION_v0.73.2](LIVE_VERIFICATION_v0.73.2.md) (**the blank incident bundle, reproduced and then cured by a committed e2e test, 2026-09-12 on `ffroliva` at ZERO cost — every arm fails before submit.** The decisive layer is an **A/B run through the same instrument**, not an inspection: on `develop` the new test FAILS in 46.3 s and prints the bundle it got — `tag_counts.div = 0`, `title.length = 0`, `host_category = "other"`, a 4,254-byte screenshot — which is field-for-field the signature [#792](https://github.com/ffroliva/gflow-cli/issues/792) reported from a different account, a different OS and a different command; on the fix it PASSES in 37.8 s with `div` **25**, `title.length` **81**, `host_category` **`flow_app`**, `route` `/404` and a 38.4 KB screenshot. Both arms exit **23** on the same `.settings-trigger-button` drift at `flow.google.com/404?reason=project`, so the arms differ only in what was *captured*, never in what failed. **The reporter's own bundle contained the refutation of their diagnosis**: viewport 1280x720 is `client.py`'s client-owned page, not the 1920x1080 a stray transport tab would have — it was always the driven page, photographed one navigation too late, and the portrait correlation had no mechanism behind it. The existing quality benchmark could not have caught this: it captures deliberately on a **healthy** page, so it graded only bundles that were never at risk. **Recorded as NOT verified rather than omitted:** #796's `PROFILE_MARKER_MISSING` is offline-only because its live trigger is a cookie-store **decryption** failure, which does not occur on Windows/DPAPI — it is the macOS Keychain path of [#768](https://github.com/ffroliva/gflow-cli/issues/768), a **named external blocker**, and the issue stays open; a synthetic attempt to force it failed informatively, since a corrupt store raises `sqlite3.DatabaseError`, bypasses the marker gate and still prints "check network connectivity" — the same misdirection from a different trigger, untouched here. #795's remediation string is unit-asserted only, and the *other* half of #795 — `credits` being labs-only on migrated accounts — is **not fixed**.) · previous: [LIVE_VERIFICATION_v0.73.1](LIVE_VERIFICATION_v0.73.1.md) (**Google's `glue` consent bar covering the migrated composer, measured and then cured, 2026-09-11 on `ci-probe` for one image generation and no Veo credits.** The premise was nearly rejected: both prior sightings of that selector in this repo are labs.google, and the 2026-09-10 spike had read 159 DOM samples on this exact host and project and watched the click land 3/3 — it simply never looked for a cookie bar. Seventeen hours later the bar was up: `position: fixed`, `z-index: 1000`, spanning y 547-655 of a 655 px viewport, with `elementFromPoint` over the settings trigger AND over the image submit both returning `span#glue-cookie-notification-bar-1-label` in **0 of 5** rendered samples hit-testable. **The control arm is what makes it a cure rather than a coincidence**: the same probe re-run through the driver's own `_dismiss_cookie_bar` restored both controls to **4/4**, one attempt, no error. A full `gflow image t2i` then ran end to end on the merged code — `status: ok`, a 807,761-byte `ffd8ffe0` JPEG that Pillow reads as 1376x768 RGB, matching the requested 16:9 and the reply's own dimensions, with `migrated.editor_ready` at 2.0 s and **no** `cookie_bar_not_dismissed`. A side finding the control arm produced by accident: the bar's buttons are `__accept` then `__reject` in DOM order, so anything taking "the first button" accepts cookies for the operator — the shipped fix anchors on reject. **Three items recorded as NOT verified rather than omitted:** the cure against a live bar outside the browser, because this release's own control arm consumed the consent on the only profile that had it; **prevalence**, because the second profile never reached an editor (both arms redirected to `/about`) so it is one account blocked and one already-consented, and KNOWN_ISSUES says so rather than generalising from n=1; and the video path live, which shares the identical function on the identical control but spends Veo credits.) · previous: [LIVE_VERIFICATION_v0.73.0](LIVE_VERIFICATION_v0.73.0.md) (**four error paths that stopped lying about what went wrong, verified 2026-09-10 on `ci-probe` and `denon82` at $0 — no run below reaches a Veo submit.** The decisive arm is an **A/B**, not an inspection: the pre-fix run printed an `accounts.google.com` challenge URL together with the OAuth `state` and `client_id`, and the identical command after the fix gave the same exit 38 and the same landing named with **five secret matches down to zero** — reading the post-fix output alone would only have shown that *these* secrets were absent. A second arm **falsified a claim already written into PR #775's body**: it said the change fixed the RED canary, and the live run showed `denon82` had moved to `accounts.google.com` mid-run, a landing the classifier excluded **by design**, with a unit test encoding the wrong reason — the offline suite was green throughout and could not have caught it. #776's happy path is verified by a real `gflow image t2i` (exit 0, 367 135-byte JPEG, `image_settings_applied` and `prompt_typed` both present, so **three of the four converted click sites** clicked successfully through the new helper); its **failure** path is real Chromium driving a page we wrote, which proves the mechanism and explicitly **not** that Flow still produces that state. **Three items recorded as NOT verified rather than omitted:** the `/about` redirect stopped reproducing (**0/5**, reported as *unmeasured* rather than argued into a retry flag), the `/fx/api/auth/*` landing moved before the run reached it, and #764's *success* path — an external contribution whose error boundary this release verifies but whose auto-selection needs an account currently behind a Google password challenge. The fourth converted click site is the **video** submit, unrun because it spends Veo credits, named rather than implied.) · previous: [LIVE_VERIFICATION_v0.72.0](LIVE_VERIFICATION_v0.72.0.md) (**auto-closing `gflow auth login`, verified 2026-09-09 on a migrated account at $0 across six runs.** Four paths: auto-close fires (`probe=in_context` at `elapsed_s` **84.8**, reproduced 3x), a manual close still verifies from disk (exit 0, never exit 12), `--browser auto` selects and completes, and a window closed **mid-2FA** is noticed in **2 s** (exit 8) where it previously ran the full 600 s deadline with the session endpoint touched **zero** times. **Two runs were discarded rather than counted**, and that is the useful part: the first returned exit 0 at `elapsed_s: 0.2` because a throwaway profile had survived the previous session and nobody signed in — a cached session reading as a clean pass — and three attempts at the manual-close path all returned exit 0 while being the *auto-close* path in disguise, separable only by an **absent** `probe=in_context`. The manual path was obtained by widening the poll interval for one run so the competing branch could not fire; the 2FA path by killing the profile's own Chrome, because hand-timing lost every race on a host that completes passkey sign-in in ~15 s. **Recorded as NOT verified rather than omitted:** the migrated-host image slice (#692) was **re-run this cycle** — CLI `t2i` PASSED first-hand on a moved account, while the queued-MCP `i2i` twin failed with a typed non-retryable exit 27 whose **cause is unknown** — some dialog opened after the file was chosen and no `maseQ` left the page, on an account that has ALREADY consented, so the message's "most likely the one-time upload-terms dialog" does not fit; no incident bundle was written, so nothing names the dialog, and it is filed for a spike rather than guessed; the subprocess fallback is unit-tested only; and the OAuth-callback *mechanism* behind the poll fix is **inferred, not proven** — a host-only gate does not exclude NextAuth's callback, since it runs on the app's own origin, yet all four sign-ins passed under it, so #769 carries the spike that would settle it.) · previous: [LIVE_VERIFICATION_v0.71.1](LIVE_VERIFICATION_v0.71.1.md) (**two migrated-host error paths stopped blaming the wrong thing, 2026-09-08, $0 across three profiles.** The agent-mode recovery landed earlier in this same release (#749) and worked, but its first cut collapsed three outcomes into one message — chip clicked / chip found but click blocked / chip clicked and mode still on — so a modal eating the click sent users to toggle a chip that was never the problem, and genuine selector drift *after* the mode was left was filed under an account setting the driver had already changed. Verified by an e2e that drives the account INTO agent mode and carries its own neutered-selector control; run **twice**, because review fixes landed after the first run and it no longer covered the code. **The larger find:** an account's FIRST upload on this host is blocked by Flow's one-time *"Rights to use this image"* dialog, which renders *after* the file chooser hands the file over — so `_dismiss_dialog` never sees it and the driver spent 60 s waiting for a request the page had already declined to make, then advised re-encoding the image. Six runs on `ci-probe` close the chain: guard fires while the dialog is up → owner-authorised accept → uploads (`media_id 8914400f`) → fresh session uploads clean with `dialog: None`. The order was forced, because the dialog is one-off and accepting it destroys the failing state — so the guard was written and verified BEFORE anything was clicked, and its firing branch is now unrepeatable here. `maseQ` is confirmed **not** renamed (six uploads, three profiles), killing #719's top hypothesis. Also: Flow's queue listing is on **`Zzl0ze`**, not the `jwpduf`/`as29s` progress polls, and two `abra_r2v_8s` records sat at status 6 for ~20 h unseen by any CLI command (#741). Three documents are corrected rather than patched — a KNOWN_ISSUES entry that told #719's reader this dialog did not affect gflow-cli, and a v0.71.0 host label calling `ci-probe` *labs* when it is migrated, which helped a credit-based theory survive four runs. Recorded as NOT verified: #719's second failure shape — an upload request that leaves the page and is never answered, ~1 run in 4 — which is unfixed and keeps #719 open.) · previous: [LIVE_VERIFICATION_v0.71.0](LIVE_VERIFICATION_v0.71.0.md) (**`gflow character create --voice` verified end to end for the first time, 2026-09-07 on profile `ffroliva`.** Before this release a repo-wide grep for `--voice` across `tests/e2e/` matched **nothing** — every voice test was a unit test of the hardcoded `VOICES` constant and the one that looked live parsed a fixture, so a voice that silently failed to attach was invisible to the whole suite while the command exited 0. A live create + `character show` read-back settles a contradiction between two of our own documents: `sent='Charon' stored='Charon' identical=True`, so the Capitalized canonical form round-trips and `CHARACTER_RECON.md`'s "preset id is the lowercased name" does not describe today's wire. Both docs also now record that `personalityNotes` is **Agent-scoped** per Flow's own editor copy, not a control on the audio engine. **A claim that was in the code is overturned:** the `_unported_form` entity guard said the submit "never produces a reply" and that the backend refuses — in fact `MZZa6b` replies with a null payload and the generation is **accepted and queued** (Flow types it `abra_r2v_8s` and renders it); the failure is the *observer*, which waits out `SUBMIT_REPLY_BUDGET_S` (60 s, calibrated on 4.0–4.6 s replies against an idle queue) and exits 9 while the video is still rendering. The guard stays until the observer is fixed, because a timeout reported on a healthy generation is worse than an explicit refusal. Also verified: credit shortfall reports exit **37** with `_raise_if_out_of_credits` called from **both** give-up paths — and it is *short for the selected model*, not empty (the measured account held **50** and asked for `veo-quality`, which costs **100**); the "+ New project" CTA anchored structurally on `add` (Tier-1 matches **1** where every previous entry matched **0**, control 47 ligature nodes) after this same release first asserted the control did not exist and a $0 run disproved it in one click; and the incident-bundle DOM dump de-blinded — it queried `i.google-symbols` only, so **every bundle a migrated user sent carried an empty ligature list**, which is why #727 and #731 stayed invisible. One item recorded as NOT verified rather than omitted: whether a bound character's **voice reaches rendered audio** (#738) — attachment is proven, application is not, because no entity-bound generation has yet returned a file to measure. The blocker is no longer credits or account access but retrieval, and the measurement is pre-calibrated: plate-bound takes of one character gave **88 / 103 / 118 Hz** against a **4.3 Hz** engine noise floor, so an applied Algenib should sit near its sample's **163.3 Hz**.) · previous: [LIVE_VERIFICATION_v0.70.0](LIVE_VERIFICATION_v0.70.0.md) (**reference-to-video on the migrated `flow.google.com` host, verified 2026-09-06 on profile `denon82`.** Three r2v runs bound their references every time; the decisive one is semantic rather than structural — two hand-drawn reference images went in and the clip came back carrying the same marker strokes, face and paper texture, which is what separates "Flow bound the reference" from "Flow accepted and ignored it". A four-beat, two-character piece was then produced end to end and joined with the concat filter: 19.000s, 1280x576, `clip_qa` **ok**, A/V **+0.000s**, both actors recognisable across every cut from one face plate plus the canon repeated verbatim. Also verified as exit-code corrections on the real CLI: `-o ` now exits **2 in 0.8s** instead of exit 1 after ~2 min **and a billed, orphaned clip**; `character create` on a moved account exits **36 immediately** instead of a bare `RuntimeError` exit 1 after a 20s wait. Four items recorded as NOT verified rather than omitted: #692's original failure could not be reproduced [the reporter's own re-run was on a build without the fix, so it shows the failure is intermittent, not that the fix works]; Flow CHARACTER entities were never exercised because `character create` cannot run on any account available here; `image`/`scene`/`movie`/`extend` all exit 36 on the migrated host and no unmoved account exists here; and the sign-in-interstitial fidelity question from #699 has no bundle evidence either way.) · previous: [LIVE_VERIFICATION_v0.68.0](LIVE_VERIFICATION_v0.68.0.md) (`gflow update` self-upgrading a real `uv tool` and a real `pipx` install from their own running `gflow.exe` to the PyPI release, Windows 11, zero credits — see its own row below) · previous: [LIVE_VERIFICATION_v0.67.0](LIVE_VERIFICATION_v0.67.0.md) (the migrated `flow.google.com` driver — see its own row below) · previous: [LIVE_VERIFICATION_v0.64.0](LIVE_VERIFICATION_v0.64.0.md) (**#626 `--model omni-flash --end-frame` — first+last interpolation on Omni 1.1 Flash, verified 2026-09-02.** The guard this release removes was evidence-gated, so it was retired on evidence: a route-aborted submit capture on **two distinct Google accounts** (`ffroliva`, `denon82`) fired `video:batchAsyncGenerateVideoStartAndEndImage` with `startImage` AND `endImage` non-null at **zero credits**, ruling out a single-account artifact. The decisive layer is semantic, not structural: the paid 4s generation's **last frame IS the supplied end image** and its first frame is the start image — two visibly different subjects — which is the only check that distinguishes "Flow bound the end frame" from "Flow accepted and ignored it", and which layers 1–4 would pass either way. Render: 4.01s / 720×1280 / h264+aac / 2.4 MB, `MEDIA_GENERATION_STATUS_SUCCESSFUL`. The static capability table is **deleted**, not corrected — it went stale silently once and would again; a post-submit route check (`_assert_i2v_route`) now fails a run whose end frame Flow dropped back to the `StartImage` route, catching a rollback on any account without anyone re-reading a support page. One item is recorded as NOT verified rather than omitted: `--duration 10` + end frame is **submit-verified only** (`duration_set seconds=10` on the correct route with both images bound), because the status poll returned HTTP 401 mid-run and a retry 401'd at `project.create` before submitting — [#561](https://github.com/ffroliva/gflow-cli/issues/561), pre-existing, so verification was stopped rather than spending further credits on an environmental fault.) · previous: [LIVE_VERIFICATION_v0.63.0](LIVE_VERIFICATION_v0.63.0.md) (**`gflow video extend` — continuing a clip past Flow's 8s ceiling, verified 2026-09-01 on profile `ffroliva`, 20 Veo credits.** The decisive observation is that segment 2's `source_media_id` **is** segment 1's `media_id` (`0c9364f3…` seeded from `b9458021…`, then `648f9291…` seeded from `0c9364f3…`) — tail-only chaining, which no mock can establish; had it re-seeded from the source, the output would have been two divergent continuations of the same moment instead of one continuous shot. `extend_model_resolved` logged `candidate_count=99` against `SERVICE_TIER_INTERMEDIATE`, proving the key came from the live capability listing rather than a constant, and plan cost matched actual spend (`20 credits total, balance 875` → `Extended — 2/2 segment(s), 20 credits`). Render: 23.02s / 1280×720 / 24fps / h264+aac. **The run found a defect the offline suite is structurally incapable of seeing:** an extend segment carries **7.000000s** of content, not the 8 Flow advertises and bills, so server-side concat pads every internal seam with a frozen frame and digital silence (15s at −75.1 dB against −29 neighbours, reproduced on a second independent render) — filed in KNOWN_ISSUES with the three questions that must be answered before any clamp, and the reason `--extend N` on t2v/i2v was deliberately NOT shipped. Seven items are recorded as NOT verified rather than omitted: portrait `9:16`, `--aspect` against a mismatched source, chains longer than 2 segments, `--resume-from` against a live partial scene, the insufficient-credits refusal, a live Ctrl+C, and `OperationKind.EXTEND` rows.) · previous: [LIVE_VERIFICATION_v0.62.1](LIVE_VERIFICATION_v0.62.1.md) (**#604 `--model omni-flash` selects again after Flow's `Omni Flash` → `Omni 1.1 Flash` rename, verified 2026-08-30 on profile `ffroliva` at ZERO Veo credits.** The production `_select_video_model` was driven against the real picker: the shipped selector resolves verbatim — `model_selected model=omni_flash via="[role='menuitem']:has-text('Omni'):has-text('Flash'):not(:has-text('[Lower Priority]'))"` — and all six cases came back as expected: the four offered tiers SELECT, a tier Flow does not offer REFUSES, and a deliberately ambiguous selector REFUSES rather than resolving `.first`. Selection happens before submit, so the whole matrix is free. The transport's own refusal diagnostic read the live menu back as `Omni 1.1 Flash / Veo 3.1 - Lite / Fast / Quality`, independently corroborating the fixture. Four items are recorded as NOT verified rather than omitted: the rename *direction* [the `Omni Flash` baseline is a different account, locale and date], an actual `Omni ... [Lower Priority]` entry [Flow has never offered one], a full credit-spending generation on omni-flash, and #539's absence question, which stays open.) · previous: [LIVE_VERIFICATION_v0.62.0](LIVE_VERIFICATION_v0.62.0.md) (**#595 `auto` ≡ `classic` for images, verified 2026-08-28 on profile `ci-probe` — an account Flow had moved to the agentic cohort the day before — at ZERO Veo credits.** With no flags and no env vars the run logged `ui_driver.ui_mode.attempt_exit_agent` → `ui_driver.bound mode=classic ui_mode=classic` and generated a real 768x1376 JPEG (exit 0); the day before, the identical command on the same account bound `auto`→`agentic` and failed. The same log independently closed **#183**: `mode_switch_trigger` and `image_mode_tab`, the selectors it reported as unfindable, both matched. #591 was proven against the real 500-row catalog — **0** occurrences of the string `"None"`, 31 proper JSON `null`s, over a catalog holding 119 NULL-bearing rows. #592 shows exactly one `client.account_locale_cached` per command. Three items are recorded as NOT verified rather than omitted: the exit-28 abort on a *pinned* agentic account, the #597 batch inter-prompt guard, and any fresh announcement modal — the last two because all three accounts have already acked the current changelog, so no modal can be raised until Google ships the next one.) · previous: [LIVE_VERIFICATION_v0.61.0](LIVE_VERIFICATION_v0.61.0.md) (**#539 video-model refusal + #586 image-model refusal and server-side attribution, verified 2026-08-26/27 on profile `denon82`, ONE Veo generation total** — the video fix was proven by a **zero-credit A/B against the stashed pre-fix source running on live Flow**: the old code returned SELECTED for `veo-lite-lp`, a model Flow does not offer to this account, and for a deliberately ambiguous selector matching 3 entries; the new code refuses both with exit 18 naming what Flow offered. Model selection happens before submit, so refusals cost nothing and the A/B was free. The happy path still generates: `--model omni-flash` → exit 0, a real 2.2 MB `ftypisom` mp4, catalog recording `omni_flash`. Two items are recorded as NOT verified rather than omitted: three of #584's four navigation-settle sites were never exercised [no bearer refresh occurred in these runs], and #582's canary self-re-exec has its first real exercise tonight. Also falsified: #539's recorded note that the video picker uses a different trigger — the two constants are byte-identical strings, and the repeated empty menu captures were the capture's own fault.) · previous: [LIVE_VERIFICATION_v0.60.0](LIVE_VERIFICATION_v0.60.0.md) **"Was the playwright upper bound raised, and on what evidence?"** → [LIVE_VERIFICATION_playwright_1.61](LIVE_VERIFICATION_playwright_1.61.md) (**`>=1.59.0,<1.60.0` → `>=1.61.0,<1.62.0` verified 2026-08-05, 1 Imagen + 1 Veo credit** — the 2026-08-03 regression that motivated the bound does NOT reproduce on 1.61.0: a live `i2v` drove the full chain with `image_uploaded status=200` → `frame_attached` → `generate_captured status=200` with `startImage` parsed, where **1.62.0 hung silently at exactly that upload step**; live `i2i` local-ref attach passed outright [96.7s]. **1.62.0 stays excluded** — never root-caused. Also found, A/B-proven pre-existing on BOTH 1.59.0 and 1.61.0: Flow dropped the duration-tab UI, so **`--duration` is currently broken for i2v** — `UiSelectorDriftError` fires correctly [refusing rather than silently accepting Flow's default, #288] but the selector needs re-deriving; that is why the i2v proof was driven via the CLI without `--duration`, and Flow's own server-side `PUBLIC_ERROR_VIDEO_GENERATION_TIMED_OUT` means no finished mp4 is claimed). **"Where is the reverse-engineered wire protocol for a feature?"** → the `*_RECON.md` design docs: [CHARACTER_RECON](CHARACTER_RECON.md) (Flow character entity protocol), [IMAGE_UPSCALE_RECON](IMAGE_UPSCALE_RECON.md) (`/v1/flow/upsampleImage` wire). Naming convention: one `_RECON.md` per reverse-engineered surface, kept as the durable spec after the feature ships. Pre-capture research recons: [ASSET_TAGGING_RECON](ASSET_TAGGING_RECON.md) (`@`-mention asset tagging — shipped in v0.40.0, see [LIVE_VERIFICATION_v0.40.0](LIVE_VERIFICATION_v0.40.0.md)). **"What was live-verified for v0.66.1?"** → [LIVE_VERIFICATION_v0.66.1](LIVE_VERIFICATION_v0.66.1.md) — **the two migrated-origin fixes, verified 2026-09-03 on profile `ffroliva` at ZERO credits, on BOTH sides of what was then read as a flapping rollout** (superseded 2026-09-04: the handoff is a one-way per-account flag and exit 36 is non-retryable since). On a real `flow.google.com` load `get_ui_driver` raised `FlowHostMigratedError` in **0 ms** (was ~36 s: ~8 s detect window + ~24 s crop cascade + 4 s URL settle), exit 36, `retryable: true` (then; `false` since 2026-09-04), `ui_driver.migrated_host_bail` logged; `await_url_settled` returned `null` in **0 ms** (measured 4018 ms before); and the locale was recovered as `en` from `html lang=en-GB` where the URL gave `null`. The no-regression half is the stronger evidence: minutes later the same command landed on the OLD host and completed **exit 0** with a real 768x1376 JPEG in 42.2 s, proving the host guard is scoped and does not short-circuit the working path. Three items recorded as NOT verified rather than omitted: driving the migrated frontend (still impossible, #639 stays open), the pt-BR recovery live (measured `html lang=pt` on `denon82` but exercised live only on `en-GB`), and the `en-GB`→`en` region reduction against a locale where region is load-bearing (`zh-Hans`/`zh-Hant`) — only two locales observed. diff --git a/docs/LIVE_VERIFICATION_v0.106.0.md b/docs/LIVE_VERIFICATION_v0.106.0.md new file mode 100644 index 000000000..3b1efa510 --- /dev/null +++ b/docs/LIVE_VERIFICATION_v0.106.0.md @@ -0,0 +1,80 @@ +# Live verification — v0.106.0 + +Release ledger for v0.106.0, a minor release. It covers the experimental `direct_http` image +transport and the `transports` counter in the weekly usage report (#1442), the caption box +centring (#1431, PR #1444) and wrapping of text without spaces (#1446, PR #1447), `image batch` +failures on `flow.google.com` (#1452, PR #1454), the new-project click timeout (#1434, PR #1435), +the `docs/ERRORS.md` confirmation-required row (#1407, PR #1441) and the `--showlocals` +redaction test (#1429, PR #1440). + +## Environment + +| | | +|---|---| +| Profile | The default funded profile, served `flow.google.com`'s classic composer | +| Entrypoint | CLI, and the MCP worker for the queued direct run | +| OS | Windows 11 (NTFS), system Google Chrome (`channel=chrome`) | +| Tree | `chore/release-v0.106.0`, cut from `develop` `d8b1cbde`, version bumped to 0.106.0 (`gflow_cli.__version__` reads 0.106.0 from the release worktree) | +| Engine | playwright (default) | +| Veo credits spent | 4 (one Omni 1.2 generation, the release-tree `video t2v`); balance 466 before, 462 after; every other run is $0 | + +## Summary + +| Change | Surface | Verified live? | Cost | +|---|---|---|---| +| Quote probe before the release-tree run | `video t2v "" --model omni-1.2 --duration 4 --resolution 360p --count 1 --aspect 16:9 --max-credits 0 --json` | ✅ Exit 45, `CreditCapExceededError`, `quoted: 4`, `max_credits: 0`, `charged: no` | $0 | +| Release tree, default engine (live-verify step 0) | the same command with `--max-credits 4 --out-file t2v.mp4` | ✅ see "Release-tree run" below | 4 credits | +| `direct_http` image transport (#1442) | `tests/e2e/test_direct_image_e2e.py` and `tests/e2e/test_direct_image_worker_e2e.py`, `-m e2e`, `GFLOW_CLI_E2E_RUN_CHARACTER=1` | ✅ 9 passed in 548 s: plain t2i, three landscape images from one direct post, a model with no measured wire name and a catalogued reference routed to the UI transport, a named character, a bare `@Name` mention, a local file reference uploaded by one direct `maseQ` request, a `gflow run` row referencing an earlier row, and the MCP worker running a queued t2i on the direct transport | $0 | +| `transports` key accepted by the telemetry endpoint (#1442) | the deployed Worker (`wrangler deployments list`) | ✅ Version `dd82a998` from `dba6aeb` ("transports counter map"), 100% of traffic since 2026-11-23 09:45Z, before this release. The endpoint's own tests cover the key; a live upload carrying `transports` was not sent, because the live upload e2e asserts only `engines` and `hosts` | $0 | +| Caption box centring and wrapping (#1431, #1446) | `tests/e2e/test_video_captions_e2e.py`, `-m e2e` | ✅ 3 passed (installed CLI burns an authored SRT, the MCP tool burns inside the output directory, the default-endpoint error reaches CLI and MCP); 2 skipped: the transcription tests need a Whisper endpoint (`GFLOW_CLI_E2E_TRANSCRIBE_BASE_URL`) that is not configured here, and this release does not change transcription | $0 | +| `image batch` on `flow.google.com` (#1452) | `gflow image batch prompts.tsv --profile ` (one prompt) | ✅ Exit 36, `FlowHostMigratedError` with its hint on stdout, no traceback on stderr | $0 | +| New-project click timeout (#1434) | — | ❌ Not verifiable on demand: it needs Flow's create button to render and refuse the click. Covered offline in PR #1435 | — | +| `docs/ERRORS.md` row (#1407), redaction test (#1429) | documentation and a unit test | Not a Flow surface; the test passes in the suite below | — | + +### Release-tree run + +`gflow_cli.__version__` 0.106.0, the default funded profile, no `--project` (a fresh +project), no `GFLOW_CLI_MAX_CREDITS` in the environment, `--max-credits 4` set to the probed +quote. Exit 0 in 63 s, `MEDIA_GENERATION_STATUS_SUCCESSFUL`, request model `omni_1_2_flash` +(`omni-1.2` is a CLI alias of `omni-1.2-flash`), duration 4, count 1, landscape. The file is MP4 +(`ftyp mp42`), 1,484,597 bytes, h264 640x360 at 24 fps with an AAC audio stream, 4.03 s. +Stderr was empty. The charge (4) equalled the quote (4). + +### Caveats + +- **Windows, NTFS and an `en` account only.** +- **The direct transport ran on one funded account.** The account reserved for $0 runs was + signed in to Google but not to Flow on the day, so every run used the funded profile; image + generation costs no credits on either. + +## Pre-tag gates + +- `/gflow:check` on the release worktree, started on `develop` `d8b1cbde` (the version bump + landed while the suite ran; the version and manifest tests are re-run below): every repository gate passes + (hygiene, size, doc links, website PII, website mirror, council memory, plugin skills), + `ruff check` and `ruff format --check` are clean, `uv run pyright src` reports 0 errors, and + the default suite (`pytest -q -n 8 --dist worksteal`, not live, e2e or smoke) reports + 8249 passed, 38 skipped, 0 failed. `uv lock --check` passes. +- `/gflow:doc-review`: the mechanical pass is clean (`check_release_artifacts.py`, doc links, + repository hygiene, website mirror and PII, plugin skills; every version declaration site reads + 0.106.0). _Council verdict: YELLOW across all 3 auditors (completeness, cross-reference, drift), + no release-blocking finding. Fixed in the release prep:_ + - `docs/DIRECT_TRANSPORT.md` said a `gflow run` config could name `direct_http`; that route, and + `--transport direct_http`, also need `GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1` (the config is + refused with exit 11 without it). The doc now says so; the environment route needs nothing else; + - the same doc's "a sent request is never retried" now names its one exception, the redirect / + 401 / 403 resubmission through `ui_automation`, which its own failure table describes; + - the `--transport` help on `image upload`, `t2i` and `i2i`, and the `transport` setting's + description, list `direct_http` among the experimental transports; + - the CHANGELOG's pre-release note about the telemetry endpoint is replaced by the user-facing + fact: uploads pause in every region until the new notice is shown, and the endpoint accepts + the key. + + Deferred (Tier 3): `GFLOW_CLI_TRANSPORT` and `GFLOW_CLI_EXPERIMENTAL_TRANSPORTS` have no entry in + `.env.template` or `docs/CONFIGURATION.md` (both predate this release), the `image batch` section + of `docs/USAGE.md` does not repeat exit 36 from its exit table, and `docs/DIRECT_TRANSPORT.md` has + no website mirror page. + +## Post-tag evidence + +POST_TAG diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 58b3942bb..4cc8c15e3 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -6,6 +6,23 @@ ## Current release +**v0.106.0 — beta.** An experimental direct HTTP image transport, image transports in the weekly usage report, caption layout fixes, and typed errors for `image batch` and a new-project click timeout on flow.google.com. + +**Added.** +- **Experimental `direct_http` image transport (#1442).** With `GFLOW_CLI_TRANSPORT=direct_http`, an eligible image request on flow.google.com is one direct `ogiZ0b` request; the browser only mints the reCAPTCHA token and holds the session. Any other request runs on the UI transport before anything is sent. See [DIRECT_TRANSPORT](DIRECT_TRANSPORT.md). +- **Image transports in the usage report (#1442).** The weekly report counts runs by the image transport that made their images (`direct`, `ui`, `other`); the privacy notice moves to version 4. + +**Fixed.** +- **Captions (#1431, #1446).** The caption box is centred on the text ink, and text without spaces (CJK, long URLs) wraps between characters. Contributed by @rayw-lab (#1444, #1447). +- **`image batch` failures (#1452).** A flow.google.com account gets exit 36 with its hint instead of a traceback; a fail-fast stop lists the images already saved. Contributed by @rayw-lab (#1454). +- **New-project click timeout (#1434).** A create button that will not take the click is exit 23 with `charged: no` when no create request left the page. + +**Documentation and tests.** `docs/ERRORS.md` lists the confirmation-required envelope (#1407, @aryankalantri, #1441); the `--showlocals` redaction test ignores memory addresses (#1429, @aryankalantri, #1440). + +Full ledger: [LIVE_VERIFICATION_v0.106.0](LIVE_VERIFICATION_v0.106.0.md). + +
v0.105.1 — extend catalog rows, Flow's failure text, charge guidance + **v0.105.1 — beta.** A patch release: complete catalog rows after `video extend` on flow.google.com, Flow's own error text on a failed generation, the free recovery for a billed clip whose download fails, and charge guidance for extend and image-batch failures. **Fixed.** @@ -18,6 +35,8 @@ Full ledger: [LIVE_VERIFICATION_v0.105.1](LIVE_VERIFICATION_v0.105.1.md). +
+
v0.105.0 — characters from local images, no-replace publishing **v0.105.0 — beta.** Characters built from local images on flow.google.com, no-replace output publishing, and accurate charge reporting for pre-submit drift and multi-step video failures. @@ -1078,6 +1097,7 @@ migrated accounts (#795), and the agent-only composer driver (#799, #824 open). | Milestone | Status | |---|---| +| Experimental `direct_http` image transport on flow.google.com (one `ogiZ0b` request per run) and image transports in the usage report; caption layout fixes; typed errors for `image batch` and a new-project click timeout (#1442 #1431 #1446 #1452 #1434) | ✅ done (v0.106.0) | | Complete catalog rows and superseded local copies after `video extend` on flow.google.com; Flow's error text on a failed generation; the free recovery for a billed clip download; extend and image-batch charge guidance (#1299 #1111 #1159 #1416) | ✅ done (v0.105.1) | | `character create --image` / `--body-image` on flow.google.com with its MCP twin; no-replace output publishing; `charged: no` for labs pre-submit drift and accurate multi-step video charge reporting; secrets masked in pytest reports (#639 #1406 #1336 #1382) | ✅ done (v0.105.0) | | Local post-production (`audio narrate`, `video assemble`, `video transcribe`/`captions`), `media trash`/`restore`, `--max-credits` caps; the agent-only driver on Flow's 2026-11-20 build (#1357 #1359 #1358 #1363 #1355 #1387) | ✅ done (v0.104.0) | diff --git a/docs/TELEMETRY.md b/docs/TELEMETRY.md index 83eecc120..b78218b91 100644 --- a/docs/TELEMETRY.md +++ b/docs/TELEMETRY.md @@ -10,7 +10,7 @@ Counters are kept in `/telemetry.db`, separately from the catalo grouped by ISO week and retained for 53 weeks. gflow counts command and flag names, outcomes, coarse duration buckets, command transitions, crash fingerprints made from exception and code names, and generation details read from the local catalog. It also records the storage service category and MCP -client category, and, for runs that selected a browser engine, the engine and the Flow site that served them. Prompts, argument values and other free-form text are not used as counter keys. +client category, image transport, and, for runs that selected a browser engine, the engine and the Flow site that served them. Prompts, argument values and other free-form text are not used as counter keys. `gflow telemetry show` prints the current week's report as JSON, including its random per-week `report_id`; this is the report sent by the uploader. `gflow data stats` shows your own local usage @@ -35,6 +35,7 @@ counts. | `crashes` | Counts of code-only crash fingerprints by surface. A fingerprint contains exception class names, up to three gflow-cli function names, and a third-party package marker where relevant. | | `engines` | Counts of generation, project and catalog commands and queued jobs that selected a browser engine, by engine: `playwright`, `patchright`, or `other`. A run is counted when the engine is selected, so a launch that then fails (a missing patchright install, a locked profile) still counts, which is what sizes an engine-specific failure. `gflow auth` commands and runs that launch no browser are not counted. | | `hosts` | For the same runs, the Flow site that served them, as observed from the page address when a generation is routed: `labs` (labs.google), `flow` (flow.google.com), or `unknown` when the run routed no generation (for example a credits, project or character read, or a run that failed first). It records which site served a run and says nothing about what that site supports. | +| `transports` | Counts of runs that generated at least one image, by the transport that made it: `direct` (the experimental direct HTTP transport) or `ui` (UI automation); any other value counts as `other`. One run counts once, by its last image generation. A run that generated no image adds nothing. | | `tools` | Counts by packaged prompt-tool name and whether it expanded or left the prompt unchanged. Custom tools, including tools that shadow a packaged name, are counted only as `custom`. | ## What is never sent @@ -82,7 +83,7 @@ read your IP address or locale to make this decision, and never sends the timezo Local counters still work in the EU/EEA and remain on your device unless you consent. To allow weekly uploads, run `gflow telemetry on`; this records your choice locally in `/telemetry.consent`, together with the notice version you agreed to. When the -notice changes (version 3 added the browser engine and the Flow site), uploads stop until you run +notice changes (version 4 added image transport), uploads stop until you run `gflow telemetry on` again. Run `gflow telemetry off` to withdraw consent and stop counting and uploads. Environment kill switches still take precedence. @@ -119,13 +120,13 @@ the sender is `src/gflow_cli/telemetry_upload.py` in this repository. ## Notice -Notice version: 3 +Notice version: 4 ```text gflow sends weekly usage totals to improve it, and we share overall figures publicly and with -sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and -your country as a total. No ID, prompts, paths or account details. Each report is added to -totals and discarded. +sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used, +error codes, and your country as a total. No ID, prompts, paths or account details. Each +report is added to totals and discarded. Turn it off: gflow telemetry off, or set GFLOW_CLI_TELEMETRY=0 See exactly what is sent: gflow telemetry show. Full notice: gflow docs TELEMETRY ``` @@ -133,7 +134,7 @@ See exactly what is sent: gflow telemetry show. Full notice: gflow docs TELEMETR The notice shown in the EU/EEA: ```text -gflow can send weekly usage totals to help improve it; overall figures are shared publicly and with sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and your country as a total. No ID, prompts, paths or account details. Each report is added to totals and discarded. +gflow can send weekly usage totals to help improve it; overall figures are shared publicly and with sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used, error codes, and your country as a total. No ID, prompts, paths or account details. Each report is added to totals and discarded. In your region nothing is sent unless you agree: gflow telemetry on (undo: gflow telemetry off) See exactly what would be sent: gflow telemetry show. Full notice: gflow docs TELEMETRY ``` diff --git a/docs/superpowers/plans/2026-11-22-direct-http-image-transport/PLAN.md b/docs/superpowers/plans/2026-11-22-direct-http-image-transport/PLAN.md new file mode 100644 index 000000000..08b78094d --- /dev/null +++ b/docs/superpowers/plans/2026-11-22-direct-http-image-transport/PLAN.md @@ -0,0 +1,425 @@ +# Plan — Direct HTTP Image Transport + +**Status:** Gate 0, Phase 1, Phase 2 and Phase 3 implemented; Phase 4 deferred +**Branch:** `feature/direct-http-image-transport` (off `develop`) +**Spike evidence:** `chore/spike-direct-image-with-browser-token` — 5 commits proving +each component end-to-end. Findings doc: +[`docs/superpowers/spikes/2026-11-22-direct-image-gate0.md`](../../spikes/2026-11-22-direct-image-gate0.md) +Gate 0 findings: [`docs/superpowers/spikes/2026-11-22-direct-image-gate0.md`](../../spikes/2026-11-22-direct-image-gate0.md). + +## Goal + +Replace the browser-driven image generation path with direct HTTP calls for +text-to-image (T2I), in-project image-to-image (I2I), and character-mention +generations. The browser stays only for reCAPTCHA token minting. Everything +else — cookies, page tokens, frame building, the generation POST, the download +— is direct HTTP. + +**Why:** eliminates selector drift, locale sensitivity, and contenteditable +fragility for image generation. The UI transport clicks through a prompt editor, +waits for Angular renders, and parses a contenteditable document — the direct +path skips all of that. Latency improvement to be measured in Gate 0. + +--- + +## Architecture + +``` +┌───────────────────────────────────────────────┐ +│ CLI / MCP │ +│ generate_image(prompt, model, project, ...) │ +└──────────────┬────────────────────────────────┘ + │ FlowTransportStrategy.generate_images() + ▼ +┌──────────────────────────────────────┐ +│ DirectHttpTransport │ +│ │ +│ 0. can_serve(request)? │ ← route unsupported shapes to UI +│ 1. flow_wire session (reuse) │ ← cookies + at/fsid/bl already in flow_wire.py +│ 2. mint_recaptcha_token() │ ← page.evaluate() — ONLY browser step +│ 3. build_ogiz0b_frame(prompt, ...) │ ← pure function, no captured state +│ 4. httpx.post(batchexecute) │ ← reuse flow_wire's httpx + headers +│ 5. image_records(response) │ ← existing parser in batchexecute.py +│ 6. download signed URLs │ ← httpx, no cookies needed +└──────────────────────────────────────┘ +``` + +### Key reuse: `flow_wire.py` already exists + +`api/flow_wire.py` (#1229, #1363) already does direct batchexecute against +`flow.google.com` for credits reads and media mutations. It has: +- Cookie loading via `auth.cookies.read_cookies_for()` +- Page token scraping (`at`/`SNlM0e`, `fsid`/`FdrFJe`, `bl`/`cfb2h`) +- httpx POST to `/_/AiSandboxAngularFrontend/data/batchexecute` +- `parse_frames()` and `rpc_errors()` from `batchexecute.py` +- Fallback reason enum, structlog events, proxy detection, PSIDTS freshness + +**The direct image transport extends this infrastructure to the `ogiZ0b` RPC.** +No new cookie reader, no new token fetcher, no new httpx client. The only new +code is the frame builder (pure function) and the transport class that +orchestrates the existing pieces plus reCAPTCHA minting from the browser page. + +Inherited constraints from `flow_wire.py`: +- Skipped while any proxy is configured (`getproxies()`) +- macOS default-off unless `GFLOW_CLI_WIRE_READS=1` +- PSIDTS freshness: works ~1.5–2.5 h after a browser visit +- One account's failure never affects another + +### `can_serve()` gate — route before sending + +Before building a frame, check whether the request is in the proven surface: + +| Feature | can_serve? | Phase | +|---|---|---| +| Plain T2I, default aspect, count=1 | Yes (proven) | 1 | +| In-project I2I refs | Yes (format known) | 2 | +| Character mentions | Yes (format measured) | 2 | +| Non-default aspect ratio | **No until slot captured** | 2 (after T2.0) | +| Count > 1 | **No until semantics captured** | 2 (after T2.0b) | +| Local-file I2I (needs maseQ upload) | **No** | 4 (deferred) | + +A request outside the proven surface is routed to `ui_automation` **before any +POST**. This is not a fallback — it is the primary routing decision. The direct +path never sends a frame it cannot fully build. + +### Fallback policy + +Fallback to UI only on: +- **Pre-send:** `can_serve()` returns false (the common case while features are phased in) +- **Definitive rejection:** HTTP 403 (reCAPTCHA challenge) from the POST + +**No fallback on:** timeout, connection reset, HTTP 5xx. These are errors — log +them, raise, let the caller's retry/error path handle it. A timeout in +particular may mean the frame was billed. + +**Never retry a sent ogiZ0b** — it may have been billed. On any post-send failure, +return the error. + +--- + +## Proven in spike + +| Component | Evidence | Finding | +|---|---|---| +| On-disk cookie reading | SQLite parse → httpx POST succeeded | `d24f1952` | +| Programmatic frame (template swap) | Prompt + token swap → generation | `634a991c` | +| From-scratch frame builder | 12-slot minimum viable, `inner[4]` = `[uuid]` not `uuid` | `ee7fa2d7` | +| Slot optionality | Slots 12-14 optional | `16ab3d4b` | +| Predict verdict | GO (7.4/10) | — | + +## Open unknowns + +| Unknown | Cost to settle | When | +|---|---|---| +| Aspect ratio slot position | 1 capture ($0, non-default aspect) | Gate 0 | +| Count > 1 semantics (entry[4]) | 1 capture ($0, count=2) | Gate 0 | +| WAF escalation at N=10 consecutive | 10 images (~$0, Imagen) | Gate 0 | +| Direct-vs-UI latency comparison | Same N=10 run, logged | Gate 0 | +| `maseQ` direct upload for local-file I2I | Research + 1 test | Deferred | + +--- + +## Phased sequence + +### Gate 0 — WAF spike + settle unknowns (design validation) + +This gate can kill the design. Run it first, before any production code. + +- [ ] **G0.1 — WAF escalation spike.** Using the spike branch scripts, run N=10 + consecutive T2I generations via direct httpx POST against one profile. Log each + response status code, `mint_ms`, `post_ms`, `total_ms`. If Flow escalates + (429, challenge, block), document the threshold. **STOP if N<5 triggers a block.** + +- [ ] **G0.2 — Latency comparison.** In the same run, compare the N=10 direct times + against N=10 UI-transport times for the same prompt. This is the performance + case the user asked for. Record the numbers. + +- [ ] **G0.3 — Aspect ratio capture.** One generation ($0) with `--aspect 16:9`. + Diff the ogiZ0b frame against the default-aspect capture. Identify the slot. + +- [ ] **G0.4 — Count capture.** One generation ($0) with count=2. Confirm whether + entry[4] controls count. Note whether count=2 is one POST returning 2 images + or two separate POSTs. + +- [ ] **G0.5 — Write finding doc.** Consolidate all spike + Gate 0 results into + `docs/superpowers/spikes/2026-11-22-direct-image-with-browser-token.md`. + +**Gate 0 exit criteria:** WAF allows ≥5 consecutive, latency numbers recorded, +aspect and count slots identified or documented as unknowable. + +### Phase 1 — Core direct transport (T2I only) + +The smallest slice that works end-to-end: plain text-to-image with default +aspect and count=1. + +- [ ] **T1.1 — Frame builder.** `src/gflow_cli/api/transports/frame_builder.py`: + `build_ogiz0b_frame(prompt, model, project_id, recaptcha_token) -> str` — pure + function, builds the batchexecute body from scratch (12-slot minimum). No + captured templates, no file I/O. No optional parameters until their slots are + proven in Gate 0. Returns the full `f.req` form-encoded body ready for httpx. + +- [ ] **T1.2 — `can_serve()`.** A module-level function in `direct_http.py`: + `direct_can_serve(request: GenerateImageRequest) -> bool`. Returns `True` only + for plain T2I with default aspect and count≤1. Extended in Phase 2. + +- [ ] **T1.3 — DirectHttpTransport class.** + `src/gflow_cli/api/transports/direct_http.py`: implements + `FlowTransportStrategy.generate_images()`. Steps: + 1. `direct_can_serve(request)` — if false, raise `DirectTransportUnavailableError` + (the caller in `FlowApiClient` catches and routes to `ui_automation`) + 2. Acquire a `WireSession` from `flow_wire` (cookies + tokens, reusing the + existing infrastructure; add `ogiZ0b` to `_ALLOWED_RPCIDS` or factor out + the session acquisition) + 3. `page.evaluate("grecaptcha.enterprise.execute(site_key, {action})")` — the + browser `Page` comes from the existing `FlowApiClient` context + 4. `build_ogiz0b_frame(prompt, model, project_id, recaptcha_token)` + 5. httpx POST to `_BATCHEXECUTE` (reuse `flow_wire`'s headers and timeout pattern) + 6. `image_records(response)` → `list[GeneratedImage]` + 7. Download signed URLs via httpx + + The transport does NOT handle video, scene, or any non-image operation. Those + stay on `ui_automation` unconditionally. + +- [ ] **T1.4 — Transport registration.** Add `"direct_http"` to `_registry()` in + `transports/__init__.py`. Add to `EXPERIMENTAL_TRANSPORTS`. Do NOT add to + `STANDALONE_ONLY_TRANSPORTS` — it needs the FlowApiClient's browser for + reCAPTCHA minting. + +- [ ] **T1.5 — Tests (offline).** + - Frame builder: assert slot structure, project_id placement, `inner[4]` = `[uuid]` + - `can_serve`: true for plain T2I, false for refs/mentions/non-default aspect + - Transport orchestration: mocked wire session + mocked `page.evaluate` + mocked httpx + - BDD: "Given a valid profile, when I generate a T2I image with `--transport + direct_http`, then the image is generated via direct HTTP and saved to disk" + +- [ ] **T1.6 — E2E test.** `tests/e2e/test_direct_image_e2e.py`, marker `e2e_image` + ($0 tier). One T2I generation with `--transport direct_http`. Verify the asset + record's `metadata_json` contains `"transport": "direct_http"`. + +- [ ] **T1.7 — MCP parity.** The MCP `gflow_generate_image` tool calls + `generate_images()` on whatever transport is active. But the queued MCP path + goes through `FlowWorker`, which is different code from the CLI's direct call. + Add one MCP-path test that `direct_http` works through the worker. Verify the + returned schema matches the CLI path. + +### Phase 2 — Full image surface (I2I, mentions, aspect, count) + +Wire the features whose slots are now known from Gate 0. + +- [ ] **T2.1 — In-project I2I refs.** Wire `refs` parameter in the frame builder: + `entry[2] = [[media_id, null, null, null, 1], ...]` (format known from + research). Update `can_serve()` to accept requests with `reference_images`. + The `GenerateImageRequest.reference_images` already carries media IDs. + +- [ ] **T2.2 — Character mentions.** Wire `mentions` parameter: prompt doc changes + in `entry[8]` + entity IDs in `entry[10]`. Update `can_serve()`. The + `NameResolver` already resolves `@Character` to entity IDs. + +- [ ] **T2.3 — Aspect ratio.** Wire the slot discovered in G0.3. Map from the CLI's + `--aspect` values to the wire format. Update `can_serve()`. + +- [ ] **T2.4 — Count.** Wire the slot discovered in G0.4. Update `can_serve()`. + +- [ ] **T2.5 — Tests.** Unit tests for each new frame builder path. BDD scenarios: + I2I with in-project ref, character mention, non-default aspect, count=2. + One e2e test per new path (all $0 tier). + +### Phase 3 — Observability and hardening + +- [ ] **T3.1 — Telemetry.** Add `note_transport(kind: str)` to `telemetry.py` + following the `note_engine` / `note_host` pattern. Emit `("transport", + "direct")` or `("transport", "ui")` per generation. + +- [ ] **T3.2 — Structlog events.** Three events: + `direct.frame_built` (prompt hash, model, slot count), + `direct.image_post` (elapsed_ms, status_code), + `direct.fallback_to_ui` (reason). Via existing `structlog.get_logger()`. + +- [ ] **T3.3 — DataStore metadata.** Add `"transport": "direct_http"` to the + `metadata_json` dict in `data/_repo_assets.py::upsert_asset()`. No schema + migration — it is a JSON column. One line change. + +- [ ] **T3.4 — Performance fields.** Log `mint_ms`, `post_ms`, `total_ms` as + structlog fields on `direct.image_post`. These feed the comparison report + from Gate 0. + +- [ ] **T3.5 — Fallback wiring.** On HTTP 403 from the direct POST: log + `direct.fallback_to_ui`, raise `DirectTransportUnavailableError` so the + `FlowApiClient` routes to `ui_automation` for that generation. On timeout + or 5xx: raise the existing `NetworkError` — no fallback, the frame may have + been billed. + +- [ ] **T3.6 — Tests.** Fallback path test (mocked 403 → verify UI transport + invoked). Timeout test (mocked timeout → verify error, no fallback). + Performance field assertions. + +### Phase 4 — Local-file I2I via maseQ (deferred, follow-up issue) + +Local-file I2I (`--initial-frame local.png`) currently uploads via the browser. +The `maseQ` RPC is a separate upload with its own reCAPTCHA token. `can_serve()` +routes these to UI until this phase ships. + +- [ ] **T4.1 — Spike: maseQ direct upload.** +- [ ] **T4.2 — Upload module.** `upload_image_direct(file, cookies, tokens) -> media_id`. +- [ ] **T4.3 — Wire into DirectHttpTransport + update `can_serve()`.** +- [ ] **T4.4 — Tests.** + +--- + +## Concurrency, batch, and parallel execution + +Research findings from the codebase analysis: + +| Concern | Current state | Direct HTTP impact | +|---|---|---| +| **`gflow run` (batch)** | Sequential per prompt, calls `generate_images()` in a loop | Direct HTTP plugs in at the transport level — no loop changes. Each iteration mints its own reCAPTCHA token | +| **`gflow image batch`** | Sequential, same loop | Same — transport-level swap, no structural change | +| **`"ref": "batch:N"`** | In-batch cross-reference resolves to a media_id before the next generation | Works with direct HTTP — the returned `GeneratedImage` carries the media_id | +| **Local-file rows in batch** | Rows with a local `--initial-frame` need `maseQ` upload | Routes to UI via `can_serve()` until Phase 4. The batch loop already handles per-row transport decisions | +| **ProfileLease** | Per-profile, held by `FlowApiClient` | Unchanged — the browser stays open for reCAPTCHA minting, so the lease is still needed | +| **MCP per-profile lock** | `asyncio.Lock` per profile in the MCP server | Unchanged — serializes requests to the same profile | +| **Two processes, same profile** | ProfileLease prevents concurrent access | Unchanged | +| **Token minting** | `page.evaluate()` serializes naturally on one Page | One token per generation, sequential — no pooling | +| **Token expiry during long batches** | — | Tokens valid ~2 min; sequential minting per-call is fine | + +**Decision:** no structural changes to concurrency or batch. The direct transport +is a drop-in replacement at the `generate_images()` interface. The existing +serialization (ProfileLease, MCP lock, sequential batch loop) all work as-is. + +--- + +## New / touched files + +``` +src/gflow_cli/api/transports/ +├── frame_builder.py # NEW — ogiZ0b frame constructor (pure function) +├── direct_http.py # NEW — DirectHttpTransport + can_serve() +└── __init__.py # EDIT — register direct_http in _registry() + +src/gflow_cli/api/flow_wire.py # EDIT — factor out session acquisition or add ogiZ0b to allowed RPCs +src/gflow_cli/telemetry.py # EDIT — add note_transport() +src/gflow_cli/data/_repo_assets.py # EDIT — transport key in metadata_json (1 line) + +tests/ +├── transports/ +│ ├── test_frame_builder.py +│ └── test_direct_http.py +└── e2e/ + └── test_direct_image_e2e.py # e2e_image tier ($0) + +docs/ +├── superpowers/spikes/2026-11-22-direct-image-with-browser-token.md # Gate 0 findings +└── DIRECT_TRANSPORT.md # user-facing doc +``` + +No new cookie reader — reuse `auth.cookies.read_cookies_for()`. +No new token fetcher — reuse `flow_wire`'s page token scraping. +No new runtime deps — `httpx` and `sqlite3` (stdlib) are already present. + +--- + +## Risks and mitigations + +| Risk | Likelihood | Mitigation | +|---|---|---| +| WAF escalation on consecutive direct POSTs | Medium | **Gate 0** — measured before any production code | +| Cookie/PSIDTS expiry mid-batch | Low | Per-generation check; `DirectTransportUnavailableError` → route to UI | +| ogiZ0b frame format changes server-side | Medium | Frame builder is a pure function, easy to update; `image_records()` catches malformed responses | +| reCAPTCHA enterprise blocks `page.evaluate` | Low | Same mechanism the UI transport uses — if it breaks, both break | +| Double-send on billed op | High impact | Never retry a sent ogiZ0b; on timeout, raise error | +| Unsupported feature silently sent with defaults | High impact | `can_serve()` gate — route before POST, never after | +| `ImageGenerationRecord` vs `GeneratedImage` type mismatch | Medium | The direct path returns `GeneratedImage` (the DTO); verify the conversion matches what `ui_automation` returns | + +--- + +## Definition of Done + +- [ ] Gate 0 passed: WAF allows ≥5 consecutive, latency numbers recorded, aspect and count slots known. +- [ ] `gflow image t2i --transport direct_http "a cat"` generates via direct HTTP, saves to disk. +- [ ] In-project I2I (`--ref `) works via direct HTTP. +- [ ] Character mentions (`"a cat @Character"`) work via direct HTTP. +- [ ] `can_serve()` routes unsupported shapes (local-file I2I, unknown slots) to UI before POST. +- [ ] MCP `gflow_generate_image` with transport=direct_http works through the FlowWorker. +- [ ] `gflow run` (batch) works with direct_http — including `"ref": "batch:N"` cross-references. +- [ ] Telemetry records `transport: direct` / `transport: ui` in the weekly report. +- [ ] Fallback to UI on HTTP 403 is logged and works; timeout/5xx raises, no fallback. +- [ ] All quality gates: ruff, ruff format, pyright (0), pytest (≥80%), `/gflow:check`. +- [ ] E2E: `pytest -m e2e_image` passes with direct_http as the transport. +- [ ] Performance comparison: direct vs ui_automation over ≥10 runs, numbers in finding doc. +- [ ] `docs/DIRECT_TRANSPORT.md` written, indexed in `docs/INDEX.md`. +- [ ] Phase 4 (local-file I2I via maseQ) tracked as a follow-up issue. + +--- + +## Decisions + +1. **Gate 0 first.** WAF escalation is predict risk #1 and can kill the design. + Measure it before writing production code. + +2. **Reuse `flow_wire.py`.** No new cookie reader, no new token fetcher. The direct + image transport is a new RPC (`ogiZ0b`) on the existing wire infrastructure. + +3. **`can_serve()` gate.** Unsupported features route to UI before any POST. + The direct path never sends a frame it cannot fully build. + +4. **Experimental first.** Start behind `EXPERIMENTAL_TRANSPORTS` flag. Promote to + default after Gate 0 + 50 successful generations across profiles. + +5. **No local-file upload in v1.** `maseQ` is a separate RPC with its own + complexity. In-project I2I covers the common case; local-file deferred to + Phase 4 / follow-up issue. + +6. **Fallback is pre-send or definitive only.** A timeout or 5xx after the POST + is an error, not a fallback trigger — the frame may have been billed. + +7. **One reCAPTCHA token per generation.** No token pooling or pre-minting. + Sequential minting from the same page is reliable and simple. + +8. **Images only.** The direct transport implements `generate_images()` only. + Video, scene, and all other operations stay on `ui_automation` unconditionally. + `make_transport` picks one transport for the client, so the DirectHttpTransport + must delegate non-image operations to the UI transport (or the routing must + happen at the `FlowApiClient` level per-operation). + +9. **Hexagonal / DDD / Strategy pattern — no god classes.** + - The transport layer is a **port** (`FlowTransportStrategy` protocol) with + multiple **adapters** (`ui_automation`, `direct_http`, the experimentals). + Each adapter owns its own I/O; the domain (`GenerateImageRequest` → + `GeneratedImage`) stays transport-agnostic. + - The `can_serve()` gate is a **strategy selector**, not a monolith branch. + Each transport declares what it can serve; the routing layer picks the + right adapter per request. This is CQRS-adjacent: the read path (cookies, + tokens) is separated from the write path (frame build, POST). + - The frame builder is a **pure domain function** — no I/O, no state, no + browser dependency. It takes domain types in and returns wire bytes out. + - `flow_wire.py` is infrastructure — it stays behind the port boundary. + The direct transport calls it; it never calls the transport. + - No class accumulates unrelated responsibilities. If `DirectHttpTransport` + starts growing (upload, polling, download), split by responsibility along + the domain boundary, not by size. + - TDD with `/ub-mode` is the execution discipline. Failing test first, then + the smallest implementation that passes. If we hit errors: + `superpowers:systematic-debugging` — root cause before any fix attempt. + +--- + +## Execution record (2026-11-23) + +| Item | Outcome | +|---|---| +| Gate 0 | Passed: 10/10 consecutive direct POSTs; direct median 18.6 s vs UI 20.7 s; `entry[4]` is the aspect enum (1:1=1, 9:16=2, 16:9=3, 3:4=4, 4:3=5); count is N entries in one POST | +| Cookie source | The on-disk store is unreadable while Chrome holds the profile (`auth/cookies.py`), so the transport reads the live browser context; `flow_wire` supplies the shell tokens and user agent | +| Mint | `FlowApiClient`'s mint refuses the migrated host and uses the labs action, so the transport mints `IMAGE_GENERATION` itself and retries while reCAPTCHA loads | +| Model | `NARWHAL` is sent as `BELUGA` (#958); other models route to the UI transport | +| T2.1 / T2.2 | One in-project ref, or one character id with its name; both also ride as a chip in `entry[8]` | +| T3.3 | Recorded by the image recorder from `GeneratedImage.transport`, not by `upsert_asset` (which never sees the transport) | +| Live e2e | `tests/e2e/test_direct_image_e2e.py` (t2i, 16:9 x2, model routing, in-project I2I, character) and `test_direct_image_worker_e2e.py` (queued MCP path) pass on a `flow.google.com` profile | + +A bare `@Name` mention is served: the id is read from the project's own reply. +Count 1-4 is served (N entries returned N images live). `gflow run` rows go direct, `"ref": "batch:N"` included (measured live). A `--ref` found in the catalog stays on the UI path, which proves it still exists. Not served directly yet: several refs or characters, `gflow image batch` (its batch method is refused on flow.google.com on +every transport). The weekly telemetry field (T3.1) is not in this change: it went out for every +image user and needed a notice-version bump that stops EU/EEA uploads until re-consent, +so it ships together with the endpoint change. T3.3 (per-image metadata) is in. +Phase 4 is in: a local file is uploaded by one direct `maseQ` POST (frame and the +`UPLOAD_IMAGE` action captured from Flow's own upload; a direct upload returned the media id +live, and a fresh-file i2i uploaded and generated directly). diff --git a/docs/superpowers/spikes/2026-11-22-direct-image-gate0.md b/docs/superpowers/spikes/2026-11-22-direct-image-gate0.md new file mode 100644 index 000000000..65268fb37 --- /dev/null +++ b/docs/superpowers/spikes/2026-11-22-direct-image-gate0.md @@ -0,0 +1,140 @@ +# Spike: direct HTTP image transport — Gate 0 (WAF, latency, aspect and count slots) + +**Date:** 2026-11-22 · **Profile:** `denon82` (Flow served `flow.google.com`) +· **Base:** `chore/spike-direct-image-with-browser-token` (`ee7fa2d7`) +· **Cost:** 21 images (daily image quota, zero credits); captures $0 (route-aborted) +· **Script:** [`scripts/dev/spike_direct_image_gate0.py`](../../../scripts/dev/spike_direct_image_gate0.py) +· **Plan:** [`docs/superpowers/plans/2026-11-22-direct-http-image-transport/PLAN.md`](../plans/2026-11-22-direct-http-image-transport/PLAN.md) — Gate 0 +· **Raw evidence:** `scripts/dev/_spike_out/spike_direct_image_gate0_*.jsonl` (gitignored; tokens redacted to their length) + +## Question + +Before any production code: does Flow accept a run of consecutive direct `ogiZ0b` POSTs +built the way the transport would ship them, how does their latency compare with the UI +transport on the same profile, and which frame slots carry aspect ratio and image count? + +## Method + +One warm `FlowApiClient` on one project. Every direct POST has the shape that would ship: + +- frame built from scratch (no captured template), `inner[4] = [batch_uuid]`; +- `at` / `f.sid` / `bl` from `flow_wire._shell_tokens` (the shell GET the credits read uses); +- user agent from `flow_wire._user_agent` (the profile's Chrome major version); +- a fresh `IMAGE_GENERATION` reCAPTCHA token minted on the project page for every POST; +- one POST per generation, 120 s budget, never retried. + +The pre-registered readings are in the script's docstring. + +## Results + +### Finding 1 — the on-disk cookie store is unreadable while Chrome holds the profile + +Run 1 stopped before any POST: `auth.cookies.read_cookies_for()` raised +`CookieStoreUnreadable` with the browser open. This is the documented behaviour of that +reader (`src/gflow_cli/auth/cookies.py:333` probes the jar because Chrome holds it +exclusively on Windows). The direct transport needs the browser open to mint tokens, so +it **cannot** use the on-disk reader. Run 2 took the cookies from the live browser +context (`page.context.cookies(["https://flow.google.com"])`, 26 cookies); the first +spike had already shown Flow accepts those. + +### G0.1 — WAF escalation: none at N=10 + +| Measure | Value | +|---|---| +| Consecutive direct POSTs | 10 | +| HTTP 200 + image generated | **10 / 10** | +| RPC errors / refusals | 0 | +| Images per POST | 1 (768 x 1376, JPEG) | +| UI control run needed | no (no refusal occurred) | + +No 429, 403 or `UNUSUAL_ACTIVITY` at N=10 back-to-back on one profile. + +### G0.2 — latency, direct vs UI transport (same profile, prompt, model, project) + +| Arm | n | min | median | mean | max | +|---|---|---|---|---|---| +| Direct: mint + POST to reply | 10 | 16.7 s | **18.6 s** | 18.4 s | 21.4 s | +| — mint only | 10 | 0.12 s | 0.13 s | 0.15 s | 0.22 s | +| — download (signed URL, separate) | 10 | 0.68 s | 0.87 s | 0.87 s | 1.14 s | +| UI transport, warm: `generate_image` call to records | 10 | 19.0 s | **20.7 s** | 20.9 s | 22.9 s | + +The direct path is about **2.2 s (≈10 %) faster per warm image**. Server-side generation +dominates both arms. The arms ran back to back (direct first), not interleaved, so a +drift in Flow's own generation time between the two blocks is not excluded. The UI arm's +model is the same wire model: `NARWHAL` is sent as `BELUGA` on flow.google.com +(`_mc_common.py:535`). + +### G0.3 / G0.4 — aspect and count captures + +Four route-aborted captures ($0) of Flow's own `ogiZ0b` submit, driven through the real +UI transport on the same project (default, 16:9, count=2, default again): + +| Capture | POSTs | Entries in `inner[1]` | `entry[3]` | `entry[4]` | Other slots | +|---|---|---|---|---|---| +| default (9:16) | 1 | 1 | random int | **2** | — | +| 16:9 | 1 | 1 | random int | **3** | identical to default | +| count = 2 | 1 | **2** | a different random int per entry | 2 | identical; one shared `inner[4]` batch UUID | +| default again | 1 | 1 | random int | 2 | identical to the first | + +- **`entry[4]` is the aspect-ratio enum**, not the image count: portrait (9:16) is `2`, + 16:9 is `3`. The other three aspects (`SQUARE`, `4:3`, `3:4`) are not measured. +- **Count is the number of entries in `inner[1]`**, in ONE POST. Each entry carries its + own `entry[3]`, so that slot is per image (a seed-like value), not a session counter. +- The UI's entries carry three extra slots, `[12]`/`[13]` (two random UUIDs) and + `[14] = 4`. The 12-slot from-scratch entry is accepted without them (spike `16ab3d4b` + and the 10 POSTs above). + +A first capture run measured count = 1 for "count = 2" because it called +`generate_image`, which forces `count=1` (`_flow_generation.py:604`). The rerun above +uses `generate_images_batch`, the path that reaches Flow's x{N} selector. + +## Readings + +1. **The WAF does not escalate on 10 consecutive direct image POSTs** from one profile. + Gate 0's ≥ 5 criterion passes. +2. **Latency is a modest gain, not the case for the transport.** The case is robustness: + no selectors, no locale-sensitive DOM, no contenteditable prompt editor. +3. **Cookies come from the browser context, not the disk.** `read_cookies_for` cannot + serve this transport on Windows while the minting browser is open. +4. **`FlowApiClient`'s own mint cannot serve this transport.** `_mint_recaptcha_token` + calls `raise_if_migrated` first (`_flow_generation.py:424`) and defaults to the labs + action `imageGeneration`. The transport keeps `uses_page_owned_image_recaptcha() -> + True` and mints `IMAGE_GENERATION` on the project page itself. +5. **`flow_wire._execute_direct_rpc` cannot serve this transport.** Its 5 s total budget + is shorter than one generation, and it maps a timeout to a fallback reason, which the + plan forbids after send. The transport reuses `_shell_tokens` and `_user_agent` with + its own 120 s POST. + +6. **Phase 2 has its slots.** Aspect is `entry[4]` (two of five values measured); count + is N entries in one POST, each with its own `entry[3]`. Count > 1 on the direct path + is still unsent: whether Flow returns N images for N 12-slot entries is the first + Phase 2 measurement. + +### Phase 2 follow-up (same day, same profile and project) + +| Probe | Method | Result | +|---|---|---| +| Count = 2 on the direct path | one POST, two 12-slot entries, own `entry[3]` each | HTTP 200, **2 images**, 23.9 s | +| 16:9 on the direct path | one POST, `entry[4] = 3` | HTTP 200, **1376 x 768**, 18.0 s | +| 1:1 / 4:3 / 3:4 | route-aborted captures of Flow's submit ($0) | `entry[4]` = **1 / 5 / 4** | + +| In-project I2I (one `--ref`) | Flow's own submit, read by a passive request observer | `entry[2] = [[media_id, null, null, null, 1]]`; `entry[8]` starts with a chip `[null, [[media_id, display_name]]]`, then the text with **two** leading spaces | +| One `@Character` | the same | `entry[10] = [[entity_id]]`; `entry[8]` starts with a chip `[null, [null, null, [entity_id, name]]]`, then the text with **one** leading space | + +The referenced submits needed a passive observer: the UI transport routes its own image +submit to guard the reference, and that route runs before the spike's abort, so those two +submits reached Flow (two images, zero credits). A bare `@Name` mention resolves to the +character's name only (`reference_entity_names`); the composer picks the id in the browser. + +So the full `entry[4]` table is 1:1 = 1, 9:16 = 2, 16:9 = 3, 3:4 = 4, 4:3 = 5; 9:16 and +16:9 are proven by direct POSTs, the other three by capture only. + +**Gate 0 verdict: PASS.** WAF ≥ 5 consecutive (10/10), latency recorded, aspect and +count slots identified. + +## What was not measured + +- Escalation beyond N=10, across several profiles, or over a long batch. +- Interleaved direct/UI timing, and cold-start timing (first generation of a process). +- Whether the on-disk cookies work on macOS or Linux with Chrome open (Windows only here). +- I2I references, character mentions, non-default aspect on the direct path (Phase 2). diff --git a/docs/superpowers/spikes/2026-11-22-error-rate-telemetry-w46.md b/docs/superpowers/spikes/2026-11-22-error-rate-telemetry-w46.md new file mode 100644 index 000000000..71a62222e --- /dev/null +++ b/docs/superpowers/spikes/2026-11-22-error-rate-telemetry-w46.md @@ -0,0 +1,103 @@ +# Error rate in the first telemetry week: what the totals do and do not show + +**Date:** 2026-11-22 +**Data:** the endpoint's `totals` table, week 2026-W46 (9–15 Nov): 19 reports, 11,053 commands +**Cost:** $0. Code reading, one offline repro and one read-only D1 query. No browser, no generation. +**Harness:** `scripts/dev/spike_create_click_timeout.py`; the export is kept in the gitignored +`scripts/dev/_spike_out/telemetry_totals_2026-11-22.json`, produced by: + +``` +wrangler d1 execute gflow-telemetry --remote --json \ + --command "SELECT week, field, key, n FROM totals ORDER BY week, field, n DESC" +``` + +**Line references** are to `develop` at `4cf71cab`, the tree the spike read, before the fix. + +## Finding 1: a report carries the version that uploaded it, not the one that ran + +`telemetry.py:1088` stamps `"version": __version__` when the report is built, and the endpoint +builds `x:version_exit` from that field (`gflow-telemetry-endpoint/src/index.ts:245`). A W46 +report is sent during W47, so each exit is attributed to the version installed at upload time. +That version is an upper bound on the one that ran. + +v0.101.2 was tagged on 2026-11-17, after W46 closed, so no W46 command ran on it. The four +installs reporting v0.101.2 ran W46 on v0.100.0 or earlier and upgraded before their report +went out. Those four installs account for: + +| | v0.101.2 reporters (4) | all 19 reporters | +|---|---|---| +| commands | 6,470 (59 %) | 11,053 | +| exit 7 | 804 | 841 | +| exit 23 | 144 | 145 | +| exit 1 | 503 | 873 | + +The error groups are concentrated in four heavy, quickly-upgrading installs, not spread across +releases. A per-release error rate needs the version recorded with each counter, which is a +client change. + +## Finding 2: a Create click that times out escapes `create_project` unwrapped (exit 1) + +The largest crash group is `TimeoutError <- <- …rpc_reply <- …create_project`: +457 crashes in `migrated_composer:_rpc_reply` (the module before the move) and 5 in +`_mc_common:rpc_reply`, so the path existed on `4cf71cab`. + +**Resolved by #1434:** the click now runs in `_click_create` under a request watch for +`jHPbke`. No request, even after a 1 s grace: exit 23, `charged: no`. A request left the page: +the reply wait and the outcome-unknown recovery decide. + +`rpc_reply` (`_mc_common.py:1598-1609`) wraps only the `asyncio.wait_for` timeout into +`TransportTimeoutError`. The action it awaits first is the Create click, +`button.click(timeout=15_000)` (`migrated_composer.py:719`). v0.96.1 has the same structure. + +`spike_create_click_timeout.py` drives `rpc_reply` with an action that raises Playwright's +`TimeoutError`. It escapes as `playwright._impl._errors.TimeoutError`, which is not a subclass +of the builtin `TimeoutError`. `create_project` catches only `RpcResponseUnavailableError` and +`TransportTimeoutError`, so the exception reaches the unhandled-error path: exit 1 and an +incident capture with no remediation. + +`image t2i` creates a project when neither `--project` nor `GFLOW_CLI_PROJECT` is set +(`cli_image.py:355-361`). In W46, 4,149 of 5,027 `image t2i` runs passed no `--project`; that is +an upper bound on creations, since the setting is invisible to the flag counter. + +**Not shown:** why the button stopped being clickable, and whether a `jHPbke` request left the +page before the timeout. A retry is safe only if no `jHPbke` request was sent, and that has to +be observed, not inferred from the exception type. + +## Finding 3: exit 7 has two classes, and `create_project` reaches both on three branches + +`EXIT_CODE_MAP` gives exit 7 to `WireFormatError` and, by inheritance, to +`RpcResponseUnavailableError`, a write whose reply body the page could not read (#992, #1009). +`create_project` ends in exit 7 when: + +- the reply carries no project id (`migrated_composer.py:758`); +- the reply is lost or late and no navigation to a new project is seen, the "outcome unknown" + branch built by `_write_outcome_unknown` (`migrated_composer.py:727-748`); +- the same lost-reply branch in the rename that follows (`migrated_composer.py:811-812`). + +These are candidates, not an attribution: `WireFormatError` is raised from 20 modules, and +`image upscale` (63) exits 7 without creating a project. The totals carry no route, so the +share of the 723 `image t2i` exit-7s that come from project creation is **unmeasured**. + +## Finding 4: bare `gflow` is a telemetry artefact of `--verbose` (#1209) + +226 of the 230 `cli|gflow` commands carry `--verbose`. Their durations run past 5 minutes and +their neighbours in `transitions` are `video upscale` and `credits user`, so they are real +commands. Before v0.100.0 the flag-width helper counted `--verbose` as taking a value and +swallowed the subcommand name (`cc3ef3a5`, #1203/#1209). The command name is lost; the 47 +exit-11 results under `gflow` are still `ConfigurationError`s (a class that includes +`ProfileLockedError`), on unknown commands. + +## Finding 5: the update notice is CLI-only and outcome-blind + +`maybe_notify_update()` runs in the root group callback (`cli.py:225-228`), before the command, +from a once-a-day PyPI cache. A failure never mentions a newer version, and an MCP client never +sees the notice. + +## Open items + +| Open item | Evidence that settles it | +|---|---| +| Source of exit 7 on `image t2i` and `image upscale` | the error `route` recorded with the exit, or a reporter's incident capture | +| Whether exit 23 is #1312 (English count label, fixed in v0.100.1) | country or locale crossed with exit; note that v0.96.1 carries the same selector and its 5 installs show no exit 23 | +| Why the Create button is not clickable | `elementFromPoint` over the button and a dialog inventory at the moment the click times out | +| Per-release error rate | the version recorded with each counter, not the report | diff --git a/docs/superpowers/spikes/2026-11-22-t2i-warm-vs-cold-timing.md b/docs/superpowers/spikes/2026-11-22-t2i-warm-vs-cold-timing.md new file mode 100644 index 000000000..574400eb3 --- /dev/null +++ b/docs/superpowers/spikes/2026-11-22-t2i-warm-vs-cold-timing.md @@ -0,0 +1,58 @@ +# How much of an `image t2i` run is startup? + +**Date:** 2026-11-22 · **Profile:** one account served `flow.google.com` +**Cost:** image quota only: 10 one-image generations (one from a run whose harness failed to +parse the output), no credits. Each project-creating sample left one empty project. +**Script:** [`scripts/dev/spike_t2i_warm_vs_cold.py`](../../../scripts/dev/spike_t2i_warm_vs_cold.py) + +## Question + +Would routing CLI commands to an already-warm browser (the MCP server's long-lived worker) +remove enough of a text-to-image run to be worth building? And is project creation a large +enough share of a run to justify a page-free create? + +## Method + +Three arms on one profile, N = 3 each, run in blocks (the warm arm holds the profile lease, so +a subprocess on the same profile cannot run alongside it): + +- **warm:** one `FlowApiClient` entered once, then three `generate_image` calls into one project; +- **cold_reuse:** `gflow image t2i ... --project ` as a subprocess, timed end to end; +- **cold_create:** the same subprocess with no `--project`, so it creates a project first. + +The thresholds were written in the script's docstring before the first run. + +## Results + +| Arm | Samples (s) | Median (s) | +|---|---|---| +| warm, per call | 20.3, 17.6, 17.7 | 17.7 | +| cold_reuse | 28.6, 28.0, 37.3 | 28.6 | +| cold_create | 29.6, 43.8, 31.4 | 31.4 | +| warm client entry (Chrome start, Flow load), once | 6.2 | | + +- `warm / cold_reuse` = **0.62**. +- `cold_create - cold_reuse` = **2.8 s**. + +## Readings + +- **A warm worker removes about 11 s of a 29 s run (about 38 %).** The ratio sits in the + pre-registered 0.6–0.85 band: worth building only with another reason, such as fewer Chrome + launches and profile leases per session. With N = 3 and the ratio 0.02 above the lower + threshold, the speed case is **not settled** by this run. +- **Project creation costs 2.8 s,** under the 5 s threshold. A page-free `jHPbke` create is + not worth building for speed. Its case is reliability, which the typed click-timeout + handling (#1434) already addresses on the page path. +- **The warm arm has no production counterpart today.** The worker opens a new + `FlowApiClient`, and so a new Chrome, for every task (`worker/daemon.py:220`), by design: + the daemon holds no browser or profile lease while idle (D3, `ui/app.py:47-51`). Routing a + CLI command to today's worker would pay the same cold start plus a queue round trip. The + one path that already keeps one browser across many generations is `gflow run` + (`cli_run.py:326-331`). + +## Not measured + +- Where the 11 s goes inside a cold run (interpreter start, imports, lease, Chrome, Flow + load, download, teardown): the arms time the whole command. +- Variance across accounts, hours and Flow load: one profile, one sitting. +- The worker's real queued path. diff --git a/lhm.plugin.json b/lhm.plugin.json index 5d36456db..5a7ea7a40 100644 --- a/lhm.plugin.json +++ b/lhm.plugin.json @@ -1,7 +1,7 @@ { "identifier": "ffroliva-gflow-cli", "name": "gflow-cli", - "version": "0.105.1", + "version": "0.106.0", "author": "ffroliva", "authorUrl": "https://github.com/ffroliva", "homepage": "https://ffroliva.github.io/gflow-cli/", diff --git a/plugins/gflow/.claude-plugin/plugin.json b/plugins/gflow/.claude-plugin/plugin.json index bf2973d7c..c1448d7c2 100644 --- a/plugins/gflow/.claude-plugin/plugin.json +++ b/plugins/gflow/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "gflow", "displayName": "gflow-cli", - "version": "0.105.1", + "version": "0.106.0", "description": "Drive Google Flow from your agent: Veo 3.1 and Omni text-, image- and reference-to-video, clip extension, Nano Banana and Imagen images, reusable Characters and scene composition.", "author": { "name": "Flavio Oliva", diff --git a/pyproject.toml b/pyproject.toml index 7d3b16753..182fe891e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gflow-cli" -version = "0.105.1" +version = "0.106.0" description = "MCP server and CLI for Google Flow: generate Veo 3.1 and Omni video and Nano Banana and Imagen images from Claude, Cursor, Codex or the terminal." readme = "README.md" license = { file = "LICENSE" } @@ -123,7 +123,7 @@ dev = [ "pytest>=8.0.0", "pytest-asyncio>=0.23.0", "pytest-xdist>=3.6", - "ruff==0.17.5", + "ruff==0.17.6", "pyright>=1.1.0", # video-chain: the last-frame extractor (media.py) decodes with PyAV, and its # tests build synthetic mp4 fixtures with numpy. Declared here so the dev/CI @@ -297,7 +297,7 @@ dev = [ "pytest-bdd>=8.1.0", "pytest-cov>=7.1.0", "pytest-xdist>=3.6", - "ruff==0.17.5", + "ruff==0.17.6", ] # Container-based integration tests — requires Docker daemon. # Install: uv sync --group containers diff --git a/scripts/dev/spike_create_click_timeout.py b/scripts/dev/spike_create_click_timeout.py new file mode 100644 index 000000000..3382adf6f --- /dev/null +++ b/scripts/dev/spike_create_click_timeout.py @@ -0,0 +1,63 @@ +r"""Does a Create click that times out escape ``rpc_reply`` unwrapped? ($0: no browser, offline) + +Context: the largest crash group in the first telemetry week is +``TimeoutError <- <- rpc_reply <- create_project``. ``rpc_reply`` wraps only the +``asyncio.wait_for`` timeout into ``TransportTimeoutError``; ``create_project`` passes +``button.click(timeout=15_000)`` as its action, and catches only ``RpcResponseUnavailableError`` +and ``TransportTimeoutError``. This spike drives ``rpc_reply`` with a page stand-in whose action +raises Playwright's own ``TimeoutError``, the exception a real click timeout raises. + +Pre-registered reading: + +* escapes as ``playwright...TimeoutError``: the click timeout reaches the unhandled path + (exit 1). +* escapes as ``TransportTimeoutError``: it is wrapped; the crash group needs another cause. +* Playwright's class subclasses the builtin ``TimeoutError``: ``wait_for``'s handler could + catch it; re-read the frame. + +This drives ``rpc_reply`` alone, so it reports the escape even after #1434: since then +``create_project`` catches the click timeout in ``_click_create`` before ``rpc_reply`` sees it. + +What this does not show: why the button was not clickable, and whether a ``jHPbke`` request +left the page before the timeout. Those need a live capture at the moment of the timeout. + + uv run python scripts/dev/spike_create_click_timeout.py +""" + +from __future__ import annotations + +import asyncio +from typing import Any + +from playwright.async_api import TimeoutError as PlaywrightTimeoutError + +from gflow_cli.api.transports._mc_common import rpc_reply + + +class _Page: + url = "https://flow.google.com/" + + def on(self, event: str, handler: Any) -> None: + del event, handler + + def remove_listener(self, event: str, handler: Any) -> None: + del event, handler + + +async def _click_times_out() -> None: + raise PlaywrightTimeoutError("Timeout 15000ms exceeded (locator.click)") + + +async def main() -> None: + print( + "Playwright TimeoutError subclasses builtin:", + issubclass(PlaywrightTimeoutError, TimeoutError), + ) + try: + await rpc_reply(_Page(), "jHPbke", _click_times_out, timeout_s=5, write=True) # pyright: ignore[reportArgumentType] + except Exception as exc: # noqa: BLE001 - the class that escapes is the observation + print("escaped as:", f"{type(exc).__module__}.{type(exc).__name__}") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/scripts/dev/spike_direct_image_gate0.py b/scripts/dev/spike_direct_image_gate0.py new file mode 100644 index 000000000..e23932241 --- /dev/null +++ b/scripts/dev/spike_direct_image_gate0.py @@ -0,0 +1,486 @@ +r"""Gate 0 for the direct HTTP image transport: WAF escalation, latency, aspect and count slots. + +Plan: docs/superpowers/plans/2026-11-22-direct-http-image-transport/PLAN.md (Gate 0). + +The POST is the shape that would ship, not a replay: + - frame built from scratch (no captured template; ``inner[4] = [uuid]``) + - cookies from the profile's on-disk store, read WHILE Chrome holds the profile + - ``at``/``f.sid``/``bl`` from flow_wire's own shell GET (``_shell_tokens``) + - UA from ``flow_wire._user_agent`` (the profile's Chrome major version) + - a fresh ``IMAGE_GENERATION`` reCAPTCHA token minted on the page for every POST + - one POST per generation, 120 s budget, never retried (a sent ogiZ0b may be billed) +``flow_wire._execute_direct_rpc`` is NOT used: its 5 s total budget is shorter than an +image generation (16-20 s measured), and it maps a timeout to a fallback reason. + +Phases (one warm FlowApiClient, one fresh project): + G0.1 N consecutive direct POSTs. On the first non-generation, ONE UI generation runs as + a control (separates WAF escalation from the daily image cap / a profile-wide + refusal) and the direct loop stops. + G0.2 N UI-transport generations, same prompt and model (NARWHAL -> wire BELUGA), timed + on the same span as the direct arm: call -> image records. Download is timed + separately for direct and not at all for UI (generate_image does not download). + G0.3/4 route-aborted captures ($0) driven through the real UI transport: default, + 16:9, count=2, then default again to reset the sticky settings pane. Every ogiZ0b + POST is kept, so "count=2" can be read as one POST with N entries, N POSTs, or a + scalar slot. + +Cost: up to 2N+1 images (daily image quota, zero credits). Captures are $0. + +Pre-registered readings (written before the run): + | Outcome | Reading | + |-------------------------------------------|----------------------------------------------| + | 10/10 direct generated | no escalation at N=10; Gate 0 WAF passes | + | first refusal at i>=5, UI control OK | escalation threshold ~i on the direct path; | + | | passes (>=5) but the threshold is a design | + | | input (pacing / fallback) | + | first refusal at i<5, UI control OK | direct path is escalated early: STOP Gate 0 | + | refusal and the UI control also refused | profile-wide (cap / account), not the direct | + | | path: WAF question UNMEASURED, rerun later | + | disk cookie read fails with Chrome open | design finding: production cannot read the | + | | store while the browser holds it | + | HTTP 429 / 403 / UNUSUAL_ACTIVITY | WAF signal; record status + reasons verbatim | + | capture: aspect slot differs vs default | that slot carries aspect; record its values | + | capture: no ogiZ0b for a setting | unmeasured, not "no slot" | +""" + +from __future__ import annotations + +import argparse +import asyncio +import contextlib +import json +import os +import secrets +import sys +import time +import uuid +from pathlib import Path +from typing import Any +from urllib.parse import parse_qs, urlencode + +sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "src")) +sys.path.insert(0, str(Path(__file__).resolve().parent)) + +import httpx # noqa: E402 + +from gflow_cli.api.flow_wire import _shell_tokens, _user_agent # noqa: E402 +from gflow_cli.api.image import Aspect, GenerateImageRequest, ImageRef # noqa: E402 +from gflow_cli.api.recaptcha import TokenMinter, discover_site_key # noqa: E402 +from gflow_cli.api.transports.batchexecute import ( # noqa: E402 + image_records, + parse_frames, + rpc_errors, +) +from gflow_cli.auth.cookies import read_cookies_for # noqa: E402 + +from _spike_common import ( # noqa: E402, isort: skip + build_client, + default_out_path, + resolve_profile_dir, + step, +) + +_ORIGIN = "https://flow.google.com" +_BATCHEXECUTE = f"{_ORIGIN}/_/AiSandboxAngularFrontend/data/batchexecute" +_RPCID = "ogiZ0b" +_MODEL = "BELUGA" +_ACTION = "IMAGE_GENERATION" +_PROMPT = "a lighthouse on a rocky coast under a stormy sky, ink and watercolor" + +_records: list[dict[str, Any]] = [] + + +def _log(tag: str, **data: Any) -> None: + rec = {"ts": time.strftime("%H:%M:%S"), "tag": tag, **data} + _records.append(rec) + step(tag, json.dumps(data, default=str)) + + +def _ms(t0: float) -> int: + return round((time.perf_counter() - t0) * 1000) + + +# Phase 2 probes (--direct-entries / --direct-aspect): the Gate 0 captures showed count is N +# entries in one POST (each with its own entry[3]) and aspect is entry[4] (2 = 9:16, 3 = 16:9). +_FRAME = {"entries": 1, "aspect": 2} + + +def build_frame(prompt: str, model: str, project_id: str, token: str) -> list[Any]: + """The proven from-scratch ogiZ0b payload (spike ee7fa2d7).""" + ctx: list[Any] = [None, 22, None, None, None, project_id, None, None, None, None, [token, 1]] + entries = [ + [None, None, None, 1 + secrets.randbelow(2**31 - 1), _FRAME["aspect"], model, None, + list(ctx), [[[prompt]]], None, None, None] + for _ in range(_FRAME["entries"]) + ] + return [None, entries, 1, ctx, [str(uuid.uuid4()).upper()]] + + +def _redact(node: Any) -> Any: + """Replace long strings (reCAPTCHA tokens) with their length, recursively.""" + if isinstance(node, str) and len(node) > 300: + return f"" + if isinstance(node, list): + return [_redact(x) for x in node] + return node + + +async def direct_once( + i: int, + *, + minter: TokenMinter, + project_id: str, + tokens: Any, + headers: dict[str, str], +) -> bool: + t0 = time.perf_counter() + token = await minter.mint(_ACTION) + mint_ms = _ms(t0) + payload = build_frame(_PROMPT, _MODEL, project_id, token) + body = urlencode({ + "f.req": json.dumps([[[_RPCID, json.dumps(payload, separators=(",", ":")), None, + "generic"]]]), + "at": tokens.at, + }) + query = {"rpcids": _RPCID, "source-path": f"/project/{project_id}", "bl": tokens.bl, + "f.sid": tokens.fsid, "hl": "en", "_reqid": str(1000 + secrets.randbelow(9000)), + "rt": "c"} + url = f"{_BATCHEXECUTE}?{urlencode({k: v for k, v in query.items() if v})}" + post_headers = { + **headers, + "content-type": "application/x-www-form-urlencoded;charset=UTF-8", + "x-same-domain": "1", "origin": _ORIGIN, "referer": f"{_ORIGIN}/project/{project_id}", + "sec-fetch-site": "same-origin", "sec-fetch-mode": "cors", "sec-fetch-dest": "empty", + } + t1 = time.perf_counter() + try: + async with httpx.AsyncClient(follow_redirects=False, trust_env=False, + timeout=httpx.Timeout(120.0, connect=10.0)) as hx: + resp = await hx.post(url, content=body, headers=post_headers) + except httpx.HTTPError as exc: + _log("direct", i=i, verdict="TRANSPORT_ERROR", error=type(exc).__name__, + mint_ms=mint_ms, post_ms=_ms(t1), total_ms=_ms(t0)) + return False + post_ms = _ms(t1) + errors = rpc_errors(resp.text) if resp.status_code == 200 else [] + recs = [] + if resp.status_code == 200: + for rid, data in parse_frames(resp.text): + if rid == _RPCID: + with contextlib.suppress(Exception): + recs.extend(image_records(rid, data)) + total_ms = _ms(t0) + dl: dict[str, Any] = {} + if recs and recs[0].image_url: + t2 = time.perf_counter() + try: # a failed download must not lose the record of a generation that happened + async with httpx.AsyncClient(timeout=30.0, trust_env=False) as hx: + img = await hx.get(recs[0].image_url) + dl = {"dl_ms": _ms(t2), "dl_status": img.status_code, + "dl_bytes": len(img.content), "magic": img.content[:4].hex()} + except httpx.HTTPError as exc: + dl = {"dl_ms": _ms(t2), "dl_error": type(exc).__name__} + _log("direct", i=i, status=resp.status_code, + verdict="GENERATED" if recs else ("REJECTED" if errors else "EMPTY"), + images=len(recs), dims=[f"{r.dimensions[0]}x{r.dimensions[1]}" for r in recs], + errors=[{"code": e.code, "reasons": list(e.reasons)} for e in errors], + head=None if recs or resp.status_code == 200 else resp.text[:300], + mint_ms=mint_ms, post_ms=post_ms, total_ms=total_ms, **dl) + return bool(recs) + + +async def ui_once(tag: str, i: int, client: Any, project_id: str, **req_kw: Any) -> bool: + t0 = time.perf_counter() + try: + img = await asyncio.wait_for( + client.generate_image(project_id=project_id, + req=GenerateImageRequest(prompt=_PROMPT, **req_kw)), + timeout=300, + ) + except Exception as exc: # noqa: BLE001 - a spike records every failure class + _log(tag, i=i, verdict="FAILED", error=type(exc).__name__, detail=str(exc)[:200], + total_ms=_ms(t0)) + return False + _log(tag, i=i, verdict="GENERATED", total_ms=_ms(t0), + dims=f"{img.dimensions[0]}x{img.dimensions[1]}", aspect=img.aspect_ratio) + return True + + +async def capture(label: str, client: Any, project_id: str, **req_kw: Any) -> None: + page = client._page # noqa: SLF001 - spike-only + bodies: list[dict[str, Any]] = [] + + async def on_route(route: Any) -> None: + req = route.request + # Run 2 measured: post_data is a strict utf-8 decode and raises on binary bodies. + data = (req.post_data_buffer or b"").decode("utf-8", errors="replace") + if _RPCID in req.url or _RPCID in data: + # The request event fires before interception, so on_request may hold it already. + if not any(b["data"] == data for b in bodies): + bodies.append({"url_rpcids": parse_qs(req.url.split("?", 1)[-1]).get("rpcids"), + "data": data}) + await route.abort() + else: + await route.continue_() + + def on_request(req: Any) -> None: + # Passive copy: when the UI transport installs its own submit route (the I2I guard), + # it runs before ours and our abort never sees the request (measured 2026-11-22). + if "batchexecute" in req.url and _RPCID in req.url: + data = (req.post_data_buffer or b"").decode("utf-8", errors="replace") + if not any(b["data"] == data for b in bodies): + bodies.append({"url_rpcids": [_RPCID], "data": data, "observed": True}) + + count = req_kw.pop("count", 1) + page.on("request", on_request) + await page.route("**/data/batchexecute**", on_route) + try: + with contextlib.suppress(Exception): + # generate_image forces count=1 (_flow_generation.py:604); the batch entry + # point is the one that reaches Flow's x{N} tab. + await asyncio.wait_for( + client.generate_images_batch( + project_id=project_id, + req=req_kw.pop("request", None) or GenerateImageRequest(prompt=_PROMPT, **req_kw), + count=count, + ), + timeout=90, + ) + finally: + await page.unroute("**/data/batchexecute**", on_route) + page.remove_listener("request", on_request) + posts = [] + for b in bodies: + freq = json.loads(parse_qs(b["data"]).get("f.req", ["null"])[0] or "null") + for call in (freq or [[]])[0]: + if call and call[0] == _RPCID: + inner = json.loads(call[1]) + posts.append(_redact(inner)) + _log("capture", label=label, count=count, request={k: str(v) for k, v in req_kw.items()}, + posts=len(posts), entries_per_post=[len(p[1]) for p in posts if isinstance(p[1], list)], + frames=posts) + + +async def direct_upload( + *, minter: TokenMinter, project_id: str, tokens: Any, headers: dict[str, str], image: Path +) -> None: + """Phase 4: one direct maseQ upload, built from scratch (frame captured 2026-11-23).""" + import base64 + import mimetypes + + from gflow_cli.api.transports._mc_common import _first_uuid + + t0 = time.perf_counter() + token = await minter.mint("UPLOAD_IMAGE") + mint_ms = _ms(t0) + ctx: list[Any] = [None, 22, None, None, None, project_id, None, None, None, None, [token, 1]] + mime = mimetypes.guess_type(image.name)[0] or "image/png" + name = f"{image.stem}-{secrets.token_hex(4)}{image.suffix}" + payload = [ctx, base64.b64encode(image.read_bytes()).decode("ascii"), mime, 1, + None, None, None, None, name, None, + str(uuid.uuid4()).upper(), str(uuid.uuid4()).upper()] + body = urlencode({ + "f.req": json.dumps([[["maseQ", json.dumps(payload, separators=(",", ":")), None, + "generic"]]]), + "at": tokens.at, + }) + query = {"rpcids": "maseQ", "source-path": f"/project/{project_id}", "bl": tokens.bl, + "f.sid": tokens.fsid, "hl": "en", "_reqid": str(1000 + secrets.randbelow(9000)), + "rt": "c"} + url = f"{_BATCHEXECUTE}?{urlencode({k: v for k, v in query.items() if v})}" + post_headers = { + **headers, + "content-type": "application/x-www-form-urlencoded;charset=UTF-8", + "x-same-domain": "1", "origin": _ORIGIN, "referer": f"{_ORIGIN}/project/{project_id}", + "sec-fetch-site": "same-origin", "sec-fetch-mode": "cors", "sec-fetch-dest": "empty", + } + t1 = time.perf_counter() + try: + async with httpx.AsyncClient(follow_redirects=False, trust_env=False, + timeout=httpx.Timeout(60.0, connect=10.0)) as hx: + resp = await hx.post(url, content=body, headers=post_headers) + except httpx.HTTPError as exc: + # Flow may have stored the asset before the error: record it, never resend. + _log("direct_upload", status=None, outcome="indeterminate", error=type(exc).__name__, + display_name=name, mint_ms=mint_ms, post_ms=_ms(t1), body_len=len(body)) + return + errors = rpc_errors(resp.text) if resp.status_code == 200 else [] + media_id = _first_uuid(resp.text) if resp.status_code == 200 else None + _log("direct_upload", status=resp.status_code, media_id=media_id, display_name=name, + errors=[{"code": e.code, "reasons": list(e.reasons)} for e in errors], + head=None if resp.status_code == 200 else resp.text[:200], + mint_ms=mint_ms, post_ms=_ms(t1), body_len=len(body)) + + +async def capture_upload(client: Any, project_id: str, image: Path) -> None: + """Phase 4: Flow's own maseQ upload frame, route-aborted ($0: no asset is created).""" + page = client._page # noqa: SLF001 - spike-only + seen: list[dict[str, Any]] = [] + + async def on_route(route: Any) -> None: + req = route.request + data = (req.post_data_buffer or b"").decode("utf-8", errors="replace") + if "maseQ" in req.url or "maseQ" in data: + seen.append({"url": req.url.split("?", 1)[0], "query": parse_qs(req.url.split("?", 1)[-1]), + "headers": sorted(req.headers), "data": data}) + await route.abort() + else: + await route.continue_() + + from gflow_cli.api._engine import mint_evaluate_kwargs + + # Record the reCAPTCHA action the page mints for the upload (main world, like the minter). + hook = """() => { + const ent = window.grecaptcha && window.grecaptcha.enterprise; + if (!ent || ent.__gflowHooked) return !!ent; + const orig = ent.execute.bind(ent); + window.__gflowActions = []; + ent.execute = (key, opts) => { window.__gflowActions.push(opts && opts.action); return orig(key, opts); }; + ent.__gflowHooked = true; + return true; + }""" + hooked = await page.evaluate(hook, **mint_evaluate_kwargs()) + await page.route("**/data/batchexecute**", on_route) + try: + with contextlib.suppress(Exception): + await asyncio.wait_for(client.transport.upload_reference(project_id=project_id, + path=image), timeout=60) + finally: + await page.unroute("**/data/batchexecute**", on_route) + frames = [] + for b in seen: + freq = json.loads(parse_qs(b["data"]).get("f.req", ["null"])[0] or "null") + for call in (freq or [[]])[0]: + if call and call[0] == "maseQ": + frames.append(_redact(json.loads(call[1]))) + actions = await page.evaluate("() => window.__gflowActions || null", **mint_evaluate_kwargs()) + _log("upload_actions", hooked=hooked, actions=actions) + _log("upload_capture", posts=len(seen), rpcids=[b["query"].get("rpcids") for b in seen], + source_path=[b["query"].get("source-path") for b in seen], + headers=seen[0]["headers"] if seen else [], frames=frames, + body_len=[len(b["data"]) for b in seen]) + + +async def main() -> None: + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument("--profile", default="denon82") + ap.add_argument("--n", type=int, default=10) + ap.add_argument("--ui-n", type=int, default=10) + ap.add_argument("--skip-captures", action="store_true") + ap.add_argument("--captures-only", action="store_true", help="skip G0.1/G0.2 (route-aborted captures cost $0; --capture-ref/--capture-mention spend image quota)") + ap.add_argument("--project", default=None, help="reuse a project instead of creating one") + ap.add_argument("--direct-entries", type=int, default=1, help="Phase 2: entries per POST") + ap.add_argument("--direct-aspect", type=int, default=2, help="Phase 2: entry[4] value") + ap.add_argument("--capture-aspects", default="", help="Phase 2: Aspect names, comma-separated") + ap.add_argument("--capture-ref", action="store_true", help="Phase 2: capture an in-project I2I (spends 2 images of daily quota: a source image, and the referenced submit reaches Flow)") + ap.add_argument("--direct-upload", default="", help="Phase 4: FILE; one direct maseQ upload (creates an asset, $0)") + ap.add_argument("--capture-upload", default="", help="Phase 4: FILE; capture its maseQ upload ($0)") + ap.add_argument("--capture-entity", default="", help="ID:NAME; capture an attached character (spends 1 image)") + ap.add_argument("--capture-mention", default="", help="Phase 2: capture an @Name mention (spends 1 image: the referenced submit reaches Flow)") + args = ap.parse_args() + _FRAME.update(entries=args.direct_entries, aspect=args.direct_aspect) + + profile_dir = resolve_profile_dir(args.profile) + out = default_out_path("spike_direct_image_gate0", ".jsonl") + step("OUTPUT", str(out)) + try: + # The UI arms and captures must drive the UI transport whatever GFLOW_CLI_TRANSPORT says. + os.environ["GFLOW_CLI_TRANSPORT"] = "ui_automation" + async with build_client(profile_dir, headless=False) as client: + pid = args.project or ( + await client.create_project(title="gflow gate0 direct-image spike") + ).project_id + _log("project", project_id=pid) + page = client._page # noqa: SLF001 + await page.goto(f"{_ORIGIN}/project/{pid}", wait_until="networkidle", timeout=60_000) + await asyncio.sleep(2) + + # Disk cookies read WHILE Chrome holds the profile (the production condition). + # Run 1 (22:57Z) measured CookieStoreUnreadable here: Chrome holds the jar + # exclusively (cookies.py:333). The live context is the only source then. + try: + cookies = read_cookies_for(profile_dir) + _log("cookies", source="disk", count=len(cookies), with_chrome_open=True) + except Exception as exc: # noqa: BLE001 + ctx_cookies = await page.context.cookies([_ORIGIN]) + cookies = [(c["name"], c["value"]) for c in ctx_cookies] + _log("cookies", source="browser_context", disk_error=type(exc).__name__, + count=len(cookies), with_chrome_open=True) + ua = _user_agent(profile_dir) + headers = {"user-agent": ua or "", "accept-language": "en-US,en;q=0.9", + "cookie": "; ".join(f"{n}={v}" for n, v in cookies)} + async with httpx.AsyncClient(follow_redirects=False, trust_env=False, + timeout=httpx.Timeout(15.0, connect=5.0)) as hx: + tokens = await _shell_tokens(hx, profile_dir, headers) + _log("shell", at_len=len(tokens.at), fsid=bool(tokens.fsid), bl=tokens.bl, ua=ua) + + await discover_site_key(page) + minter = TokenMinter(page) + + if args.direct_upload: # Phase 4: one direct maseQ upload + await direct_upload(minter=minter, project_id=pid, tokens=tokens, + headers=headers, image=Path(args.direct_upload)) + return + if args.captures_only: + args.n = args.ui_n = 0 + # G0.1 — N consecutive direct POSTs, UI control on the first refusal. + for i in range(1, args.n + 1): + if not await direct_once(i, minter=minter, project_id=pid, tokens=tokens, + headers=headers): + await ui_once("ui_control", i, client, pid) + break + + # G0.2 — UI arm, same prompt/model/project. + for i in range(1, args.ui_n + 1): + await ui_once("ui", i, client, pid) + + # G0.3 / G0.4 — $0 captures through the real UI transport. + if args.capture_upload: # Phase 4: the maseQ upload frame ($0) + await capture_upload(client, pid, Path(args.capture_upload)) + elif args.capture_entity: # Flow's own frame for an attached character + plain prompt + eid, name = args.capture_entity.split(":", 1) + req = GenerateImageRequest( + prompt=_PROMPT, reference_entities=(eid,), reference_entity_names=(name,) + ) + await capture("entity", client, pid, request=req) + await capture("reset_default", client, pid) + elif args.capture_mention: # Phase 2 T2.2: Flow's own character-mention submit + from gflow_cli.services.mentions import resolve_and_apply + + req = await resolve_and_apply( + client, + GenerateImageRequest(prompt=f"@{args.capture_mention} on a pier at sunset"), + path="image", project_id=pid, tool_specs=(), quiet=True, + ) + _log("mention_resolved", entities=list(req.reference_entities), + names=list(req.reference_entity_names), prompt=req.prompt) + await capture("mention", client, pid, request=req) + await capture("reset_default", client, pid) + elif args.capture_ref: # Phase 2 T2.1: Flow's own in-project I2I submit frame + made = await client.generate_image( + project_id=pid, req=GenerateImageRequest(prompt=_PROMPT) + ) + _log("ref_source", media_id=made.media_name, has_display=bool(made.display_name)) + ref = ImageRef( + name=made.media_name, display_name=made.display_name or "", in_project=True + ) + await capture("i2i_in_project", client, pid, refs=(ref,)) + await capture("reset_default", client, pid) + elif args.capture_aspects: # Phase 2: the entry[4] value of each remaining aspect + for name in args.capture_aspects.split(","): + await capture(f"aspect_{name}", client, pid, aspect=Aspect[name]) + await capture("reset_default", client, pid) + elif not args.skip_captures: + await capture("default", client, pid) + await capture("aspect_16_9", client, pid, aspect=Aspect.LANDSCAPE) + await capture("count_2", client, pid, count=2) + await capture("reset_default", client, pid) + finally: + with open(out, "w", encoding="utf-8") as f: + for r in _records: + f.write(json.dumps(r, default=str) + "\n") + step("SAVED", str(out)) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/scripts/dev/spike_t2i_warm_vs_cold.py b/scripts/dev/spike_t2i_warm_vs_cold.py new file mode 100644 index 000000000..17deeb44b --- /dev/null +++ b/scripts/dev/spike_t2i_warm_vs_cold.py @@ -0,0 +1,117 @@ +r"""How much of a `gflow image t2i` run is startup, and how much is Flow generating? + +Cost: image quota only (no credits). Each arm generates one 1-image t2i per sample, so a run +spends 3 * N images of the profile's daily image cap. One project is created per +``cold_create`` sample; those projects are left empty in the account. + +Question: would routing CLI commands to an already-warm browser (the MCP server's long-lived +worker) remove enough of a t2i run to be worth building? + +Arms, run in blocks (not interleaved: the warm arm holds the profile lease, so a subprocess on +the same profile would be refused with ProfileLockedError): + +- cold_create : `gflow image t2i` as a subprocess with no --project. Wall clock of the whole + command: interpreter start, imports, lease, Chrome, Flow load, project create, + generate, download, catalog write, teardown. What a user pays today. +- cold_reuse : the same subprocess with --project . + The difference to cold_create is the project-creation cost. +- warm : one FlowApiClient entered once (timed apart), then N generate_image calls + into the same project. The per-call time is the floor a warm worker could reach. + It is an upper bound on the benefit: the worker's queued path adds a queue + round trip this arm does not pay. + +Pre-registered reading, on the medians (written before the first run): + +* warm / cold_reuse <= 0.6: startup is a large share; a warm-worker route is worth a plan. +* warm / cold_reuse >= 0.85: generation dominates; a warm worker is not worth it for speed. +* in between: worth it only with another reason (fewer launches, fewer leases). +* cold_create - cold_reuse >= 5 s: project reuse (or a direct create) is worth doing alone. + +N is small (image cap), so a result inside the 0.6-0.85 band settles nothing. Arm order is fixed +(warm, then cold), so a Flow-side slowdown during the run shows as a difference between arms: +the per-sample times are printed so a drift is visible. Prints no token, cookie, id or URL. + +Usage: uv run python scripts/dev/spike_t2i_warm_vs_cold.py [profile] [N] (default denon82 3) +""" + +from __future__ import annotations + +import asyncio +import json +import statistics +import subprocess +import sys +import tempfile +import time +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(ROOT / "src")) + +from gflow_cli.api.client import FlowApiClient # noqa: E402 +from gflow_cli.api.image import GenerateImageRequest # noqa: E402 +from gflow_cli.paths import default_home, profile_subdir # noqa: E402 + +PROMPT = "a plain white ceramic mug on a wooden table, soft daylight" + + +def median(xs: list[float]) -> float | None: + return round(statistics.median(xs), 1) if xs else None + + +def cold(profile: str, out: Path, project: str | None) -> tuple[float, str | None, int]: + argv = ["uv", "run", "--quiet", "gflow", "image", "t2i", PROMPT, "--profile", profile] + argv += ["--count", "1", "--out", str(out), "--json"] + if project: + argv += ["--project", project] + started = time.monotonic() + proc = subprocess.run(argv, capture_output=True, text=True, cwd=ROOT, check=False) # noqa: S603 + elapsed = time.monotonic() - started + try: # one indented JSON document (json_output.emit), not JSON lines + doc = json.loads(proc.stdout) + except ValueError: + doc = {} + pid = doc.get("project_id") if isinstance(doc, dict) else None + return elapsed, pid, proc.returncode + + +async def warm(profile: str, project: str, n: int) -> tuple[float, list[float]]: + started = time.monotonic() + async with FlowApiClient(profile_dir=profile_subdir(default_home(), profile)) as client: + entered = time.monotonic() - started + calls: list[float] = [] + for _ in range(n): + t0 = time.monotonic() + await client.generate_image(project_id=project, req=GenerateImageRequest(prompt=PROMPT)) + calls.append(time.monotonic() - t0) + return entered, calls + + +def main(profile: str, n: int) -> int: + out = Path(tempfile.mkdtemp(prefix="spike_t2i_")) + first, project, rc = cold(profile, out, None) # also makes the project the other arms reuse + if rc != 0 or not project: + why = f"first cold run exited {rc}" if rc else "no project_id in the --json output" + print(json.dumps({"verdict": "UNMEASURED", "why": why})) + return 1 + entered, warm_calls = asyncio.run(warm(profile, project, n)) + cold_create = [first] + [cold(profile, out, None)[0] for _ in range(n - 1)] + cold_reuse = [cold(profile, out, project)[0] for _ in range(n)] + res = { + "n": n, + "warm_entry_s": round(entered, 1), + "warm_call_s": [round(x, 1) for x in warm_calls], + "cold_create_s": [round(x, 1) for x in cold_create], + "cold_reuse_s": [round(x, 1) for x in cold_reuse], + } + w, cr, cc = median(warm_calls), median(cold_reuse), median(cold_create) + if w and cr and cc: + res["warm_over_cold_reuse"] = round(w / cr, 2) + res["create_cost_s"] = round(cc - cr, 1) + print(json.dumps(res, indent=2)) + return 0 + + +if __name__ == "__main__": + args = sys.argv[1:] + sys.exit(main(args[0] if args else "denon82", int(args[1]) if len(args) > 1 else 3)) diff --git a/server.json b/server.json index cd7e0607f..32a4abf21 100644 --- a/server.json +++ b/server.json @@ -3,7 +3,7 @@ "name": "io.github.ffroliva/gflow-cli", "title": "gflow-cli", "description": "Google Flow from any agent: Veo 3.1 and Omni video, Nano Banana and Imagen images, CLI included", - "version": "0.105.1", + "version": "0.106.0", "websiteUrl": "https://ffroliva.github.io/gflow-cli/", "repository": { "url": "https://github.com/ffroliva/gflow-cli", @@ -14,7 +14,7 @@ "registryType": "pypi", "registryBaseUrl": "https://pypi.org", "identifier": "gflow-cli", - "version": "0.105.1", + "version": "0.106.0", "runtimeHint": "uvx", "transport": { "type": "stdio" diff --git a/src/gflow_cli/__init__.py b/src/gflow_cli/__init__.py index e2ec49bd5..ad187e303 100644 --- a/src/gflow_cli/__init__.py +++ b/src/gflow_cli/__init__.py @@ -2,7 +2,7 @@ import logging as _logging -__version__ = "0.105.1" +__version__ = "0.106.0" # A deliberate exception to the structlog-only rule: this configures third-party loggers, # it does not log. httpx logs every request at INFO as "HTTP Request: ". diff --git a/src/gflow_cli/api/_flow_generation.py b/src/gflow_cli/api/_flow_generation.py index 7347b6fe9..686d9a46e 100644 --- a/src/gflow_cli/api/_flow_generation.py +++ b/src/gflow_cli/api/_flow_generation.py @@ -15,6 +15,7 @@ import structlog +from gflow_cli import telemetry from gflow_cli.api import routes from gflow_cli.api._engine import ( mint_evaluate_kwargs, @@ -569,6 +570,9 @@ async def _drive_images_generation( instance=_make_instance(), route=routes.batch_generate_images_url(project_id), ) + # getattr: a caller-owned transport may return image objects without the field. + direct = any(getattr(img, "transport", None) == "direct_http" for img in images) + telemetry.note_transport("direct" if direct else "ui") if on_checkpoint is not None: on_checkpoint( GenerationCheckpoint( diff --git a/src/gflow_cli/api/dto.py b/src/gflow_cli/api/dto.py index 25df7693b..c351e4148 100644 --- a/src/gflow_cli/api/dto.py +++ b/src/gflow_cli/api/dto.py @@ -197,6 +197,9 @@ class GeneratedImage: # is the searchable label the media picker shows — recorded so a generated # image can be referenced by name later. Original find by @C1ph3r404 (#253). display_name: str | None = None + # The transport that produced this image ("direct_http"); None = the default UI path. + # Recorded into the asset's metadata_json and the weekly telemetry, never sent. + transport: str | None = None @property def is_signed_url(self) -> bool: diff --git a/src/gflow_cli/api/flow_wire.py b/src/gflow_cli/api/flow_wire.py index 3127dccef..1f45ab9bf 100644 --- a/src/gflow_cli/api/flow_wire.py +++ b/src/gflow_cli/api/flow_wire.py @@ -242,6 +242,7 @@ def _rpc_request( build_rpc_request = _rpc_request +user_agent = _user_agent async def _shell_tokens( @@ -270,6 +271,14 @@ async def _shell_tokens( return tokens +shell_tokens = _shell_tokens + + +def forget_tokens(profile_dir: Path) -> None: + """Drop this profile's cached shell tokens: a rejected POST may mean a stale ``at``.""" + _tokens.pop(profile_dir, None) + + async def _read_cookies(profile_dir: Path) -> list[tuple[str, str]]: """``read_cookies_for`` on a daemon thread, bounded by ``_TOTAL_S``. diff --git a/src/gflow_cli/api/transports/__init__.py b/src/gflow_cli/api/transports/__init__.py index 571fa93f9..a80d9ad36 100644 --- a/src/gflow_cli/api/transports/__init__.py +++ b/src/gflow_cli/api/transports/__init__.py @@ -25,6 +25,7 @@ "evaluate_fetch", "bearer", "sapisidhash", + "direct_http", ) # Experimental transports whose ``setup()`` discards a caller-supplied ``page=`` @@ -41,6 +42,7 @@ def _registry() -> dict[str, type[FlowTransportStrategy]]: """Lazy registry import — keeps the factory cheap to import.""" + from gflow_cli.api.transports.direct_http import DirectHttpTransport from gflow_cli.api.transports.experimental.bearer import BearerTransport from gflow_cli.api.transports.experimental.evaluate_fetch import ( EvaluateFetchTransport, @@ -50,6 +52,7 @@ def _registry() -> dict[str, type[FlowTransportStrategy]]: return { "ui_automation": UiAutomationTransport, + "direct_http": DirectHttpTransport, "evaluate_fetch": EvaluateFetchTransport, "bearer": BearerTransport, "sapisidhash": SapisidhashTransport, diff --git a/src/gflow_cli/api/transports/_mc_common.py b/src/gflow_cli/api/transports/_mc_common.py index 4bc8476dc..47cacc73d 100644 --- a/src/gflow_cli/api/transports/_mc_common.py +++ b/src/gflow_cli/api/transports/_mc_common.py @@ -1619,15 +1619,16 @@ class SubmitWatch: _RPCS = frozenset((*SUBMIT_RPCS, IMAGE_SUBMIT_RPC)) - def __init__(self, page: Any) -> None: + def __init__(self, page: Any, rpcs: frozenset[str] = _RPCS) -> None: self._page = page + self._rpcs = rpcs self._seen = False def _on_request(self, request: Any) -> None: url = str(getattr(request, "url", "")) if ( "batchexecute" in url - and (url_rpcid(url) or body_rpcid(request_body(request))) in self._RPCS + and (url_rpcid(url) or body_rpcid(request_body(request))) in self._rpcs ): self._seen = True diff --git a/src/gflow_cli/api/transports/_mc_submit_observe.py b/src/gflow_cli/api/transports/_mc_submit_observe.py index 5bb26b506..ea44e9f34 100644 --- a/src/gflow_cli/api/transports/_mc_submit_observe.py +++ b/src/gflow_cli/api/transports/_mc_submit_observe.py @@ -140,6 +140,56 @@ def on_request(raw_request: Any) -> None: return on_request, unguarded +def ogiz0b_reply_images(text: str, request: GenerateImageRequest) -> list[GeneratedImage]: + """Extract GeneratedImage DTOs from an ogiZ0b batchexecute response. + + Raises refusal exception (ContentPolicyError, WafRejectionError) if Flow refused the submit. + Raises WireFormatError if no ogiZ0b frame or records were returned. + """ + refusal = _submit_refusal(text, (IMAGE_SUBMIT_RPC,)) + if refusal is not None: + raise refusal + parsed = parse_frames(text) + records = [ + record + for rpcid, payload in parsed + if rpcid == IMAGE_SUBMIT_RPC + for record in image_records(rpcid, payload) + ] + if not records: + log.warning( + "migrated.image_submit_unparsed_reply", + rpcid=IMAGE_SUBMIT_RPC, + text_len=len(text), + parsed_count=len(parsed), + parsed_rpcids=[p[0] for p in parsed], + ) + raise WireFormatError( + detail="migrated image submit returned no ogiZ0b frame", + route=f"batchexecute:{IMAGE_SUBMIT_RPC}", + ) + return [ + GeneratedImage( + media_name=record.media_id, + workflow_id=record.workflow_id, + seed=record.seed, + prompt=record.prompt, + # #789: the ogiZ0b reply carries no model field. Echoing + # the request back would report an attribution this host + # never confirmed — and with a hidden model picker (#788) + # the selected model can differ from the requested one, + # making the echo actively wrong on the single field a + # user would check to find out. + model_name_type=None, + aspect_ratio=request.aspect.value, + fife_url=record.image_url, + dimensions=record.dimensions, + display_name=record.display_name, + ) + for record in records + ] + + class SubmitObserveMixin(MentionMixin): """Prompt sending, generation submission, response polling and observation.""" @@ -781,48 +831,7 @@ async def on_response(response: Any) -> None: body_lost.set_result(None) return try: - refusal = _submit_refusal(text, (IMAGE_SUBMIT_RPC,)) - if refusal is not None: - raise refusal - parsed = parse_frames(text) - records = [ - record - for rpcid, payload in parsed - if rpcid == IMAGE_SUBMIT_RPC - for record in image_records(rpcid, payload) - ] - if not records: - log.warning( - "migrated.image_submit_unparsed_reply", - rpcid=IMAGE_SUBMIT_RPC, - text_len=len(text), - parsed_count=len(parsed), - parsed_rpcids=[p[0] for p in parsed], - ) - raise WireFormatError( - detail="migrated image submit returned no ogiZ0b frame", - route=f"batchexecute:{IMAGE_SUBMIT_RPC}", - ) - images = [ - GeneratedImage( - media_name=record.media_id, - workflow_id=record.workflow_id, - seed=record.seed, - prompt=record.prompt, - # #789: the ogiZ0b reply carries no model field. Echoing - # the request back would report an attribution this host - # never confirmed — and with a hidden model picker (#788) - # the selected model can differ from the requested one, - # making the echo actively wrong on the single field a - # user would check to find out. - model_name_type=None, - aspect_ratio=request.aspect.value, - fife_url=record.image_url, - dimensions=record.dimensions, - display_name=record.display_name, - ) - for record in records - ] + images = ogiz0b_reply_images(text, request) except Exception as exc: # noqa: BLE001 - delivered through the waiting future result.set_exception(exc) return diff --git a/src/gflow_cli/api/transports/direct_http.py b/src/gflow_cli/api/transports/direct_http.py new file mode 100644 index 000000000..210a29970 --- /dev/null +++ b/src/gflow_cli/api/transports/direct_http.py @@ -0,0 +1,516 @@ +"""Direct HTTP transport for image generation on flow.google.com.""" + +from __future__ import annotations + +import asyncio +import secrets +import time +import uuid +from collections.abc import Callable +from dataclasses import replace +from http.cookiejar import CookieJar, DefaultCookiePolicy +from pathlib import Path +from typing import TYPE_CHECKING + +import httpx +import structlog + +from gflow_cli.api import flow_wire +from gflow_cli.api._engine import mint_evaluate_kwargs +from gflow_cli.api.image import ImageRef, Model +from gflow_cli.api.recaptcha import TokenMinter +from gflow_cli.api.transports._common import flow_host_kind +from gflow_cli.api.transports._mc_common import _first_uuid # pyright: ignore[reportPrivateUsage] +from gflow_cli.api.transports._mc_submit_observe import ogiz0b_reply_images +from gflow_cli.api.transports.frame_builder import build_maseq_body, build_ogiz0b_body +from gflow_cli.api.transports.migrated_character import read_project +from gflow_cli.api.transports.ui_automation import UiAutomationTransport +from gflow_cli.auth.cookies import sent_to_flow_host +from gflow_cli.config import UiMode, get_settings, resolve_ui_mode +from gflow_cli.errors import NetworkError, RecaptchaError, WireFormatError +from gflow_cli.paths import extension_from_magic + +if TYPE_CHECKING: + from playwright.async_api import Page + + from gflow_cli.api.dto import GeneratedImage + from gflow_cli.api.image import GenerateImageRequest + +log = structlog.get_logger(__name__) + +# The model name an ogiZ0b body carries on flow.google.com. Only BELUGA is measured (the +# page sends it for "Nano Banana 2.1", which replaced NARWHAL in Flow's catalogue, #958); +# every other model routes to the UI transport until its wire name is captured. +_WIRE_MODEL: dict[Model, str] = {Model.NARWHAL: "BELUGA"} + +_ORIGIN = "https://flow.google.com" +_MINT_BUDGET_S = 10.0 # how long a freshly navigated page gets to load reCAPTCHA +_MINT_RETRY_S = 0.5 +_NAVIGATE_MS = 45_000 # the composer's own budget for reaching a project +_CHARACTER_READ_S = 15.0 # a bare @Name's project read; past it, the UI picker decides +_RECONCILE_HINT = ( + "Flow may have accepted this image request before the error, so gflow did not resend " + "it. Check the project in Flow for the new image before running the command again." +) +_UPLOAD_RECONCILE_HINT = ( + "Flow may have stored this upload before the error, so gflow did not resend it. Check " + "the project in Flow for the uploaded image before running the command again." +) +_SUBMIT = ("ogiZ0b", "IMAGE_GENERATION", "image submit", _RECONCILE_HINT) +_UPLOAD = ("maseQ", "UPLOAD_IMAGE", "image upload", _UPLOAD_RECONCILE_HINT) +_RpcSpec = tuple[str, str, str, str] # rpcid, reCAPTCHA action, noun, reconcile hint +# The MIME type sent with an upload comes from the bytes, not the file name: a JPEG named +# without an extension must not go out as image/png. The caller's validator already refused +# anything that is not one of these. +_UPLOAD_MIME = { + ".jpg": "image/jpeg", + ".png": "image/png", + ".gif": "image/gif", + ".webp": "image/webp", +} + + +def direct_can_serve(request: GenerateImageRequest) -> bool: + """True only for a request whose every wire slot is measured. + + T2I with a measured model, any aspect, any count Flow offers (1-4: N entries in one + POST returned N images live), or one in-project reference or one named character with + one image, on the classic composer. No Agent instructions and no raw ``@`` left in the + prompt (a mention reaches here already resolved to a name). + """ + return ( + request.model in _WIRE_MODEL + and _references_measured(request) + and _characters_measured(request) + and not request.ref_paths + and not request.instructions + and "@" not in request.prompt + and resolve_ui_mode(request.ui_mode) is not UiMode.AGENTIC + ) + + +def _references_measured(request: GenerateImageRequest) -> bool: + """No refs, or the one measured I2I shape: a single in-project image with a display + name (the chip needs it), one output image, made or uploaded in this run. + + Only a ref this run made (a ``batch:N`` row's image) or uploaded carries no + ``local_path``; one found in the local catalog always does (the CLI's lookup and the + #772 reuse fill it). The catalog can be stale: Flow may have deleted or renamed the + image. The UI path proves the ref still exists before it submits and refuses at $0; a + direct POST cannot, and what Flow does with a dead id is unmeasured. So catalogued + refs stay on the UI path.""" + if not request.refs: + return True + (ref, *more) = request.refs + return ( + not more + and ref.in_project + and bool(ref.display_name) + and not ref.local_path + and request.count == 1 + ) + + +def _characters_measured(request: GenerateImageRequest) -> bool: + """No character, or the one measured shape: a single named character, no image + reference, one output image. A bare ``@Name`` mention arrives as the name alone; the + direct path looks its id up in the project before sending (:func:`_resolve_character`).""" + ids, names = request.reference_entities, request.reference_entity_names + if not ids and not names: + return True + return ( + len(ids) <= 1 + and len(names) == 1 + and bool(names[0]) + and not request.refs + and request.count == 1 + ) + + +async def _resolve_character( + page: Page, project_id: str, request: GenerateImageRequest +) -> tuple[str, str]: + """Read path: the ``(entity_id, name)`` pair the frame carries, as the project holds it. + + Both forms are checked against Flow's own project reply (``read_project``, which also + lands the page on the project for the mint), as the UI does when it attaches one: + - an id (``--reference-entity``) must be one the project holds; the chip uses Flow's + name for it. A stale or foreign id falls back before any POST. + - a bare mention carries only the name: exactly one character must match it by the + picker's rule (trimmed, case-insensitive), or the UI picker decides. + The project read also measured the difference live: with it the request was accepted, + without it Flow refused an id-carrying request twice (exit 10, 2026-11-23). + """ + names = request.reference_entity_names + try: + # Bounded: a slow read must fall back, not hold the generate lock for minutes. + # One outer deadline: read_project's own budget is per attempt, and it retries. + project = await asyncio.wait_for( + read_project(page, project_id, timeout_s=_CHARACTER_READ_S), _CHARACTER_READ_S + ) + except Exception as exc: + raise _DirectFallbackError(f"character_read:{type(exc).__name__}") from exc + if request.reference_entities: + wanted_id = request.reference_entities[0] + matches = [c for c in project.characters if c.entity_id == wanted_id] + else: # the picker's own rule (_mc_mention.py): trimmed, case-insensitive, unique + wanted = names[0].strip().casefold() + matches = [c for c in project.characters if c.display_name.strip().casefold() == wanted] + if len(matches) != 1: + raise _DirectFallbackError(f"character_matches:{len(matches)}") + log.info("direct.character_resolved", source="project_read") + return (matches[0].entity_id, matches[0].display_name) + + +class _DirectFallbackError(Exception): + """Internal sentinel: nothing was accepted, so the UI transport may run instead.""" + + def __init__(self, reason: str) -> None: + super().__init__(reason) + self.reason = reason + + +def _reconcile_error(detail: str, spec: _RpcSpec, *, status: int | None = None) -> NetworkError: + """A failure after the POST was sent: never resent, the caller reconciles.""" + return NetworkError( + detail=f"{detail}; not resent", + status=status, + route=f"batchexecute:{spec[0]}", + next_action="reconcile", + remediation_hint=spec[3], + ) + + +def _proxy_configured() -> bool: + """A proxy anywhere means the browser and this request could leave by different routes. + ``NO_PROXY`` alone shows up as the ``no`` key and configures no proxy.""" + return bool(get_settings().browser_proxy) or any(k != "no" for k in flow_wire.getproxies()) + + +async def _session_headers(page: Page, profile_dir: Path) -> dict[str, str]: + """Read path: the live browser's cookies (the on-disk store is locked while Chrome + holds the profile) and the profile's own user agent. Read without a URL filter and + matched by domain: a URL filter also drops path-scoped cookies (#222).""" + try: + cookies = await page.context.cookies() + except Exception as exc: + raise _DirectFallbackError(f"cookie_error:{type(exc).__name__}") from exc + cookie_header = "; ".join( + f"{name}={value}" + for c in cookies + if (name := c.get("name")) + and (value := c.get("value")) + and sent_to_flow_host(c.get("domain", "")) + ) + if not cookie_header: + raise _DirectFallbackError("cookies_empty") + headers = {"accept-language": "en-US,en;q=0.9", "cookie": cookie_header} + if ua := flow_wire.user_agent(profile_dir): + headers["user-agent"] = ua + return headers + + +async def _shell( + client: httpx.AsyncClient, profile_dir: Path, headers: dict[str, str] +) -> flow_wire.Tokens: + """Read path: ``at`` / ``f.sid`` / ``bl`` from flow_wire's shell GET.""" + try: + return await flow_wire.shell_tokens(client, profile_dir, headers) + except flow_wire.WireReadUnavailable as exc: + raise _DirectFallbackError(exc.reason.value) from exc + except Exception as exc: + raise _DirectFallbackError(f"shell_tokens:{type(exc).__name__}") from exc + + +async def _mint(page: Page, project_id: str, action: str) -> str: + """The single browser step: a reCAPTCHA token for ``action``, minted on the project page. + + The page must end up on flow.google.com: an account Flow serves on labs.google is + redirected there, and the direct path does not serve it. Right after a navigation the + enterprise script is not loaded yet and the mint raises ``RecaptchaError`` (measured + 2026-11-23 on an i2i run with ``--project``). A mint spends nothing, so it is retried, + every attempt bounded, until the script answers or the budget runs out. + """ + target = f"{_ORIGIN}/project/{project_id}" + try: + if not page.url.startswith(target): + await page.goto(target, wait_until="domcontentloaded", timeout=_NAVIGATE_MS) + except Exception as exc: + raise _DirectFallbackError(f"navigation_failed:{type(exc).__name__}") from exc + if flow_host_kind(page.url) != "migrated": + raise _DirectFallbackError("served_labs") + minter = TokenMinter(page, mint_evaluate_kwargs=mint_evaluate_kwargs()) + deadline = time.monotonic() + _MINT_BUDGET_S + while True: + try: + remaining = max(deadline - time.monotonic(), 0.1) + return await asyncio.wait_for(minter.mint(action), remaining) + except RecaptchaError as exc: + if time.monotonic() >= deadline: + raise _DirectFallbackError("mint_failure:RecaptchaError") from exc + await asyncio.sleep(_MINT_RETRY_S) + except Exception as exc: + raise _DirectFallbackError(f"mint_failure:{type(exc).__name__}") from exc + + +def _post_request( + rpcid: str, project_id: str, tokens: flow_wire.Tokens, headers: dict[str, str], body: str +) -> httpx.Request: + query = { + "rpcids": rpcid, + "source-path": f"/project/{project_id}", + "bl": tokens.bl, + "f.sid": tokens.fsid, + "hl": "en", + "_reqid": str(1000 + secrets.randbelow(9000)), + "rt": "c", + } + return httpx.Request( + "POST", + f"{_ORIGIN}/_/AiSandboxAngularFrontend/data/batchexecute", + params={k: v for k, v in query.items() if v is not None}, + content=body, + headers={ + **headers, + "content-type": "application/x-www-form-urlencoded;charset=UTF-8", + "x-same-domain": "1", + "origin": _ORIGIN, + "referer": f"{_ORIGIN}/project/{project_id}", + "sec-fetch-site": "same-origin", + "sec-fetch-mode": "cors", + "sec-fetch-dest": "empty", + }, + ) + + +async def _send_once( + client: httpx.AsyncClient, request: httpx.Request, profile_dir: Path, spec: _RpcSpec +) -> httpx.Response: + """Write path: exactly one send. + + Nothing was accepted when the connection never opened, or when Flow redirected (3xx), + refused the session (401) or the token (403): the UI transport may run instead. + Anything else after the send may have been billed and is never resent. Every rejected + reply drops the cached ``at`` so a stale one cannot stick in a long-lived process. + """ + try: + response = await client.send(request) + except (httpx.ConnectError, httpx.ConnectTimeout, httpx.PoolTimeout) as exc: + raise _DirectFallbackError(f"connect:{type(exc).__name__}") from exc + except (httpx.TimeoutException, httpx.TransportError) as exc: + cause = (str(exc).strip().splitlines() or [""])[0][:160] + raise _reconcile_error(f"{type(exc).__name__} on an {spec[2]} ({cause})", spec) from exc + status = response.status_code + if status == 200: + return response + flow_wire.forget_tokens(profile_dir) + if 300 <= status < 400 or status in (401, 403): + raise _DirectFallbackError(f"http_{status}") + raise _reconcile_error(f"HTTP {status} on an {spec[2]}", spec, status=status) + + +def _client(http_transport: httpx.AsyncBaseTransport | None) -> httpx.AsyncClient: + return httpx.AsyncClient( + follow_redirects=False, + trust_env=False, # nothing env-derived (proxies, netrc) reaches this client + timeout=httpx.Timeout(120.0, connect=10.0), # a generation takes 16-24 s + cookies=CookieJar(policy=DefaultCookiePolicy(allowed_domains=[])), + transport=http_transport, # None = httpx's default; a mock under test + ) + + +async def run_direct_images( + *, + page: Page, + profile_dir: Path, + project_id: str, + request: GenerateImageRequest, + http_transport: httpx.AsyncBaseTransport | None = None, +) -> list[GeneratedImage]: + """One direct image generation: read the session, mint, build, send once, parse.""" + started = time.perf_counter() + headers = await _session_headers(page, profile_dir) + async with _client(http_transport) as client: + tokens = await _shell(client, profile_dir, headers) + characters = ( + (await _resolve_character(page, project_id, request),) + if request.reference_entity_names + else () + ) + mint_started = time.perf_counter() + token = await _mint(page, project_id, _SUBMIT[1]) + mint_ms = int((time.perf_counter() - mint_started) * 1000) + body = build_ogiz0b_body( + prompt=request.prompt, + model=_WIRE_MODEL[request.model], + project_id=project_id, + recaptcha_token=token, + at_token=tokens.at, + batch_id=str(uuid.uuid4()).upper(), + entry_seeds=tuple(1 + secrets.randbelow(2**31 - 1) for _ in range(request.count)), + aspect=request.aspect, + references=tuple((ref.name, ref.display_name) for ref in request.refs), + characters=characters, + ) + log.info( + "direct.frame_built", + model=request.model.value, + prompt_length=len(request.prompt), + count=request.count, + ) + post_started = time.perf_counter() + response = await _send_once( + client, _post_request("ogiZ0b", project_id, tokens, headers, body), profile_dir, _SUBMIT + ) + log.info( + "direct.image_post", + status=response.status_code, + mint_ms=mint_ms, + post_ms=int((time.perf_counter() - post_started) * 1000), + total_ms=int((time.perf_counter() - started) * 1000), + ) + images = ogiz0b_reply_images(response.text, request) + return [replace(img, transport="direct_http") for img in images] + + +async def run_direct_upload( + *, + page: Page, + profile_dir: Path, + project_id: str, + path: Path, + http_transport: httpx.AsyncBaseTransport | None = None, +) -> ImageRef: + """One direct ``maseQ`` upload: read the session, mint ``UPLOAD_IMAGE``, send once. + + The caller has validated the file (size, image header). The display name gets a run- + unique suffix, as the UI's own upload does, so a later chip names this image only. + """ + started = time.perf_counter() + headers = await _session_headers(page, profile_dir) + async with _client(http_transport) as client: + tokens = await _shell(client, profile_dir, headers) + token = await _mint(page, project_id, _UPLOAD[1]) + image = await asyncio.to_thread(path.read_bytes) + display_name = f"{path.stem}-{secrets.token_hex(4)}{path.suffix}" + body = build_maseq_body( + project_id=project_id, + recaptcha_token=token, + at_token=tokens.at, + image_bytes=image, + mime=_UPLOAD_MIME[extension_from_magic(image[:12]) or ".png"], + display_name=display_name, + request_ids=(str(uuid.uuid4()).upper(), str(uuid.uuid4()).upper()), + ) + response = await _send_once( + client, _post_request("maseQ", project_id, tokens, headers, body), profile_dir, _UPLOAD + ) + media_id = _first_uuid(response.text) + if media_id is None: + raise WireFormatError( + detail="direct maseQ upload returned no media id", route="batchexecute:maseQ" + ) + log.info("direct.upload", total_ms=int((time.perf_counter() - started) * 1000)) + return ImageRef(name=media_id, display_name=display_name, in_project=True) + + +class DirectHttpTransport(UiAutomationTransport): + """The UI transport, with measured image requests sent as one direct ``ogiZ0b`` POST.""" + + name = "direct_http" + _profile_dir: Path | None = None + + def __init__(self, *, http_transport: httpx.AsyncBaseTransport | None = None) -> None: + super().__init__() + self._http_transport = http_transport + + async def setup(self, profile_dir: Path, *, page: Page | None = None) -> None: + self._profile_dir = profile_dir + await super().setup(profile_dir, page=page) + + async def generate_images( + self, + *, + project_id: str | None, + request: GenerateImageRequest, + name_resolver: Callable[[str], str | None] | None = None, + ) -> list[GeneratedImage]: + """Generate via one direct POST when the request is measured; otherwise, or when + nothing was accepted, through the inherited UI path.""" + if not self._setup_done or self._page is None: + msg = "DirectHttpTransport.setup() must be called before generate_images()" + raise RuntimeError(msg) + + async with self._generate_lock: + await self.park_deferred_page() + page, profile_dir = self._page, self._profile_dir + reason = self._why_not_direct(request, project_id) + if reason is None and project_id is not None and profile_dir is not None: + try: + images = await run_direct_images( + page=page, + profile_dir=profile_dir, + project_id=project_id, + request=request, + http_transport=self._http_transport, + ) + except _DirectFallbackError as fb: + reason = fb.reason + else: + self.last_image_route = "migrated" + return images + finally: + # Never leave a mounted composer for the next request (_park_composer_page). + await self._park_composer_page(page, event="direct.page_park_failed") + log.info("direct.fallback_to_ui", reason=reason) + return await self._generate_images_locked( + request, project_id=project_id, name_resolver=name_resolver + ) + + async def upload_reference(self, *, project_id: str, path: Path) -> ImageRef | None: + """Upload ``path`` with one direct ``maseQ`` POST; the UI upload when nothing was + sent (no session, no token, not flow.google.com, a proxy, a refused session).""" + if not self._setup_done or self._page is None: + msg = "DirectHttpTransport.setup() must be called before upload_reference()" + raise RuntimeError(msg) + page, profile_dir = self._page, self._profile_dir + reason = self._why_not_direct_upload() + if reason is None and profile_dir is not None: + async with self._generate_lock: + await self.park_deferred_page() + try: + return await run_direct_upload( + page=page, + profile_dir=profile_dir, + project_id=project_id, + path=path, + http_transport=self._http_transport, + ) + except _DirectFallbackError as fb: + reason = fb.reason + finally: + await self._park_composer_page(page, event="direct.page_park_failed") + log.info("direct.upload_fallback_to_ui", reason=reason) + return await super().upload_reference(project_id=project_id, path=path) + + def _why_not_direct_upload(self) -> str | None: + if self._profile_dir is None: + return "no_profile_dir" + if get_settings().flow_host == "labs.google": + return "flow_host_labs" + if _proxy_configured(): + return "proxy_configured" + return None + + def _why_not_direct(self, request: GenerateImageRequest, project_id: str | None) -> str | None: + if not direct_can_serve(request): + return "unsupported_shape" + if project_id is None: + return "no_project" + if self._profile_dir is None: + return "no_profile_dir" + if get_settings().flow_host == "labs.google": + return "flow_host_labs" + if _proxy_configured(): + return "proxy_configured" + return None diff --git a/src/gflow_cli/api/transports/frame_builder.py b/src/gflow_cli/api/transports/frame_builder.py new file mode 100644 index 000000000..3f3f0b202 --- /dev/null +++ b/src/gflow_cli/api/transports/frame_builder.py @@ -0,0 +1,113 @@ +"""The ``ogiZ0b`` (image generation) batchexecute body, built from domain values. + +A pure function: no I/O, no clock, no randomness. The caller supplies the per-request +values (``batch_id``, ``entry_seeds``) so the output is deterministic under test. + +Wire shape (proven 2026-11-22, docs/superpowers/spikes/2026-11-22-direct-image-gate0.md): + + ctx = [null, 22, null, null, null, project_id, null, null, null, null, [token, 1]] + entry = [null, null, null, seed, aspect, model, null, copy(ctx), [[[prompt]]], + null, null, null] + inner = [null, [entry, ...], 1, ctx, [batch_id]] # one entry per image, one POST + body = urlencode({"f.req": [[["ogiZ0b", json(inner), null, "generic"]]], "at": at}) +""" + +from __future__ import annotations + +import base64 +import json +from urllib.parse import urlencode + +from gflow_cli.api.image import Aspect + +# entry[4], as Flow's own submit sends it (route-aborted captures, 2026-11-22). 9:16 and +# 16:9 are also proven by direct POSTs (768x1376, 1376x768); the other three by capture. +_ASPECT_WIRE: dict[Aspect, int] = { + Aspect.SQUARE: 1, + Aspect.PORTRAIT: 2, + Aspect.LANDSCAPE: 3, + Aspect.PORTRAIT_THREE_FOUR: 4, + Aspect.LANDSCAPE_FOUR_THREE: 5, +} + + +def build_ogiz0b_body( + *, + prompt: str, + model: str, + project_id: str, + recaptcha_token: str, + at_token: str, + batch_id: str, + entry_seeds: tuple[int, ...], + aspect: Aspect = Aspect.PORTRAIT, + references: tuple[tuple[str, str], ...] = (), + characters: tuple[tuple[str, str], ...] = (), +) -> str: + """Return the form-encoded ``f.req`` + ``at`` body for one ``ogiZ0b`` POST. + + One entry per image: ``len(entry_seeds)`` is the image count (two entries returned two + images in one POST, measured 2026-11-22). ``references`` are in-project images as + ``(media_id, display_name)``: Flow's own I2I submit carries each at ``entry[2]`` and + as a chip ahead of the prompt text, which then starts with two spaces (captured + 2026-11-22 with one reference). ``characters`` are ``(entity_id, name)``: each at + ``entry[10]`` and as a character chip, the text then starting with one space (captured + 2026-11-23 with one character). The two are never combined: that shape is unmeasured. + """ + if not entry_seeds: + msg = "entry_seeds must name at least one image" + raise ValueError(msg) + ctx: list[object] = [None, 22, None, None, None, project_id, None, None, None, None] + ctx.append([recaptcha_token, 1]) + if references and characters: + msg = "references and characters together are not a measured ogiZ0b shape" + raise ValueError(msg) + media = [[media_id, None, None, None, 1] for media_id, _ in references] or None + entities = [[entity_id] for entity_id, _ in characters] or None + document = _prompt_document(prompt, references, characters) + entries = [ + [None, None, media, seed, _ASPECT_WIRE[aspect], model, None, ctx.copy(), document] + + [None, entities, None] + for seed in entry_seeds + ] + inner = [None, entries, 1, ctx, [batch_id]] + f_req = json.dumps([[["ogiZ0b", json.dumps(inner, separators=(",", ":")), None, "generic"]]]) + return urlencode({"f.req": f_req, "at": at_token}) + + +def build_maseq_body( + *, + project_id: str, + recaptcha_token: str, + at_token: str, + image_bytes: bytes, + mime: str, + display_name: str, + request_ids: tuple[str, str], +) -> str: + """Return the form-encoded body for one ``maseQ`` (image upload) POST. + + The frame Flow's own upload sends (captured 2026-11-23; a direct POST of it returned the + new media id): the project context with the token, the bytes inline as base64, the MIME + type, ``1``, four nulls, the display name, a null and two client-generated ids. + """ + ctx: list[object] = [None, 22, None, None, None, project_id, None, None, None, None] + ctx.append([recaptcha_token, 1]) + data = base64.b64encode(image_bytes).decode("ascii") + frame = [ctx, data, mime, 1, None, None, None, None, display_name, None, *request_ids] + f_req = json.dumps([[["maseQ", json.dumps(frame, separators=(",", ":")), None, "generic"]]]) + return urlencode({"f.req": f_req, "at": at_token}) + + +def _prompt_document( + prompt: str, + references: tuple[tuple[str, str], ...], + characters: tuple[tuple[str, str], ...], +) -> list[object]: + """``entry[8]``: the prompt as Flow's composer serialises it, chips first.""" + if references: + return [[[None, [[media_id, name] for media_id, name in references]], [f" {prompt}"]]] + if characters: + chips = [[None, None, [entity_id, name]] for entity_id, name in characters] + return [[[None, *chips], [f" {prompt}"]]] + return [[[prompt]]] diff --git a/src/gflow_cli/api/transports/migrated_composer.py b/src/gflow_cli/api/transports/migrated_composer.py index 95a47a104..2db39b75b 100644 --- a/src/gflow_cli/api/transports/migrated_composer.py +++ b/src/gflow_cli/api/transports/migrated_composer.py @@ -31,12 +31,14 @@ # pyright: reportPrivateUsage=false from __future__ import annotations +import asyncio import time from pathlib import Path from typing import TYPE_CHECKING import structlog from playwright.async_api import ( + Locator, Page, ) from playwright.async_api import ( @@ -691,6 +693,36 @@ def refuse() -> FlowHostMigratedError: ) +#: How long a timed-out Create click waits for a late ``jHPbke`` before calling it unsent. +CREATE_LATE_REQUEST_GRACE_S = 1.0 + + +async def _click_create(page: Page, button: Locator) -> None: + """Click Create. A click can time out after it dispatched, so the request decides.""" + with SubmitWatch(page, frozenset({CREATE_PROJECT_RPC})) as sent: + try: + await button.click(timeout=15_000) + except PlaywrightTimeoutError as e: + if not sent.seen(): + # The page's handler can send the create just after Playwright gave up. + await asyncio.sleep(CREATE_LATE_REQUEST_GRACE_S) + if sent.seen(): + return # Create reached Flow: wait for its reply, or recover it + raise UiSelectorDriftError( + detail=( + f"migrated host: the new-project button ({NEW_PROJECT_BUTTON}) was " + f"visible but did not take the click on {safe_page_url(page.url)}, " + "and no create request was sent (host=migrated)" + ), + charged="no", + remediation_hint=( + "No create request was sent and nothing was charged. Something on Flow's " + "projects page may be covering the button; re-run. To skip creating a " + "project, generate in an existing one (CLI --project , MCP project)." + ), + ) from e + + async def create_project( page: Page, title: str, *, timeout_s: float = PAGE_RPC_TIMEOUT_S ) -> ProjectInfo: @@ -716,7 +748,7 @@ async def create_project( payload = await rpc_reply( page, CREATE_PROJECT_RPC, - lambda: button.click(timeout=15_000), + lambda: _click_create(page, button), timeout_s=timeout_s, write=True, ) diff --git a/src/gflow_cli/auth/cookies.py b/src/gflow_cli/auth/cookies.py index d97c9731f..faad829f5 100644 --- a/src/gflow_cli/auth/cookies.py +++ b/src/gflow_cli/auth/cookies.py @@ -309,6 +309,9 @@ def _domain_match(domain: str) -> bool: return _WIRE_HOST == domain +sent_to_flow_host = _domain_match + + def read_cookies_for(profile_dir: Path) -> list[tuple[str, str]]: """The (name, value) pairs a browser on this profile sends on ``GET https://flow.google.com/``. diff --git a/src/gflow_cli/cli_image.py b/src/gflow_cli/cli_image.py index b6aaf47af..b2ce92948 100644 --- a/src/gflow_cli/cli_image.py +++ b/src/gflow_cli/cli_image.py @@ -31,6 +31,7 @@ from gflow_cli._cli_helpers import ( _FLOW_ID_RE, OutputFormat, + _handle_gflow_error, _make_provider_dir, _resolve_profile, _validate_project_id, @@ -70,9 +71,11 @@ from gflow_cli.data.repository import DataRepository, verified_local_path from gflow_cli.data.store import DataStore from gflow_cli.errors import ( + BatchPartialError, ConfigurationError, DataIntegrityError, DataStoreError, + GFlowError, ) from gflow_cli.image_batch import ( ALLOWED_ASPECT_RATIOS as _ALLOWED_ASPECT_RATIOS, @@ -419,7 +422,8 @@ def image() -> None: help=( "Override transport strategy. Falls back to GFLOW_CLI_TRANSPORT env var " "or built-in default (ui_automation). Set " - "GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to enable evaluate_fetch/bearer/sapisidhash." + "GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to enable " + "direct_http/evaluate_fetch/bearer/sapisidhash." ), ) def upload(path: Path, profile: str | None, transport: str | None) -> None: @@ -803,7 +807,8 @@ def _validate_jitter_spec( help=( "Override transport strategy. Falls back to GFLOW_CLI_TRANSPORT env var " "or built-in default (ui_automation). Set " - "GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to enable evaluate_fetch/bearer/sapisidhash." + "GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to enable " + "direct_http/evaluate_fetch/bearer/sapisidhash." ), ) @_project_and_entity_options(single_prompt=True) @@ -1566,6 +1571,14 @@ def batch( recorder=recorder, ), ) + except BatchPartialError as exc: + # Fail-fast stop after some prompts finished: list what was saved, then the error. + render_image_batch_summary(list(exc.partial_results), title=_BATCH_TITLE) + sys.exit(_handle_gflow_error(exc, cli_command="image batch")) + except GFlowError as exc: + # A failure before any prompt ran (e.g. the migrated host) is not a + # per-prompt outcome; report it like every other image command. + sys.exit(_handle_gflow_error(exc, cli_command="image batch")) finally: recorder.close() exit_code = render_image_batch_summary(outcomes, title=_BATCH_TITLE) @@ -1674,7 +1687,8 @@ class _I2IParams: help=( "Override transport strategy. Falls back to GFLOW_CLI_TRANSPORT env var " "or built-in default (ui_automation). Set " - "GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to enable evaluate_fetch/bearer/sapisidhash." + "GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to enable " + "direct_http/evaluate_fetch/bearer/sapisidhash." ), ) @_project_and_entity_options(single_prompt=False) diff --git a/src/gflow_cli/config.py b/src/gflow_cli/config.py index 979504a89..b7b973e1b 100644 --- a/src/gflow_cli/config.py +++ b/src/gflow_cli/config.py @@ -515,8 +515,8 @@ def _validate_llm_base_url(cls, v: object) -> object: default=None, description=( "Default transport strategy: ui_automation (production-validated; default). " - "Set GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to expose evaluate_fetch / bearer / " - "sapisidhash in the --transport CLI Choice list. The Python API accepts any " + "Set GFLOW_CLI_EXPERIMENTAL_TRANSPORTS=1 to expose direct_http / evaluate_fetch / " + "bearer / sapisidhash in the --transport CLI Choice list. The Python API accepts any " "registered key regardless of that env var. Override via GFLOW_CLI_TRANSPORT " "env var or --transport." ), diff --git a/src/gflow_cli/data/_recording_image.py b/src/gflow_cli/data/_recording_image.py index c52ca3074..0ae25a8ff 100644 --- a/src/gflow_cli/data/_recording_image.py +++ b/src/gflow_cli/data/_recording_image.py @@ -159,6 +159,8 @@ def _persist_generated_image( # persists the browser-searchable caption in plaintext. if image.display_name and self.prompt_mode == "store": metadata["display_name"] = image.display_name + if image.transport is not None: + metadata["transport"] = image.transport repo.upsert_asset( AssetRecord( id=asset_id, diff --git a/src/gflow_cli/mcp/server.py b/src/gflow_cli/mcp/server.py index cf9564fed..16377194e 100644 --- a/src/gflow_cli/mcp/server.py +++ b/src/gflow_cli/mcp/server.py @@ -396,9 +396,10 @@ async def run_http(host: str = "127.0.0.1", port: int = 8000) -> None: ``stateless_http`` is deliberately left at its ``False`` default. The 2026-07-28 stateless core exists so servers can scale out across interchangeable instances — the opposite of what gflow is. Our value is a - warm daemon holding one live Chromium profile, serialized by a cross-process - ``ProfileLease``; spreading requests over stateless workers would buy - nothing and fight that lease. The *protocol* is stateless either way (the + daemon serialized by a cross-process ``ProfileLease`` that opens one browser + per task (D3: ``ui/app.py``); spreading requests over stateless workers + would buy nothing and fight that lease. The *protocol* is stateless either + way (the 2026-07-28 handshake removal is handled by the SDK); this flag only governs whether the transport keeps per-connection bookkeeping, and we want it. diff --git a/src/gflow_cli/services/video_captions.py b/src/gflow_cli/services/video_captions.py index 625d5b986..f0aad52c9 100644 --- a/src/gflow_cli/services/video_captions.py +++ b/src/gflow_cli/services/video_captions.py @@ -571,8 +571,16 @@ def _caption_overlay( draw.rounded_rectangle( (x - 10, y - 6, x + box[2] - box[0] + 10, y + box[3] - box[1] + 6), 8, fill=(0, 0, 0, 180) ) + # The box is laid out in ink coordinates; draw the text so its ink, not its origin, lands at + # (x, y). The origin sits box[0], box[1] away from the ink (the font's side bearing and the + # space above the tallest glyph), which put the box above the text (#1431). draw.multiline_text( - (x, y), "\n".join(lines), font=font, fill=(255, 255, 255, 255), align="center", spacing=2 + (x - box[0], y - box[1]), + "\n".join(lines), + font=font, + fill=(255, 255, 255, 255), + align="center", + spacing=2, ) return overlay, height - band_height @@ -595,17 +603,38 @@ def _blend_caption( return result +_NO_LINE_START = frozenset(",。、;:!?)」』》〉】,.;:!?)") + + def _wrap_caption(text: str, font: Any, draw: Any, max_width: float) -> list[str]: lines: list[str] = [] for paragraph in text.splitlines() or [text]: line = "" for word in paragraph.split(): - candidate = f"{line} {word}".strip() - if line and draw.textlength(candidate, font=font) > max_width: - lines.append(line) - line = word - else: + candidate = f"{line} {word}" if line else word + if draw.textlength(candidate, font=font) <= max_width: line = candidate + continue + if line: + lines.append(line) + line = "" + # A token wider than the line is broken between characters: CJK text has no spaces + # to break at, and a long URL is a single token. Closing punctuation is not left at + # the start of a line; the character before it moves down with it. + for char in word: + if line and draw.textlength(line + char, font=font) > max_width: + if ( + char in _NO_LINE_START + and len(line) > 1 + and draw.textlength(line[-1] + char, font=font) <= max_width + ): + lines.append(line[:-1]) + line = line[-1] + char + else: + lines.append(line) + line = char + else: + line += char lines.append(line) return lines diff --git a/src/gflow_cli/telemetry.py b/src/gflow_cli/telemetry.py index b9dce9692..ae4a3fbd4 100644 --- a/src/gflow_cli/telemetry.py +++ b/src/gflow_cli/telemetry.py @@ -53,22 +53,22 @@ def _debug(event: str, **kw: str) -> None: OFF_FILE = "telemetry.off" CONSENT_FILE = "telemetry.consent" SCHEMA = 1 -NOTICE_VERSION = 3 +NOTICE_VERSION = 4 NOTICE_TEXT = ( "gflow sends weekly usage totals to improve it, and we share overall figures publicly and " "with\n" - "sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and\n" - "your country as a total. No ID, prompts, paths or account details. Each report is added to\n" - "totals and discarded.\n" + "sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used,\n" + "error codes, and your country as a total. No ID, prompts, paths or account details. Each\n" + "report is added to totals and discarded.\n" "Turn it off: gflow telemetry off, or set GFLOW_CLI_TELEMETRY=0\n" "See exactly what is sent: gflow telemetry show. Full notice: gflow docs TELEMETRY" ) NOTICE_TEXT_CONSENT = ( "gflow can send weekly usage totals to help improve it; overall figures are shared publicly " "and " - "with sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, " - "and your country as a total. No ID, prompts, paths or account details. Each report is " - "added to totals and discarded.\n" + "with sponsors. Commands, flag names, models, browser engine, image transport, the Flow site " + "used, error codes, and your country as a total. No ID, prompts, paths or account details. " + "Each report is added to totals and discarded.\n" "In your region nothing is sent unless you agree: gflow telemetry on (undo: gflow telemetry " "off)\n" "See exactly what would be sent: gflow telemetry show. Full notice: gflow docs TELEMETRY" @@ -450,6 +450,7 @@ def _connect(home: Path) -> sqlite3.Connection: _RUN_FACTS: ContextVar[dict[str, str] | None] = ContextVar("gflow_run_facts", default=None) _ENGINES = frozenset({"playwright", "patchright"}) _HOSTS = {"labs": "labs", "migrated": "flow"} +_TRANSPORTS = frozenset({"direct", "ui"}) def _facts() -> dict[str, str]: @@ -479,14 +480,23 @@ def note_host(kind: str | None) -> None: _facts()["host"] = _HOSTS[kind] +def note_transport(kind: str) -> None: + """Note the image transport used (closed enum: direct, ui; anything else is ``other``).""" + _facts()["transport"] = kind if kind in _TRANSPORTS else "other" + + def _take_run_facts() -> list[tuple[str, str]]: """The noted facts as counter keys, cleared so the next run starts empty.""" facts = _facts() noted = dict(facts) # snapshot, then clear: a concurrent clear cannot raise here facts.clear() # a host noted without a launch must not carry into a later run - if "engine" not in noted: - return [] - return [("engine", noted["engine"]), ("host", noted.get("host", "unknown"))] + out: list[tuple[str, str]] = [] + if "engine" in noted: + out.append(("engine", noted["engine"])) + out.append(("host", noted.get("host", "unknown"))) + if "transport" in noted: + out.append(("transport", noted["transport"])) + return out def flush_run_facts(surface: Literal["cli", "mcp"]) -> None: @@ -933,6 +943,7 @@ def _report_counter_targets() -> dict[str, Any]: "mcp_clients": {}, "engines": {}, "hosts": {}, + "transports": {}, "tools": tools, "nested": {"flag": flags, "exit": exits, "duration": durations, "tool": tools}, } @@ -979,8 +990,15 @@ def _add_scalar_counter( elif kind == "crash": values = targets["crashes"].setdefault(surface, {}) values[key] = values.get(key, 0) + count - elif kind in ("client", "engine", "host"): - values = targets[{"client": "mcp_clients", "engine": "engines", "host": "hosts"}[kind]] + elif kind in ("client", "engine", "host", "transport"): + values = targets[ + { + "client": "mcp_clients", + "engine": "engines", + "host": "hosts", + "transport": "transports", + }[kind] + ] values[key] = values.get(key, 0) + count @@ -1105,5 +1123,5 @@ def build_report(week: str) -> dict[str, object]: "crashes": counters["crashes"], "tools": counters["tools"], # Sent only when non-empty: an endpoint older than #1326 rejects the keys. - **{k: counters[k] for k in ("engines", "hosts") if counters[k]}, + **{k: counters[k] for k in ("engines", "hosts", "transports") if counters[k]}, } diff --git a/tests/api/test_client_image.py b/tests/api/test_client_image.py index 73aa7f053..3bc2b89c0 100644 --- a/tests/api/test_client_image.py +++ b/tests/api/test_client_image.py @@ -24,6 +24,7 @@ import pytest import structlog +from gflow_cli import telemetry from gflow_cli.api.client import FlowApiClient, FlowApiError from gflow_cli.api.dto import GeneratedImage from gflow_cli.api.image import Aspect, GenerateImageRequest @@ -1015,3 +1016,45 @@ async def test_a_redirect_off_an_allowed_host_is_refused_and_nothing_is_written( _make_image(fife_url="https://flow.google.com/asb/opaque=s0"), out ) assert not out.exists() + + +class TestImageGenerationTransportTelemetry: + async def test_notes_direct_transport_when_image_has_direct_http( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + noted: list[str] = [] + monkeypatch.setattr(telemetry, "note_transport", noted.append) + img = dataclasses.replace(_make_image(), transport="direct_http") + transport = _FakeTransport([img]) + client = _client_with_transport(tmp_path, transport) + + await client.generate_image(project_id="proj-1", req=_make_req()) + + assert noted == ["direct"] + + async def test_notes_ui_transport_when_image_has_no_transport( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + noted: list[str] = [] + monkeypatch.setattr(telemetry, "note_transport", noted.append) + img = _make_image() + assert img.transport is None + transport = _FakeTransport([img]) + client = _client_with_transport(tmp_path, transport) + + await client.generate_image(project_id="proj-1", req=_make_req()) + + assert noted == ["ui"] + + async def test_a_run_that_made_no_image_notes_no_transport( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Counted only after the empty-reply refusal: no image, no transport fact.""" + noted: list[str] = [] + monkeypatch.setattr(telemetry, "note_transport", noted.append) + client = _client_with_transport(tmp_path, _FakeTransport([])) + + with pytest.raises(ContentPolicyError): + await client.generate_image(project_id="proj-1", req=_make_req()) + + assert noted == [] diff --git a/tests/api/transports/fixtures/migrated_composer_contract.json b/tests/api/transports/fixtures/migrated_composer_contract.json index 74c77859f..116f48174 100644 --- a/tests/api/transports/fixtures/migrated_composer_contract.json +++ b/tests/api/transports/fixtures/migrated_composer_contract.json @@ -50,7 +50,7 @@ "reference_existing": "function (self, page: 'Page', project_id: 'str', request: 'GenerateImageRequest', *, name_resolver: 'Callable[[str], str | None] | None' = None) -> 'tuple[str, ...]' sha=8fb9a1d97c81eba0", "send_prompt": "function (self, page: 'Page', prompt: 'str', *, append: 'bool' = False) -> 'None' sha=da72d766802c433e", "submit_and_observe": "function (self, page: 'Page', *, poll_timeout_s: 'float', on_started: 'VideoStartedCallback | None', project_id: 'str | None', expect_media_id: 'str | None' = None, expect_end_media_id: 'str | None' = None, expect_reference_ids: 'tuple[str, ...]' = (), submit_rpcs: 'tuple[str, ...]' = ('YhhmEf', 'eb1hJf', 'MZZa6b', 'nprQif'), submit_selector: 'str | None' = None, request_check: 'Callable[[str, str], GFlowError | None] | None' = None, adopt_ids: 'tuple[str, ...]' = (), adopt_prompt: 'str | None' = None) -> 'GenerationRecord' sha=23505c9d43fcaa64", - "submit_images_and_observe": "function (self, page: 'Page', request: 'GenerateImageRequest', *, reference_ids: 'tuple[str, ...]' = (), entity_ids: 'tuple[str, ...]' = ()) -> 'list[GeneratedImage]' sha=5f35c8fcd5570dc2", + "submit_images_and_observe": "function (self, page: 'Page', request: 'GenerateImageRequest', *, reference_ids: 'tuple[str, ...]' = (), entity_ids: 'tuple[str, ...]' = ()) -> 'list[GeneratedImage]' sha=3fa86bdd9665e91b", "upload": "function (self, page: 'Page', project_id: 'str', image_path: 'Path') -> 'tuple[str, str]' sha=f33460601b0af4b8" }, "module_names": { @@ -132,7 +132,7 @@ "_unported_image_form": "function (request: 'GenerateImageRequest') -> 'str | None' sha=083066d4a70eb7d0", "_wait_anchor": "function (page: 'Page', selector: 'str', *, named: 'str', requested: 'str', at: 'str', timeout_s: 'float') -> 'Any' sha=f60a4cf05096f7db", "body_rpcid": "function (body: 'str') -> 'str | None' sha=2742321c5304b2a9", - "create_project": "function (page: 'Page', title: 'str', *, timeout_s: 'float' = 120.0) -> 'ProjectInfo' sha=f6e83b1570fb4b06", + "create_project": "function (page: 'Page', title: 'str', *, timeout_s: 'float' = 120.0) -> 'ProjectInfo' sha=1653b77cf258b899", "is_at": "function (url: 'object', target: 'str') -> 'bool' sha=d918ccf22f0049f8", "migrated_can_serve": "function (request: 'GenerateVideoRequest', project_id: 'str | None') -> 'bool' sha=6fff5b8bfd0295b6", "migrated_images_prefer": "function (request: 'GenerateImageRequest', *, page_url: 'str | None' = None, project_id: 'str | None' = None) -> 'bool' sha=3402dae1831304be", @@ -146,7 +146,7 @@ }, "public_functions": { "body_rpcid": "function (body: 'str') -> 'str | None' sha=2742321c5304b2a9", - "create_project": "function (page: 'Page', title: 'str', *, timeout_s: 'float' = 120.0) -> 'ProjectInfo' sha=f6e83b1570fb4b06", + "create_project": "function (page: 'Page', title: 'str', *, timeout_s: 'float' = 120.0) -> 'ProjectInfo' sha=1653b77cf258b899", "is_at": "function (url: 'object', target: 'str') -> 'bool' sha=d918ccf22f0049f8", "migrated_can_serve": "function (request: 'GenerateVideoRequest', project_id: 'str | None') -> 'bool' sha=6fff5b8bfd0295b6", "migrated_images_prefer": "function (request: 'GenerateImageRequest', *, page_url: 'str | None' = None, project_id: 'str | None' = None) -> 'bool' sha=3402dae1831304be", diff --git a/tests/api/transports/test_direct_http.py b/tests/api/transports/test_direct_http.py new file mode 100644 index 000000000..e0912d040 --- /dev/null +++ b/tests/api/transports/test_direct_http.py @@ -0,0 +1,1310 @@ +from __future__ import annotations + +import asyncio +import json +from dataclasses import replace +from pathlib import Path +from typing import Any +from unittest.mock import AsyncMock, MagicMock + +import httpx +import pytest + +from gflow_cli.api import flow_wire +from gflow_cli.api.dto import GeneratedImage +from gflow_cli.api.image import AgentInstruction, Aspect, GenerateImageRequest, ImageRef, Model +from gflow_cli.api.transports._mc_common import UNUSUAL_ACTIVITY_REASON +from gflow_cli.api.transports._mc_submit_observe import ogiz0b_reply_images +from gflow_cli.api.transports.direct_http import DirectHttpTransport, direct_can_serve +from gflow_cli.api.transports.ui_automation import UiAutomationTransport +from gflow_cli.config import get_settings +from gflow_cli.errors import NetworkError, WafRejectionError, WireFormatError +from tests.api.transports.test_migrated_images import MEDIA, URL, WORKFLOW, image_payload + + +@pytest.fixture(autouse=True) +def _clean_flow_wire(monkeypatch: pytest.MonkeyPatch) -> Any: + flow_wire.reset_state() + monkeypatch.setattr(flow_wire, "getproxies", dict) + yield + flow_wire.reset_state() + + +def test_direct_can_serve_plain_t2i() -> None: + req = GenerateImageRequest(prompt="A cinematic view of mountains") + assert direct_can_serve(req) is True + + +@pytest.mark.parametrize("aspect", list(Aspect)) +def test_direct_can_serve_every_measured_aspect(aspect: Aspect) -> None: + assert direct_can_serve(GenerateImageRequest(prompt="x", aspect=aspect)) is True + + +@pytest.mark.parametrize("count", [1, 2, 3, 4]) +def test_direct_can_serve_every_count_flow_offers(count: int) -> None: + """One entry per image in one POST: 2, 3 and 4 entries returned 2, 3 and 4 images live.""" + assert direct_can_serve(GenerateImageRequest(prompt="x", count=count)) is True + + +@pytest.mark.parametrize( + "kwargs", + [ + {"refs": (ImageRef(name="00000000-0000-0000-0000-000000000001"),)}, + {"ref_paths": (Path("image.png"),)}, + {"reference_entities": ("entity-1",)}, + {"instructions": (AgentInstruction(text="keep lighting dark"),)}, + {"prompt": "A photo of @Alice in wonderland"}, + ], +) +def test_direct_can_serve_excluded_shapes(kwargs: dict[str, object]) -> None: + base = {"prompt": "A cinematic view of mountains"} + req = GenerateImageRequest(**{**base, **kwargs}) + assert direct_can_serve(req) is False + + +def test_ogiz0b_reply_images_success() -> None: + payload = image_payload() + frame_json = json.dumps( + [["wrb.fr", "ogiZ0b", json.dumps(payload), None, None, None, "generic"]] + ) + text = f")]}}'\n{frame_json}" + req = GenerateImageRequest(prompt="a blue cup") + images = ogiz0b_reply_images(text, req) + assert len(images) == 1 + img = images[0] + assert isinstance(img, GeneratedImage) + assert img.media_name == MEDIA + assert img.workflow_id == WORKFLOW + assert img.prompt == "a blue cup" + assert img.seed == 12345 + assert img.aspect_ratio == Aspect.PORTRAIT.value + assert img.dimensions == (1376, 768) + assert img.display_name == "Blue cup" + assert img.fife_url == URL + + +def test_ogiz0b_reply_images_no_frame() -> None: + req = GenerateImageRequest(prompt="a blue cup") + with pytest.raises(WireFormatError, match="migrated image submit returned no ogiZ0b frame"): + ogiz0b_reply_images(")]}'\n", req) + + +def test_ogiz0b_reply_images_refusal() -> None: + req = GenerateImageRequest(prompt="a blue cup") + err_body = json.dumps( + [["wrb.fr", "ogiZ0b", None, None, None, [3, None, [[UNUSUAL_ACTIVITY_REASON]]], "generic"]] + ) + text = f")]}}'\n{err_body}" + with pytest.raises(WafRejectionError): + ogiz0b_reply_images(text, req) + + +def _valid_ogiz0b_text() -> str: + payload = image_payload() + frame_json = json.dumps( + [["wrb.fr", "ogiZ0b", json.dumps(payload), None, None, None, "generic"]] + ) + return f")]}}'\n{frame_json}" + + +def _make_fake_page(url: str = "https://flow.google.com/project/proj-123") -> MagicMock: + page = MagicMock() + page.url = url + # Like Playwright: a goto moves page.url (the served host is read after navigating). + page.goto = AsyncMock(side_effect=lambda target, **_: setattr(page, "url", target)) + page.context = MagicMock() + page.context.cookies = AsyncMock( + return_value=[{"name": "SID", "value": "test_sid", "domain": ".google.com", "path": "/"}] + ) + return page + + +@pytest.fixture +def mock_mint_and_body(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", + AsyncMock(return_value="mock_token"), + ) + monkeypatch.setattr( + "gflow_cli.api.transports.frame_builder.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + + +@pytest.fixture +def transport(tmp_path: Path) -> DirectHttpTransport: + t = DirectHttpTransport() + t._setup_done = True + t._profile_dir = tmp_path + t._page = _make_fake_page() + t.park_deferred_page = AsyncMock() # type: ignore[method-assign] + return t + + +@pytest.mark.asyncio +async def test_direct_http_happy_path( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + post_count = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal post_count + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if request.method == "POST": + post_count += 1 + return httpx.Response(200, text=_valid_ogiz0b_text()) + return httpx.Response(404) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + images = await transport.generate_images(project_id="proj-123", request=req) + + assert len(images) == 1 + assert images[0].transport == "direct_http" + assert transport.last_image_route == "migrated" + assert not ui_called + assert post_count == 1 + + +@pytest.mark.asyncio +async def test_direct_http_unsupported_shape_falls_back_to_ui( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + calls: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + calls.append(request.method) # any request at all means selection came too late + raise AssertionError(f"unexpected {request.method} {request.url}") + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + # A model with no measured wire name: refused by the selector, before any HTTP work. + req = GenerateImageRequest(prompt="a blue cup", model=Model.GEM_PIX_2) + await transport.generate_images(project_id="proj-123", request=req) + + assert ui_called + assert calls == [] + + +@pytest.mark.asyncio +async def test_direct_http_pre_send_cookie_failure_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + transport._page.context.cookies = AsyncMock(side_effect=RuntimeError("cookie unreadable")) + post_count = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal post_count + if request.method == "POST": + post_count += 1 + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + + assert ui_called + assert post_count == 0 + + +@pytest.mark.asyncio +async def test_direct_http_pre_send_shell_tokens_failure_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response(401, text="Unauthorized") + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_pre_send_mint_failure_falls_back( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", + AsyncMock(side_effect=RuntimeError("minting failed")), + ) + monkeypatch.setattr( + "gflow_cli.api.transports.frame_builder.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + + def handler(request: httpx.Request) -> httpx.Response: + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_pre_send_connect_error_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + raise httpx.ConnectError("Connection refused") + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_post_403_falls_back_to_ui( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + post_count = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal post_count + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if request.method == "POST": + post_count += 1 + return httpx.Response(403, text="Forbidden") + return httpx.Response(404) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + + assert ui_called + assert post_count == 1 + + +@pytest.mark.asyncio +async def test_direct_http_post_500_raises_network_error( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + post_count = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal post_count + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if request.method == "POST": + post_count += 1 + return httpx.Response(500, text="Internal Server Error") + return httpx.Response(404) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + with pytest.raises(NetworkError) as exc_info: + await transport.generate_images(project_id="proj-123", request=req) + + assert exc_info.value.next_action == "reconcile" + assert "not resent" in exc_info.value.detail + assert not ui_called + assert post_count == 1 + + +@pytest.mark.asyncio +async def test_direct_http_post_timeout_raises_network_error( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + post_count = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal post_count + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if request.method == "POST": + post_count += 1 + raise httpx.ReadTimeout("Request timed out") + return httpx.Response(404) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + with pytest.raises(NetworkError) as exc_info: + await transport.generate_images(project_id="proj-123", request=req) + + assert exc_info.value.next_action == "reconcile" + assert "not resent" in exc_info.value.detail + assert not ui_called + assert post_count == 1 + + +@pytest.mark.asyncio +async def test_direct_http_setup_not_done_raises(transport: DirectHttpTransport) -> None: + transport._setup_done = False + req = GenerateImageRequest(prompt="a blue cup") + with pytest.raises(RuntimeError, match="setup.*must be called"): + await transport.generate_images(project_id="proj-123", request=req) + + +@pytest.mark.asyncio +async def test_direct_http_no_project_id_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id=None, request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_no_profile_dir_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + transport._profile_dir = None + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_route_not_migrated_falls_back( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, mock_mint_and_body: None +) -> None: + monkeypatch.setattr(get_settings(), "flow_host", "labs.google") + transport._page.url = "https://labs.google/fx/tools/flow" + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_proxy_configured_falls_back( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, mock_mint_and_body: None +) -> None: + monkeypatch.setattr(flow_wire, "getproxies", lambda: {"https": "http://127.0.0.1:8080"}) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_page_navigates_to_project_when_needed( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + transport._page.url = "https://flow.google.com/other" + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + # The first navigation is the mint's; the park after the run is the second. + assert ( + transport._page.goto.await_args_list[0].args[0] + == "https://flow.google.com/project/proj-123" + ) + + +@pytest.mark.asyncio +async def test_direct_http_navigation_error_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + transport._page.url = "https://flow.google.com/other" + transport._page.goto = AsyncMock(side_effect=RuntimeError("nav failed")) + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_post_transport_error_raises_network_error( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if request.method == "POST": + raise httpx.ProtocolError("Protocol violation") + return httpx.Response(404) + + transport._http_transport = httpx.MockTransport(handler) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + + req = GenerateImageRequest(prompt="a blue cup") + with pytest.raises(NetworkError) as exc_info: + await transport.generate_images(project_id="proj-123", request=req) + + assert exc_info.value.next_action == "reconcile" + assert "not resent" in exc_info.value.detail + assert not ui_called + + +@pytest.mark.asyncio +async def test_direct_http_empty_cookies_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + transport._page.context.cookies = AsyncMock(return_value=[]) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_user_agent_included( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, mock_mint_and_body: None +) -> None: + monkeypatch.setattr(flow_wire, "user_agent", lambda _p: "CustomUA/1.0") + recorded_ua = None + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal recorded_ua + if request.method == "GET": + recorded_ua = request.headers.get("user-agent") + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert recorded_ua == "CustomUA/1.0" + + +@pytest.mark.asyncio +async def test_direct_http_shell_tokens_unexpected_error_falls_back( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, mock_mint_and_body: None +) -> None: + monkeypatch.setattr( + flow_wire, + "shell_tokens", + AsyncMock(side_effect=RuntimeError("unexpected shell error")), + ) + ui_called = False + + async def mock_ui_locked(*args: Any, **kwargs: Any) -> list[GeneratedImage]: + nonlocal ui_called + ui_called = True + return [] + + transport._generate_images_locked = mock_ui_locked # type: ignore[method-assign] + req = GenerateImageRequest(prompt="a blue cup") + await transport.generate_images(project_id="proj-123", request=req) + assert ui_called + + +@pytest.mark.asyncio +async def test_direct_http_setup_stores_profile_dir(tmp_path: Path) -> None: + t = DirectHttpTransport() + fake_page = _make_fake_page() + await t.setup(tmp_path, page=fake_page) + assert t._profile_dir == tmp_path + assert t._page is fake_page + + +@pytest.mark.asyncio +async def test_direct_http_sends_the_migrated_wire_model( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """NARWHAL is sent as BELUGA on flow.google.com; Flow no longer lists NARWHAL (#958).""" + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=mock_body&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_ogiz0b_body", builder) + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + await transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")) + assert builder.call_args.kwargs["model"] == "BELUGA" + + +@pytest.mark.parametrize("model", [m for m in Model if m is not Model.NARWHAL]) +def test_a_model_with_no_measured_migrated_wire_name_is_not_served(model: Model) -> None: + assert not direct_can_serve(GenerateImageRequest(prompt="x", model=model)) + + +@pytest.mark.asyncio +async def test_direct_http_sends_one_seed_per_image_and_the_aspect( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=mock_body&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_ogiz0b_body", builder) + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + req = GenerateImageRequest(prompt="x", aspect=Aspect.LANDSCAPE, count=2) + await transport.generate_images(project_id="proj-123", request=req) + kwargs = builder.call_args.kwargs + assert len(kwargs["entry_seeds"]) == 2 + assert len(set(kwargs["entry_seeds"])) == 2 + assert kwargs["aspect"] is Aspect.LANDSCAPE + + +_IN_PROJECT = ImageRef( + name="00000000-0000-0000-0000-000000000002", display_name="Lighthouse", in_project=True +) + + +def test_direct_can_serve_one_in_project_reference() -> None: + assert direct_can_serve(GenerateImageRequest(prompt="x", refs=(_IN_PROJECT,))) is True + + +@pytest.mark.parametrize( + "kwargs", + [ + {"refs": (_IN_PROJECT, replace(_IN_PROJECT, name="00000000-0000-0000-0000-000000000003"))}, + {"refs": (replace(_IN_PROJECT, display_name=""),)}, + {"refs": (replace(_IN_PROJECT, in_project=False),)}, + {"refs": (_IN_PROJECT,), "count": 2}, + ], +) +def test_direct_can_serve_refuses_unmeasured_reference_shapes(kwargs: dict[str, object]) -> None: + assert direct_can_serve(GenerateImageRequest(prompt="x", **kwargs)) is False # type: ignore[arg-type] + + +@pytest.mark.asyncio +async def test_a_mint_on_a_page_still_loading_recaptcha_is_retried_not_dropped( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """Live 2026-11-23: an i2i with --project navigates to the project and mints at once; + grecaptcha.enterprise is not loaded yet, and the run fell back to the UI.""" + from gflow_cli.errors import RecaptchaError + + monkeypatch.setattr("gflow_cli.api.transports.direct_http._MINT_RETRY_S", 0.0) + mint = AsyncMock(side_effect=[RecaptchaError("grecaptcha.enterprise not loaded"), "tok"]) + monkeypatch.setattr("gflow_cli.api.recaptcha.TokenMinter.mint", mint) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + transport._page.url = "about:blank" # type: ignore[union-attr] + images = await transport.generate_images( + project_id="proj-123", request=GenerateImageRequest(prompt="x") + ) + assert images[0].transport == "direct_http" + assert mint.await_count == 2 + + +_SKIPPER = {"reference_entities": ("entity-1",), "reference_entity_names": ("Skipper",)} + + +def test_direct_can_serve_one_named_character() -> None: + assert direct_can_serve(GenerateImageRequest(prompt="x", **_SKIPPER)) is True # type: ignore[arg-type] + + +@pytest.mark.parametrize( + "kwargs", + [ + {"reference_entities": ("entity-1",)}, # an id with no name: the chip needs both + {"reference_entities": ("entity-1",), "reference_entity_names": ("",)}, + { + "reference_entities": ("entity-1", "entity-2"), + "reference_entity_names": ("Skipper", "Mate"), + }, + {**_SKIPPER, "refs": (_IN_PROJECT,)}, + {**_SKIPPER, "count": 2}, + ], +) +def test_direct_can_serve_refuses_unmeasured_character_shapes(kwargs: dict[str, object]) -> None: + assert direct_can_serve(GenerateImageRequest(prompt="x", **kwargs)) is False # type: ignore[arg-type] + + +@pytest.mark.asyncio +async def test_direct_http_sends_the_character_pair( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=mock_body&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_ogiz0b_body", builder) + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.read_project", + AsyncMock(return_value=_project_with("Mate", "Skipper")), + ) + req = GenerateImageRequest(prompt="x", **_SKIPPER) # type: ignore[arg-type] + await transport.generate_images(project_id="proj-123", request=req) + assert builder.call_args.kwargs["characters"] == (("entity-1", "Skipper"),) + + +# --- Review fix round (code-review xhigh + ponytail-review xhigh, 2026-11-23) ---------- + + +def _shell_and(post: httpx.Response | Exception) -> httpx.MockTransport: + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if isinstance(post, Exception): + raise post + return post + + return httpx.MockTransport(handler) + + +def _watch_ui(transport: DirectHttpTransport) -> list[bool]: + calls: list[bool] = [] + + async def ui(*_: Any, **__: Any) -> list[GeneratedImage]: + calls.append(True) + return [] + + transport._generate_images_locked = ui # type: ignore[method-assign] + return calls + + +def test_agentic_ui_mode_is_not_served() -> None: + """PR-4: --ui-mode agentic would have been sent as a classic frame.""" + from gflow_cli.config import UiMode + + assert direct_can_serve(GenerateImageRequest(prompt="x", ui_mode=UiMode.AGENTIC)) is False + + +def test_a_catalogued_reference_keeps_the_ui_path() -> None: + """A catalogued ref (it carries local_path) may be stale: the UI proves it still exists + before submit and refuses at $0; a direct POST cannot (fresh review, 2026-11-23).""" + ref = replace(_IN_PROJECT, local_path="face.png", local_sha256="0" * 64) + assert direct_can_serve(GenerateImageRequest(prompt="x", refs=(ref,))) is False + + +@pytest.mark.asyncio +async def test_a_rejected_post_drops_the_cached_shell_tokens( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + """CR-B: a stale at stuck in a long-lived process failed every later direct job.""" + transport._http_transport = _shell_and(httpx.Response(500)) + _watch_ui(transport) + with pytest.raises(NetworkError): + await transport.generate_images( + project_id="proj-123", request=GenerateImageRequest(prompt="x") + ) + assert transport._profile_dir not in flow_wire._tokens + + +@pytest.mark.asyncio +@pytest.mark.parametrize("exc", [httpx.ConnectTimeout("t"), httpx.PoolTimeout("t")]) +async def test_a_connection_that_never_opened_falls_back( + transport: DirectHttpTransport, mock_mint_and_body: None, exc: Exception +) -> None: + """CR-D: ConnectTimeout is not a ConnectError; nothing was sent, so no reconcile.""" + transport._http_transport = _shell_and(exc) + ui = _watch_ui(transport) + await transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")) + assert ui == [True] + + +@pytest.mark.asyncio +@pytest.mark.parametrize("status", [302, 401]) +async def test_a_redirect_or_401_falls_back_instead_of_reconcile( + transport: DirectHttpTransport, mock_mint_and_body: None, status: int +) -> None: + """CR-J: Flow accepted nothing; telling the user to check for an image was wrong.""" + transport._http_transport = _shell_and(httpx.Response(status)) + ui = _watch_ui(transport) + await transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")) + assert ui == [True] + + +@pytest.mark.asyncio +async def test_the_page_is_parked_after_a_direct_run( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + """CR-E / PR-3: a mounted composer must not leak into the next request.""" + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + park = AsyncMock() + transport._park_composer_page = park # type: ignore[method-assign] + await transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")) + park.assert_awaited_once() + + +@pytest.mark.asyncio +async def test_no_proxy_alone_does_not_disable_the_direct_path( + transport: DirectHttpTransport, mock_mint_and_body: None, monkeypatch: pytest.MonkeyPatch +) -> None: + """CR-F: getproxies() returns a 'no' key when only NO_PROXY is set.""" + monkeypatch.setattr(flow_wire, "getproxies", lambda: {"no": "localhost"}) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + ui = _watch_ui(transport) + images = await transport.generate_images( + project_id="proj-123", request=GenerateImageRequest(prompt="x") + ) + assert ui == [] + assert images[0].transport == "direct_http" + + +@pytest.mark.asyncio +async def test_an_account_served_labs_falls_back_before_any_post( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + """CR-G: under flow_host=auto the old route check passed every URL.""" + page = transport._page + assert page is not None + page.url = "about:blank" + page.goto = AsyncMock( + side_effect=lambda *_a, **_k: setattr(page, "url", "https://labs.google/fx/tools/flow") + ) + posts: list[bool] = [] + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "POST": + posts.append(True) + return httpx.Response(200, text='"SNlM0e":"at-x","FdrFJe":"sid"') + + transport._http_transport = httpx.MockTransport(handler) + ui = _watch_ui(transport) + await transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")) + assert ui == [True] + assert posts == [] + + +@pytest.mark.asyncio +async def test_a_mint_that_never_settles_is_bounded( + transport: DirectHttpTransport, mock_mint_and_body: None, monkeypatch: pytest.MonkeyPatch +) -> None: + """CR-K: one evaluate whose promise never settles hung while holding the lock.""" + monkeypatch.setattr("gflow_cli.api.transports.direct_http._MINT_BUDGET_S", 0.2) + + async def never(*_: Any, **__: Any) -> str: + await asyncio.sleep(3600) + return "" + + monkeypatch.setattr("gflow_cli.api.recaptcha.TokenMinter.mint", never) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + ui = _watch_ui(transport) + await asyncio.wait_for( + transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")), + timeout=5, + ) + assert ui == [True] + + +@pytest.mark.asyncio +async def test_cookies_are_matched_by_domain_not_by_a_url_filter( + transport: DirectHttpTransport, mock_mint_and_body: None +) -> None: + """CR-L: a URL filter also drops path-scoped cookies (#222).""" + page = transport._page + assert page is not None + page.context.cookies = AsyncMock( + return_value=[ + {"name": "SID", "value": "a", "domain": ".google.com", "path": "/"}, + {"name": "XS", "value": "b", "domain": "flow.google.com", "path": "/_/"}, + {"name": "OTHER", "value": "c", "domain": "example.com", "path": "/"}, + # Suffix collisions a plain endswith() would accept (RFC 6265 5.1.3 refuses them). + {"name": "SUFFIX", "value": "d", "domain": ".le.com", "path": "/"}, + {"name": "HOSTONLY", "value": "e", "domain": "le.com", "path": "/"}, + {"name": "EMPTY", "value": "f", "domain": "", "path": "/"}, + ] + ) + sent: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + sent.append(request.headers.get("cookie", "")) + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + return httpx.Response(200, text=_valid_ogiz0b_text()) + + transport._http_transport = httpx.MockTransport(handler) + await transport.generate_images(project_id="proj-123", request=GenerateImageRequest(prompt="x")) + assert sent[-1] == "SID=a; XS=b" + page.context.cookies.assert_awaited_once_with() + + +# --- A bare @Name mention (T2.2): the name is resolved to the project's character id ----- + + +def _project_with(*names: str) -> Any: + from gflow_cli.api.character import Character + from gflow_cli.api.transports.migrated_character import ProjectRead + + chars = tuple( + Character( + entity_id=f"entity-{i}", + display_name=name, + project_id="proj-123", + workflow_ids=(), + voice=None, + personality=None, + thumbnail_media_id=None, + ) + for i, name in enumerate(names) + ) + return ProjectRead(characters=chars, voices=()) + + +def test_a_bare_mention_name_is_served() -> None: + req = GenerateImageRequest(prompt="Skipper on a pier", reference_entity_names=("Skipper",)) + assert direct_can_serve(req) is True + + +@pytest.mark.asyncio +async def test_a_bare_mention_is_resolved_to_the_project_character_id( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=mock_body&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_ogiz0b_body", builder) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.read_project", + AsyncMock(return_value=_project_with("Mate", "Skipper")), + ) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + req = GenerateImageRequest(prompt="Skipper on a pier", reference_entity_names=("Skipper",)) + images = await transport.generate_images(project_id="proj-123", request=req) + assert builder.call_args.kwargs["characters"] == (("entity-1", "Skipper"),) + assert images[0].transport == "direct_http" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("names", [(), ("Skipper", "Skipper")]) +async def test_a_mention_with_no_or_several_matches_falls_back_before_any_post( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, names: tuple[str, ...] +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.read_project", + AsyncMock(return_value=_project_with(*names)), + ) + posts: list[bool] = [] + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "POST": + posts.append(True) + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + + transport._http_transport = httpx.MockTransport(handler) + ui = _watch_ui(transport) + req = GenerateImageRequest(prompt="Skipper on a pier", reference_entity_names=("Skipper",)) + await transport.generate_images(project_id="proj-123", request=req) + assert ui == [True] + assert posts == [] + + +@pytest.mark.asyncio +async def test_a_mention_matches_the_picker_rule_trimmed_and_case_insensitive( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """Fresh review: @kael must find "Kael " as the UI picker does (_mc_mention.py).""" + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=mock_body&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_ogiz0b_body", builder) + read = AsyncMock(return_value=_project_with("Mate", "Kael ")) + monkeypatch.setattr("gflow_cli.api.transports.direct_http.read_project", read) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + req = GenerateImageRequest(prompt="kael on a pier", reference_entity_names=("kael",)) + await transport.generate_images(project_id="proj-123", request=req) + assert builder.call_args.kwargs["characters"] == (("entity-1", "Kael "),) + assert read.await_args.kwargs["timeout_s"] == 15.0 + + +@pytest.mark.asyncio +async def test_names_differing_only_in_case_are_ambiguous( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """Fresh review: "Kael" and "KAEL" are one name to the picker, which refuses; so do we.""" + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.read_project", + AsyncMock(return_value=_project_with("Kael", "KAEL")), + ) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + ui = _watch_ui(transport) + req = GenerateImageRequest(prompt="Kael on a pier", reference_entity_names=("Kael",)) + await transport.generate_images(project_id="proj-123", request=req) + assert ui == [True] + + +@pytest.mark.asyncio +async def test_an_entity_id_the_project_does_not_hold_falls_back_before_any_post( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """--reference-entity is verified against the project, as the UI attach does: a stale + or foreign id must not reach Flow on the direct path.""" + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.read_project", + AsyncMock(return_value=_project_with("Mate")), # entity-0 only; entity-1 is gone + ) + posts: list[bool] = [] + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "POST": + posts.append(True) + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + + transport._http_transport = httpx.MockTransport(handler) + ui = _watch_ui(transport) + req = GenerateImageRequest(prompt="x", **_SKIPPER) # type: ignore[arg-type] + await transport.generate_images(project_id="proj-123", request=req) + assert ui == [True] + assert posts == [] + + +@pytest.mark.asyncio +async def test_an_entity_id_uses_the_name_flow_holds_for_it( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """The chip carries the character's name as Flow knows it, not a caller's spelling.""" + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=mock_body&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_ogiz0b_body", builder) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.read_project", + AsyncMock(return_value=_project_with("Mate", "Skipper")), + ) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + req = GenerateImageRequest( + prompt="x", reference_entities=("entity-1",), reference_entity_names=("skipper",) + ) + await transport.generate_images(project_id="proj-123", request=req) + assert builder.call_args.kwargs["characters"] == (("entity-1", "Skipper"),) + + +# --- Phase 4: direct maseQ upload ---------------------------------------------------------- + +_UPLOADED = "f9efcc22-495d-4c89-9b9b-f9dce015742b" + + +def _maseq_reply(media_id: str = _UPLOADED) -> str: + frame = json.dumps( + [["wrb.fr", "maseQ", json.dumps([[media_id, "proj-123"]]), None, None, None, "generic"]] + ) + return f")]}}'\n{frame}" + + +def _png(tmp_path: Path) -> Path: + f = tmp_path / "face.png" + f.write_bytes(b"\x89PNG\r\n\x1a\n" + b"\x00" * 32) + return f + + +@pytest.mark.asyncio +async def test_a_local_file_is_uploaded_with_one_direct_maseq_post( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + mint = AsyncMock(return_value="mock_token") + monkeypatch.setattr("gflow_cli.api.recaptcha.TokenMinter.mint", mint) + posts: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + posts.append(request.url.params["rpcids"]) + return httpx.Response(200, text=_maseq_reply()) + + transport._http_transport = httpx.MockTransport(handler) + ui = AsyncMock() + monkeypatch.setattr(UiAutomationTransport, "upload_reference", ui) + ref = await transport.upload_reference(project_id="proj-123", path=_png(tmp_path)) + assert ref is not None + assert ref.name == _UPLOADED + assert ref.in_project is True + assert ref.display_name.startswith("face-") and ref.display_name.endswith(".png") + assert posts == ["maseQ"] + assert mint.await_args.args[0] == "UPLOAD_IMAGE" + ui.assert_not_awaited() + + +@pytest.mark.asyncio +async def test_an_upload_that_cannot_start_uses_the_ui_upload( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + page = transport._page + assert page is not None + page.context.cookies = AsyncMock(return_value=[]) # no session: nothing can be sent + ui = AsyncMock(return_value=None) + monkeypatch.setattr(UiAutomationTransport, "upload_reference", ui) + await transport.upload_reference(project_id="proj-123", path=_png(tmp_path)) + ui.assert_awaited_once() + + +@pytest.mark.asyncio +async def test_an_upload_failing_after_the_send_is_not_resent( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + transport._http_transport = _shell_and(httpx.Response(500)) + ui = AsyncMock() + monkeypatch.setattr(UiAutomationTransport, "upload_reference", ui) + with pytest.raises(NetworkError) as caught: + await transport.upload_reference(project_id="proj-123", path=_png(tmp_path)) + assert caught.value.next_action == "reconcile" + assert "upload" in (caught.value.remediation_hint or "") + ui.assert_not_awaited() + + +@pytest.mark.asyncio +async def test_an_upload_reply_without_a_media_id_is_a_wire_format_error( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + transport._http_transport = _shell_and(httpx.Response(200, text=")]}'\n[]")) + with pytest.raises(WireFormatError): + await transport.upload_reference(project_id="proj-123", path=_png(tmp_path)) + + +@pytest.mark.asyncio +async def test_the_character_read_has_one_outer_deadline( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch +) -> None: + """CodeRabbit: read_project's per-attempt budget plus its retry could stack past 15 s.""" + monkeypatch.setattr("gflow_cli.api.transports.direct_http._CHARACTER_READ_S", 0.2) + + async def slow(*_: Any, **__: Any) -> Any: + await asyncio.sleep(3600) + + monkeypatch.setattr("gflow_cli.api.transports.direct_http.read_project", slow) + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + transport._http_transport = _shell_and(httpx.Response(200, text=_valid_ogiz0b_text())) + ui = _watch_ui(transport) + req = GenerateImageRequest(prompt="x", reference_entity_names=("Skipper",)) + await asyncio.wait_for(transport.generate_images(project_id="proj-123", request=req), timeout=5) + assert ui == [True] + + +@pytest.mark.asyncio +async def test_the_upload_mime_type_comes_from_the_bytes_not_the_name( + transport: DirectHttpTransport, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + """CodeRabbit: an extensionless JPEG was sent as image/png (name-based guess).""" + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", AsyncMock(return_value="mock_token") + ) + builder = MagicMock(return_value="f.req=x&at=at-x&") + monkeypatch.setattr("gflow_cli.api.transports.direct_http.build_maseq_body", builder) + transport._http_transport = _shell_and(httpx.Response(200, text=_maseq_reply())) + portrait = tmp_path / "portrait" # no extension + portrait.write_bytes(b"\xff\xd8\xff\xe0" + b"\x00" * 32) + await transport.upload_reference(project_id="proj-123", path=portrait) + assert builder.call_args.kwargs["mime"] == "image/jpeg" diff --git a/tests/api/transports/test_factory.py b/tests/api/transports/test_factory.py index d2ffac221..aa1a207e9 100644 --- a/tests/api/transports/test_factory.py +++ b/tests/api/transports/test_factory.py @@ -84,3 +84,18 @@ def test_resolve_transport_name_precedence(monkeypatch): monkeypatch.setenv("GFLOW_CLI_TRANSPORT", "sapisidhash") assert resolve_transport_name() == "sapisidhash" assert resolve_transport_name("bearer") == "bearer" # explicit arg wins over env + + +def test_direct_http_registration() -> None: + from gflow_cli.api.transports import ( + EXPERIMENTAL_TRANSPORTS, + STANDALONE_ONLY_TRANSPORTS, + make_transport, + ) + from gflow_cli.api.transports.direct_http import DirectHttpTransport + + assert "direct_http" in EXPERIMENTAL_TRANSPORTS + assert "direct_http" not in STANDALONE_ONLY_TRANSPORTS + t = make_transport("direct_http") + assert isinstance(t, DirectHttpTransport) + assert t.name == "direct_http" diff --git a/tests/api/transports/test_frame_builder.py b/tests/api/transports/test_frame_builder.py new file mode 100644 index 000000000..08eb60454 --- /dev/null +++ b/tests/api/transports/test_frame_builder.py @@ -0,0 +1,201 @@ +"""Tests for the pure ogiZ0b frame builder.""" + +from __future__ import annotations + +import json +from urllib.parse import parse_qs + +import pytest + +from gflow_cli.api.image import Aspect +from gflow_cli.api.transports.frame_builder import build_ogiz0b_body + + +def _decode_body(body: str) -> tuple[str, list[object], str]: + form = parse_qs(body) + f_req_value = form["f.req"][0] + outer = json.loads(f_req_value) + rpcid, inner_json, _, _ = outer[0][0] + return rpcid, json.loads(inner_json), inner_json + + +def test_builds_proven_ogiz0b_wire_shape() -> None: + body = build_ogiz0b_body( + prompt="a fox", + model="IMAGEN", + project_id="project-123", + recaptcha_token="captcha-456", + at_token="at-789", + batch_id="batch-abc", + entry_seeds=(12345,), + ) + + form = parse_qs(body) + outer = json.loads(form["f.req"][0]) + assert len(outer) == 1 + assert len(outer[0]) == 1 + rpcid, inner_json, none_value, generic = outer[0][0] + assert rpcid == "ogiZ0b" + assert isinstance(inner_json, str) + assert none_value is None + assert generic == "generic" + assert form["at"] == ["at-789"] + + inner = json.loads(inner_json) + ctx = inner[3] + entry = inner[1][0] + assert len(ctx) == 11 + assert ctx[5] == "project-123" + assert ctx[10] == ["captcha-456", 1] + assert len(entry) == 12 + assert entry[3] == 12345 + assert entry[4] == 2 + assert entry[5] == "IMAGEN" + assert entry[8] == [[["a fox"]]] + assert inner[4] == ["batch-abc"] + assert entry[7] == ctx + assert entry[7] is not ctx + + +def test_build_is_deterministic_for_the_same_inputs() -> None: + values = { + "prompt": "a fox", + "model": "IMAGEN", + "project_id": "project-123", + "recaptcha_token": "captcha-456", + "at_token": "at-789", + "batch_id": "batch-abc", + "entry_seeds": (12345,), + } + + assert build_ogiz0b_body(**values) == build_ogiz0b_body(**values) + + +def test_prompt_round_trips_through_form_and_compact_inner_json() -> None: + prompt = 'a "fox" & café\n' + body = build_ogiz0b_body( + prompt=prompt, + model="IMAGEN", + project_id="project-123", + recaptcha_token="captcha-456", + at_token="at-789", + batch_id="batch-abc", + entry_seeds=(12345,), + ) + + rpcid, inner, inner_json = _decode_body(body) + + assert rpcid == "ogiZ0b" + assert inner[1][0][8] == [[[prompt]]] + assert inner_json == json.dumps(inner, separators=(",", ":")) + + +@pytest.mark.parametrize( + ("aspect", "wire"), + [ + (Aspect.SQUARE, 1), + (Aspect.PORTRAIT, 2), + (Aspect.LANDSCAPE, 3), + (Aspect.PORTRAIT_THREE_FOUR, 4), + (Aspect.LANDSCAPE_FOUR_THREE, 5), + ], +) +def test_aspect_goes_to_entry_4_as_flows_own_enum(aspect: Aspect, wire: int) -> None: + """Values measured 2026-11-22 from route-aborted captures of Flow's own submit.""" + _, inner, _ = _decode_body(_build(aspect=aspect)) + assert inner[1][0][4] == wire + + +def test_count_is_one_entry_per_image_each_with_its_own_seed() -> None: + _, inner, _ = _decode_body(_build(entry_seeds=(11, 22))) + entries = inner[1] + assert [e[3] for e in entries] == [11, 22] + assert all(e[7] == inner[3] for e in entries) + assert entries[0] is not entries[1] + assert inner[4] == ["batch-abc"] # one batch id for the whole POST + + +def test_no_seed_is_refused() -> None: + with pytest.raises(ValueError, match="entry_seeds"): + _build(entry_seeds=()) + + +def _build(**overrides: object) -> str: + values: dict[str, object] = { + "prompt": "a fox", + "model": "IMAGEN", + "project_id": "project-123", + "recaptcha_token": "captcha-456", + "at_token": "at-789", + "batch_id": "batch-abc", + "entry_seeds": (12345,), + } + return build_ogiz0b_body(**(values | overrides)) # type: ignore[arg-type] + + +def test_an_in_project_reference_rides_slot_2_and_a_prompt_chip() -> None: + """Flow's own in-project I2I submit, captured 2026-11-22: the media id at entry[2], and + the same id + display name as a chip ahead of the text (which gains two spaces).""" + _, inner, _ = _decode_body(_build(references=(("media-1", "Lighthouse"),))) + entry = inner[1][0] + assert entry[2] == [["media-1", None, None, None, 1]] + assert entry[8] == [[[None, [["media-1", "Lighthouse"]]], [" a fox"]]] + + +def test_no_reference_keeps_the_plain_prompt_document() -> None: + _, inner, _ = _decode_body(_build()) + assert inner[1][0][2] is None + assert inner[1][0][8] == [[["a fox"]]] + + +def test_a_character_rides_slot_10_and_a_character_chip() -> None: + """Flow's own @Character submit, captured 2026-11-23: the entity id at entry[10], and a + character chip [null, [null, null, [id, name]]] ahead of the text (one leading space).""" + _, inner, _ = _decode_body(_build(characters=(("entity-1", "Skipper"),))) + entry = inner[1][0] + assert entry[10] == [["entity-1"]] + assert entry[2] is None + assert entry[8] == [[[None, [None, None, ["entity-1", "Skipper"]]], [" a fox"]]] + + +def test_no_character_leaves_slot_10_empty() -> None: + _, inner, _ = _decode_body(_build()) + assert inner[1][0][10] is None + + +def test_an_upload_body_matches_flows_own_maseq_frame() -> None: + """Captured 2026-11-23 from Flow's own upload: ctx with the token, inline base64 bytes, + MIME type, 1, four nulls, the display name, null, two client UUIDs.""" + from gflow_cli.api.transports.frame_builder import build_maseq_body + + body = build_maseq_body( + project_id="project-123", + recaptcha_token="captcha-456", + at_token="at-789", + image_bytes=b"\x89PNG\r\n", + mime="image/png", + display_name="face-1a2b3c4d.png", + request_ids=("ID-A", "ID-B"), + ) + form = parse_qs(body) + assert form["at"] == ["at-789"] + rpcid, inner_json, _, generic = json.loads(form["f.req"][0])[0][0] + assert (rpcid, generic) == ("maseQ", "generic") + frame = json.loads(inner_json) + assert frame[0] == [ + None, + 22, + None, + None, + None, + "project-123", + None, + None, + None, + None, + ["captcha-456", 1], + ] + assert frame[1] == "iVBORw0K" # base64 of the bytes + assert frame[2:8] == ["image/png", 1, None, None, None, None] + assert frame[8:] == ["face-1a2b3c4d.png", None, "ID-A", "ID-B"] + assert inner_json == json.dumps(frame, separators=(",", ":")) diff --git a/tests/api/transports/test_migrated_project.py b/tests/api/transports/test_migrated_project.py index cf3884bdb..2c5c6df28 100644 --- a/tests/api/transports/test_migrated_project.py +++ b/tests/api/transports/test_migrated_project.py @@ -7,6 +7,7 @@ from __future__ import annotations +import asyncio import json import sys from types import SimpleNamespace @@ -52,6 +53,15 @@ async def wait_for(self, **_: Any) -> None: raise mc.PlaywrightTimeoutError(f"waiting for {self.sel}") async def click(self, **_: Any) -> None: + if self.page.click_times_out: + if self.page.click_sends_first: # the click dispatched, then Playwright timed out + self.page.send_create_request() + if self.page.reply_after_timeout: # ...and Flow's reply follows + reply = self.page.fire(self.page.on_click.get(self.sel)) + self.page.pending.append(asyncio.ensure_future(reply)) + elif self.page.click_sends_late: # the page's handler sends after the timeout + asyncio.get_running_loop().call_later(0.05, self.page.send_create_request) + raise mc.PlaywrightTimeoutError("Locator.click: Timeout 15000ms exceeded") self.page.clicks.append(self.sel) await self.page.fire(self.page.on_click.get(self.sel)) @@ -88,11 +98,21 @@ def __init__(self, *, url: str = "about:blank") -> None: self.on_enter: tuple[str, str] | None = None self.navigate_on_create: str | None = None self.fill_times_out = False + self.click_times_out = False + self.click_sends_first = False + self.click_sends_late = False + self.reply_after_timeout = False + self.pending: list[Any] = [] + self.request_handlers: list[Any] = [] self.action_timeouts: list[Any] = [] self.url_waits: list[Any] = [] self._handlers: list[Any] = [] self.keyboard = self + def send_create_request(self) -> None: + for h in list(self.request_handlers): + h(SimpleNamespace(url=_batch(mc.CREATE_PROJECT_RPC), post_data=None)) + async def wait_for_url(self, predicate: Any, **kw: Any) -> None: self.url_waits.append(kw.get("timeout")) if not predicate(self.url): @@ -108,10 +128,14 @@ def locator(self, sel: str) -> _Loc: def on(self, event: str, handler: Any) -> None: if event == "response": self._handlers.append(handler) + elif event == "request": + self.request_handlers.append(handler) def remove_listener(self, event: str, handler: Any) -> None: if event == "response" and handler in self._handlers: self._handlers.remove(handler) + elif event == "request" and handler in self.request_handlers: + self.request_handlers.remove(handler) async def fire(self, reply: tuple[str, str] | None) -> None: if reply is None: @@ -165,6 +189,66 @@ async def test_create_without_the_fab_is_drift_naming_the_anchor() -> None: await mc.create_project(page, "x", timeout_s=0.1) # type: ignore[arg-type] +async def test_create_click_timeout_is_typed_drift_charging_nothing( + monkeypatch: pytest.MonkeyPatch, +) -> None: + # The largest crash group in the first telemetry week: the FAB rendered but the click + # timed out, and Playwright's TimeoutError escaped create_project as an unhandled exit 1. + from gflow_cli.json_output import exit_code_for + + monkeypatch.setattr(mc, "CREATE_LATE_REQUEST_GRACE_S", 0.1) + page = _page_creating() + page.click_times_out = True + + with pytest.raises(UiSelectorDriftError, match="new-project button") as exc: + await mc.create_project(page, "x", timeout_s=0.1) # type: ignore[arg-type] + assert exit_code_for(exc.value) == 23 + assert exc.value.charged == "no" + assert "--project" in exc.value.remediation_hint + + +async def test_create_click_timeout_after_the_request_left_is_outcome_unknown() -> None: + # Flow may have made the project, so this is never drift, and never retryable (#1037). + from gflow_cli.errors import RpcResponseUnavailableError, is_retryable + + page = FakePage() + page.click_times_out = True + page.click_sends_first = True + + with pytest.raises(RpcResponseUnavailableError, match=mc.CREATE_PROJECT_RPC) as exc: + await mc.create_project(page, "x", timeout_s=0.1) # type: ignore[arg-type] + assert not is_retryable(exc.value) + assert page.request_handlers == [] # the watch is removed + + +async def test_create_click_timeout_then_flows_reply_is_a_created_project() -> None: + # The common good case: the click dispatched, Playwright timed out, Flow answered. + page = _page_creating(title="x") + page.click_times_out = True + page.click_sends_first = True + page.reply_after_timeout = True + + info = await mc.create_project(page, "x", timeout_s=1.0) # type: ignore[arg-type] + + assert info.project_id == PID + assert info.title == "x" + + +async def test_create_click_timeout_with_a_late_request_is_outcome_unknown( + monkeypatch: pytest.MonkeyPatch, +) -> None: + # The page's click handler can send the create just after Playwright gave up. + from gflow_cli.errors import RpcResponseUnavailableError + + monkeypatch.setattr(mc, "CREATE_LATE_REQUEST_GRACE_S", 0.1) # the request lands at 0.05 s + page = FakePage() + page.click_times_out = True + page.click_sends_late = True + + with pytest.raises(RpcResponseUnavailableError, match=mc.CREATE_PROJECT_RPC): + await mc.create_project(page, "x", timeout_s=0.1) # type: ignore[arg-type] + + async def test_create_with_no_reply_and_no_navigation_is_outcome_unknown() -> None: # #1037: the click was sent, so "no reply" is not "not created" -- never retryable. from gflow_cli.errors import RpcResponseUnavailableError, is_retryable diff --git a/tests/cli/test_cli_image.py b/tests/cli/test_cli_image.py index 0fcc23442..c1b5c8545 100644 --- a/tests/cli/test_cli_image.py +++ b/tests/cli/test_cli_image.py @@ -1622,3 +1622,68 @@ def test_t2i_instructions_rejects_multi_prompt(self, runner: CliRunner) -> None: assert result.exit_code == 2, result.output assert "single-prompt" in result.output + + +def test_image_batch_gflow_error_before_any_prompt_exits_with_its_code(tmp_path: Path) -> None: + """`image batch` on the migrated host exits 36 with the error's message instead of a + traceback and exit 1.""" + from gflow_cli.cli import main + from gflow_cli.errors import FlowHostMigratedError + + async def _raise(**_kwargs: object) -> list[object]: + raise FlowHostMigratedError(detail="Flow served the migrated flow.google.com frontend") + + manifest = tmp_path / "prompts.tsv" + manifest.write_text("a red brick\na blue brick\n") + with ( + patch("gflow_cli.cli_image._resolve_profile", return_value="default"), + patch("gflow_cli.cli_image._make_provider_dir", return_value=tmp_path / "profile"), + patch("gflow_cli.cli_image.run_manifest_image_batch", side_effect=_raise), + ): + result = CliRunner().invoke( + main, ["image", "batch", str(manifest), "--out", str(tmp_path / "out")] + ) + + assert result.exception is None or isinstance(result.exception, SystemExit), result.exception + assert result.exit_code == 36, result.output + assert "migrated flow.google.com frontend" in result.output + + +def test_image_batch_partial_failure_lists_saved_images_then_exits(tmp_path: Path) -> None: + """A fail-fast stop after some prompts finished prints the saved paths and the error, + and exits with the error's code, instead of a traceback.""" + from gflow_cli.cli import main + from gflow_cli.errors import BatchPartialError, exit_code_for + from gflow_cli.image_batch import BatchOutcome, BatchPromptItem + + saved = tmp_path / "out" / "prompt_0_0.jpg" + error = BatchPartialError( + detail="prompt 2 failed", + partial_results=( + BatchOutcome( + index=0, + prompt=BatchPromptItem(text="a red brick"), + status="ok", + saved_paths=[saved], + ), + ), + ) + + async def _raise(**_kwargs: object) -> list[object]: + raise error + + manifest = tmp_path / "prompts.tsv" + manifest.write_text("a red brick\na blue brick\n") + with ( + patch("gflow_cli.cli_image._resolve_profile", return_value="default"), + patch("gflow_cli.cli_image._make_provider_dir", return_value=tmp_path / "profile"), + patch("gflow_cli.cli_image.run_manifest_image_batch", side_effect=_raise), + ): + result = CliRunner(env={"COLUMNS": "400"}).invoke( + main, ["image", "batch", str(manifest), "--out", str(tmp_path / "out")] + ) + + assert result.exception is None or isinstance(result.exception, SystemExit), result.exception + assert result.exit_code == exit_code_for(error), result.output + assert "prompt_0_0.jpg" in result.output + assert "prompt 2 failed" in result.output diff --git a/tests/data/test_recorder.py b/tests/data/test_recorder.py index 300280aa4..938209629 100644 --- a/tests/data/test_recorder.py +++ b/tests/data/test_recorder.py @@ -92,6 +92,77 @@ def test_record_generated_images_persists_generation_metadata(tmp_path: Path) -> assert "display_name" not in json.loads(asset_row["metadata_json"]) +def test_record_generated_images_persists_transport_when_present(tmp_path: Path) -> None: + saved = tmp_path / "image.png" + saved.write_bytes(b"image-bytes") + with DataStore.open(tmp_path / "gflow.db") as store: + recorder = OperationRecorder(DataRepository(store), prompt_mode="store") + project = ProjectInfo(project_id="flow-project-1", title="gflow-cli t2i") + image = GeneratedImage( + media_name="media-generated-direct", + workflow_id="workflow-generated-1", + seed=123, + prompt="prompt text", + model_name_type="NARWHAL", + aspect_ratio="IMAGE_ASPECT_RATIO_PORTRAIT", + fife_url="https://flow-content.google/path?Signature=abc", + dimensions=(1024, 1792), + transport="direct_http", + ) + req = GenerateImageRequest( + prompt="prompt text", + aspect=Aspect.PORTRAIT, + model=Model.NARWHAL, + ) + recorder.record_generated_images( + profile_name="default", + profile_dir=tmp_path / "profile_default", + project=project, + request=req, + images=[image], + saved_paths=[saved], + input_media_ids=[], + operation_kind="t2i", + ) + asset_row = store.conn.execute( + "SELECT metadata_json FROM assets WHERE flow_media_id='media-generated-direct'" + ).fetchone() + assert asset_row is not None + metadata = json.loads(asset_row["metadata_json"]) + assert metadata.get("transport") == "direct_http" + + +def test_record_generated_images_omits_transport_when_none(tmp_path: Path) -> None: + saved = tmp_path / "image.png" + saved.write_bytes(b"image-bytes") + with DataStore.open(tmp_path / "gflow.db") as store: + recorder = OperationRecorder(DataRepository(store), prompt_mode="store") + project = ProjectInfo(project_id="flow-project-1", title="gflow-cli t2i") + image = _generated_image() + assert image.transport is None + req = GenerateImageRequest( + prompt="prompt text", + aspect=Aspect.PORTRAIT, + model=Model.NARWHAL, + ) + recorder.record_generated_images( + profile_name="default", + profile_dir=tmp_path / "profile_default", + project=project, + request=req, + images=[image], + saved_paths=[saved], + input_media_ids=[], + operation_kind="t2i", + ) + asset_row = store.conn.execute( + f"SELECT metadata_json FROM assets WHERE flow_media_id='{image.media_name}'" + ).fetchone() + assert asset_row is not None + metadata = json.loads(asset_row["metadata_json"]) + assert "transport" not in metadata + + def _generated_image() -> GeneratedImage: return GeneratedImage( media_name="media-generated-1", diff --git a/tests/e2e/test_direct_image_e2e.py b/tests/e2e/test_direct_image_e2e.py new file mode 100644 index 000000000..2edb0006a --- /dev/null +++ b/tests/e2e/test_direct_image_e2e.py @@ -0,0 +1,308 @@ +"""Live E2E for the direct_http image transport (T1.6, T2.3, T2.4). + +A plain text-to-image run on ``GFLOW_CLI_TRANSPORT=direct_http`` is generated by one +direct ``ogiZ0b`` POST and recorded with ``metadata_json.transport = "direct_http"``; three +16:9 images come from one direct POST; a model with no measured wire name is routed to the +UI transport before any POST and still generates. All image runs: daily quota, zero credits. + +Opt in with: + GFLOW_CLI_E2E_PROFILE= uv run pytest -m e2e_image -v \\ + tests/e2e/test_direct_image_e2e.py +""" + +from __future__ import annotations + +import json +import os +import sqlite3 +import subprocess +import sys +from typing import TYPE_CHECKING + +import pytest + +from tests.e2e._redacted_env import RedactedEnv + +if TYPE_CHECKING: + from pathlib import Path + +pytestmark = [pytest.mark.e2e, pytest.mark.e2e_image] + +_JPEG_OR_PNG = (b"\xff\xd8\xff", b"\x89PNG\r\n\x1a\n") + + +def _t2i(env: RedactedEnv, target: Path, *extra: str) -> subprocess.CompletedProcess[str]: + return subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "image", + "t2i", + "a paper boat on a pond", + "--out-file", + str(target), + *extra, + ], + capture_output=True, + text=True, + check=False, + env=env | {"GFLOW_CLI_TRANSPORT": "direct_http"}, + ) + + +def _image_transports(env: RedactedEnv) -> list[str | None]: + with sqlite3.connect(env["GFLOW_CLI_DB_PATH"]) as db: + rows = db.execute("SELECT metadata_json FROM assets WHERE kind = 'image'").fetchall() + return [json.loads(row[0] or "{}").get("transport") for row in rows] + + +def _saved(target: Path) -> Path: + found = sorted(target.parent.glob(f"{target.stem}.*")) + assert len(found) == 1, f"expected one file for {target}, found {found}" + assert found[0].read_bytes().startswith(_JPEG_OR_PNG), f"{found[0]} is not an image" + return found[0] + + +def test_plain_t2i_is_generated_by_the_direct_transport( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + proc = _t2i(e2e_env, tmp_path / "direct.jpg") + assert proc.returncode == 0, f"gflow image t2i failed (exit {proc.returncode})" + _saved(tmp_path / "direct.jpg") + assert _image_transports(e2e_env) == ["direct_http"] + + +def test_three_landscape_images_come_from_one_direct_post( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + proc = _t2i(e2e_env, tmp_path / "wide.jpg", "--aspect", "16:9", "-n", "3") + assert proc.returncode == 0, f"gflow image t2i failed (exit {proc.returncode})" + files = sorted(p for p in tmp_path.iterdir() if p.name.startswith("wide")) + assert len(files) == 3, files + assert all(p.read_bytes().startswith(_JPEG_OR_PNG) for p in files) + assert _image_transports(e2e_env) == ["direct_http"] * 3 + + +def test_a_model_with_no_measured_wire_name_routes_to_the_ui_transport( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + proc = _t2i(e2e_env, tmp_path / "pro.jpg", "--model", "nano-pro") + assert proc.returncode == 0, f"gflow image t2i failed (exit {proc.returncode})" + _saved(tmp_path / "pro.jpg") + assert _image_transports(e2e_env) == [None] + + +def test_a_catalogued_reference_routes_to_the_ui_transport( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + """A --ref found in the catalog may be stale; the UI proves it exists before submit.""" + first = _t2i(e2e_env, tmp_path / "source.jpg") + assert first.returncode == 0, f"gflow image t2i failed (exit {first.returncode})" + with sqlite3.connect(e2e_env["GFLOW_CLI_DB_PATH"]) as db: + media_id, project_id = db.execute( + "SELECT flow_media_id, flow_project_id FROM assets WHERE kind = 'image'" + ).fetchone() + proc = subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "image", + "i2i", + "the same scene at night", + "--ref", + media_id, + "--project", + project_id, + "--out-file", + str(tmp_path / "night.jpg"), + ], + capture_output=True, + text=True, + check=False, + env=e2e_env | {"GFLOW_CLI_TRANSPORT": "direct_http"}, + ) + assert proc.returncode == 0, f"gflow image i2i failed (exit {proc.returncode})" + _saved(tmp_path / "night.jpg") + assert _image_transports(e2e_env) == ["direct_http", None] + + +@pytest.mark.skipif( + os.environ.get("GFLOW_CLI_E2E_RUN_CHARACTER") != "1", + reason="creates a Flow character (one image generation, zero credits); opt in with " + "GFLOW_CLI_E2E_RUN_CHARACTER=1", +) +def test_a_named_character_is_generated_by_the_direct_transport( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + """T2.2: --reference-entity ID --reference-entity-name NAME goes direct.""" + first = _t2i(e2e_env, tmp_path / "face.jpg") + assert first.returncode == 0, f"gflow image t2i failed (exit {first.returncode})" + with sqlite3.connect(e2e_env["GFLOW_CLI_DB_PATH"]) as db: + (project_id,) = db.execute("SELECT flow_project_id FROM assets").fetchone() + made = subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "character", + "create", + "--project", + project_id, + "--name", + "Skipper", + "--image", + str(_saved(tmp_path / "face.jpg")), + ], + capture_output=True, + text=True, + check=False, + env=e2e_env, + ) + assert made.returncode == 0, f"gflow character create failed (exit {made.returncode})" + entity_id = made.stdout.split("Character created:", 1)[1].split()[0] + proc = _t2i( + e2e_env, + tmp_path / "pier.jpg", + "--project", + project_id, + "--reference-entity", + entity_id, + "--reference-entity-name", + "Skipper", + ) + assert proc.returncode == 0, f"gflow image t2i failed (exit {proc.returncode})" + _saved(tmp_path / "pier.jpg") + assert _image_transports(e2e_env)[-1] == "direct_http" + + +def test_a_local_file_reference_is_uploaded_then_generated_directly( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + """--ref ./fresh.png: uploaded by one direct maseQ POST, then generated directly.""" + from PIL import Image + + first = _t2i(e2e_env, tmp_path / "seed.jpg") # only to obtain a project + assert first.returncode == 0, f"gflow image t2i failed (exit {first.returncode})" + with sqlite3.connect(e2e_env["GFLOW_CLI_DB_PATH"]) as db: + (project_id,) = db.execute("SELECT flow_project_id FROM assets").fetchone() + fresh = tmp_path / "fresh.png" # drawn here, so no catalog knows it + Image.new("RGB", (512, 512), (40, 110, 180)).save(fresh) + proc = subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "image", + "i2i", + "a sailing boat on this blue sea", + "--ref", + str(fresh), + "--project", + project_id, + "--out-file", + str(tmp_path / "boat.jpg"), + ], + capture_output=True, + text=True, + check=False, + env=e2e_env | {"GFLOW_CLI_TRANSPORT": "direct_http"}, + ) + assert proc.returncode == 0, f"gflow image i2i failed (exit {proc.returncode})" + _saved(tmp_path / "boat.jpg") + assert _image_transports(e2e_env)[-1] == "direct_http" + + +@pytest.mark.skipif( + os.environ.get("GFLOW_CLI_E2E_RUN_CHARACTER") != "1", + reason="creates a Flow character (one image generation, zero credits); opt in with " + "GFLOW_CLI_E2E_RUN_CHARACTER=1", +) +def test_a_bare_mention_is_generated_by_the_direct_transport( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + """T2.2: "@Name ..." reaches the transport as the name alone; its id is read from the + project and the image goes direct.""" + first = _t2i(e2e_env, tmp_path / "face.jpg") + assert first.returncode == 0, f"gflow image t2i failed (exit {first.returncode})" + with sqlite3.connect(e2e_env["GFLOW_CLI_DB_PATH"]) as db: + (project_id,) = db.execute("SELECT flow_project_id FROM assets").fetchone() + made = subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "character", + "create", + "--project", + project_id, + "--name", + "Bosun", + "--image", + str(_saved(tmp_path / "face.jpg")), + ], + capture_output=True, + text=True, + check=False, + env=e2e_env, + ) + assert made.returncode == 0, f"gflow character create failed (exit {made.returncode})" + proc = subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "image", + "t2i", + "@Bosun on a pier at sunset", + "--project", + project_id, + "--out-file", + str(tmp_path / "pier.jpg"), + ], + capture_output=True, + text=True, + check=False, + env=e2e_env | {"GFLOW_CLI_TRANSPORT": "direct_http"}, + ) + assert proc.returncode == 0, f"gflow image t2i failed (exit {proc.returncode})" + _saved(tmp_path / "pier.jpg") + assert _image_transports(e2e_env)[-1] == "direct_http" + + +def test_a_run_row_referencing_an_earlier_row_goes_direct( + e2e_env: RedactedEnv, tmp_path: Path +) -> None: + """gflow run: "ref": "batch:0" is referenced in place; both rows go direct.""" + config = tmp_path / "run.json" + config.write_text( + json.dumps( + { + "transport": "direct_http", + "prompts": [ + {"text": "a single red apple on a wooden table", "aspect_ratio": "1:1"}, + {"text": "the same apple, now green", "aspect_ratio": "1:1", "ref": "batch:0"}, + ], + } + ), + encoding="utf-8", + ) + proc = subprocess.run( + [ + sys.executable, + "-m", + "gflow_cli", + "run", + "--config", + str(config), + "--output-dir", + str(tmp_path / "run_out"), + ], + capture_output=True, + text=True, + check=False, + env=e2e_env | {"GFLOW_CLI_EXPERIMENTAL_TRANSPORTS": "1"}, + ) + assert proc.returncode == 0, f"gflow run failed (exit {proc.returncode})" + assert _image_transports(e2e_env) == ["direct_http", "direct_http"] diff --git a/tests/e2e/test_direct_image_worker_e2e.py b/tests/e2e/test_direct_image_worker_e2e.py new file mode 100644 index 000000000..ab6bb4b46 --- /dev/null +++ b/tests/e2e/test_direct_image_worker_e2e.py @@ -0,0 +1,68 @@ +"""Live proof that the queued MCP path runs the direct_http image transport (T1.7). + +The MCP server queues ``gflow_generate_image(wait=False)`` and ``FlowWorker`` runs it: a +different code path from the CLI's in-process call. This drives ``FlowWorker.process_task`` +on a ``t2i`` task whose payload names ``transport: "direct_http"`` and checks the catalog +records the image as made by that transport. + +Cost: one image (daily quota, zero credits). Opt-in: ``-m e2e_image`` with +``GFLOW_CLI_E2E_PROFILE`` set. +""" + +from __future__ import annotations + +import json +import uuid +from typing import TYPE_CHECKING + +import pytest + +from gflow_cli.worker.daemon import FlowWorker + +if TYPE_CHECKING: + from pathlib import Path + +pytestmark = [pytest.mark.e2e, pytest.mark.e2e_image] + + +@pytest.mark.asyncio +async def test_the_worker_runs_a_queued_t2i_on_the_direct_transport( + e2e_profile_dir: Path, tmp_path: Path +) -> None: + profile_name = e2e_profile_dir.name.removeprefix("profile_") + out_dir = tmp_path / "out" + out_dir.mkdir() + worker = FlowWorker(profile_name, str(tmp_path / "worker.db")) + try: + worker.db.conn.execute( # the queue's FK needs the profile row in this isolated DB + "INSERT INTO profiles(name, profile_dir, first_seen_at) VALUES (?, ?, ?)", + (profile_name, str(e2e_profile_dir), "2026-01-01T00:00:00Z"), + ) + task_id = f"e2e-direct-worker-{uuid.uuid4().hex[:8]}" + worker.repo.enqueue_task( + task_id, + profile_name, + "t2i", + { + "prompt": "a glass marble on a wooden table", + "aspect": "9:16", + # output_file, not out_dir: out_dir only feeds the client's debug artefacts; + # without output_file the worker saves into the user's real output folder. + "output_file": str(out_dir / "direct.jpg"), + "transport": "direct_http", + }, + ) + claimed = worker.repo.claim_next_pending(profile_name, f"worker:{profile_name}:e2e") + assert claimed is not None + await worker.process_task(claimed) + + done = worker.repo.get_task(task_id) + assert done is not None + assert done.status == "completed", f"status={done.status!r} error={done.error!r}" + rows = worker.db.conn.execute( + "SELECT metadata_json FROM assets WHERE kind = 'image'" + ).fetchall() + assert [json.loads(r[0] or "{}").get("transport") for r in rows] == ["direct_http"] + assert len(list(out_dir.iterdir())) == 1 + finally: + worker.close() diff --git a/tests/e2e/test_project_create_slow_link_e2e.py b/tests/e2e/test_project_create_slow_link_e2e.py index 27727326b..864456e08 100644 --- a/tests/e2e/test_project_create_slow_link_e2e.py +++ b/tests/e2e/test_project_create_slow_link_e2e.py @@ -28,7 +28,7 @@ from gflow_cli.api.client import FlowApiClient from gflow_cli.api.transports import migrated_composer as mc from gflow_cli.config import reset_settings -from gflow_cli.errors import RpcResponseUnavailableError, is_retryable +from gflow_cli.errors import RpcResponseUnavailableError, UiSelectorDriftError, is_retryable from gflow_cli.json_output import exit_code_for pytestmark = [pytest.mark.e2e, pytest.mark.e2e_auth] @@ -50,6 +50,18 @@ def _opt_in(monkeypatch: pytest.MonkeyPatch) -> None: reset_settings() +# A transparent layer above the whole page: the FAB stays visible, the click cannot land. +_COVER_JS = """ +setInterval(() => { + if (!document.body || document.getElementById('e2e-cover')) return; + const d = document.createElement('div'); + d.id = 'e2e-cover'; + d.style.cssText = 'position:fixed;inset:0;z-index:2147483647;background:transparent'; + document.body.appendChild(d); +}, 100); +""" + + def _title() -> str: return f"e2e-1037-{uuid.uuid4().hex[:6]}" @@ -152,3 +164,29 @@ async def test_no_reply_and_no_navigation_is_outcome_unknown_not_retryable( assert len(await _project_ids(page) - before) == 1 # made, though gflow never saw it finally: client._checkin_page(page) # noqa: SLF001 + + +async def test_a_covered_new_project_button_is_drift_and_creates_nothing( + client: FlowApiClient, +) -> None: + """The first telemetry week's top crash: the FAB renders but something covers it, so + the click times out. No create request left the page, so nothing was made: exit 23, + charged nothing. A fresh page carries the cover and is closed, so no pooled page does.""" + assert client._context is not None # noqa: SLF001 + page = await client._context.new_page() # noqa: SLF001 + try: + before = await _project_ids(page) + await page.add_init_script(_COVER_JS) + + with pytest.raises(UiSelectorDriftError, match="new-project button") as exc: + await mc.create_project(page, _title(), timeout_s=30.0) + + assert exit_code_for(exc.value) == 23 + assert exc.value.charged == "no" + finally: + await page.close() + page = await client._checkout_page() # noqa: SLF001 + try: + assert await _project_ids(page) == before # the witness: no project was made + finally: + client._checkin_page(page) # noqa: SLF001 diff --git a/tests/features/direct_http_transport.feature b/tests/features/direct_http_transport.feature new file mode 100644 index 000000000..389d22f07 --- /dev/null +++ b/tests/features/direct_http_transport.feature @@ -0,0 +1,6 @@ +Feature: Direct HTTP transport for image generation on flow.google.com + + Scenario: Plain text-to-image uses direct HTTP transport + Given a profile served flow.google.com + When a plain text-to-image request runs on the direct_http transport + Then one direct POST is sent and the image is returned with transport direct_http diff --git a/tests/features/test_direct_http_transport_steps.py b/tests/features/test_direct_http_transport_steps.py new file mode 100644 index 000000000..db47204a3 --- /dev/null +++ b/tests/features/test_direct_http_transport_steps.py @@ -0,0 +1,121 @@ +"""Offline BDD step definitions for direct_http_transport.feature.""" + +from __future__ import annotations + +import asyncio +import json +from typing import TYPE_CHECKING, Any +from unittest.mock import AsyncMock, MagicMock + +import httpx +import pytest +from pytest_bdd import given, scenarios, then, when + +from gflow_cli.api import flow_wire +from gflow_cli.api.image import GenerateImageRequest +from gflow_cli.api.transports import make_transport +from gflow_cli.api.transports.direct_http import DirectHttpTransport +from tests.api.transports.test_migrated_images import image_payload + +if TYPE_CHECKING: + from pathlib import Path + +scenarios("direct_http_transport.feature") + + +def _valid_ogiz0b_text() -> str: + payload = image_payload() + frame_json = json.dumps( + [["wrb.fr", "ogiZ0b", json.dumps(payload), None, None, None, "generic"]] + ) + return f")]}}'\n{frame_json}" + + +@pytest.fixture(autouse=True) +def _clean_flow_wire(monkeypatch: pytest.MonkeyPatch) -> Any: + flow_wire.reset_state() + monkeypatch.setattr(flow_wire, "getproxies", dict) + yield + flow_wire.reset_state() + + +@pytest.fixture +def bdd_ctx() -> dict[str, Any]: + return {} + + +@given("a profile served flow.google.com") +def step_profile_served_flow( + bdd_ctx: dict[str, Any], tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr( + "gflow_cli.api.recaptcha.TokenMinter.mint", + AsyncMock(return_value="mock_recaptcha_token"), + ) + monkeypatch.setattr( + "gflow_cli.api.transports.frame_builder.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + monkeypatch.setattr( + "gflow_cli.api.transports.direct_http.build_ogiz0b_body", + MagicMock(return_value="f.req=mock_body&at=at-x&"), + ) + + post_count = 0 + + def handler(request: httpx.Request) -> httpx.Response: + nonlocal post_count + if request.method == "GET": + return httpx.Response( + 200, text='"SNlM0e":"at-x","FdrFJe":"sid","cfb2h":"boq_x"' + ) + if request.method == "POST": + post_count += 1 + return httpx.Response(200, text=_valid_ogiz0b_text()) + return httpx.Response(404) + + mock_transport = httpx.MockTransport(handler) + + page = MagicMock() + page.url = "https://flow.google.com/project/proj-bdd-1" + page.goto = AsyncMock() + page.context = MagicMock() + page.context.cookies = AsyncMock( + return_value=[{"name": "SID", "value": "test_sid", "domain": ".google.com", "path": "/"}] + ) + + t = make_transport("direct_http") + assert isinstance(t, DirectHttpTransport) + t._http_transport = mock_transport + t.park_deferred_page = AsyncMock() # type: ignore[method-assign] + + async def _init_transport() -> None: + await t.setup(tmp_path, page=page) + + asyncio.run(_init_transport()) + + bdd_ctx["transport"] = t + bdd_ctx["get_post_count"] = lambda: post_count + + +@when("a plain text-to-image request runs on the direct_http transport") +def step_run_t2i(bdd_ctx: dict[str, Any]) -> None: + t: DirectHttpTransport = bdd_ctx["transport"] + req = GenerateImageRequest(prompt="a cinematic sunset") + + async def _run() -> None: + bdd_ctx["images"] = await t.generate_images(project_id="proj-bdd-1", request=req) + + asyncio.run(_run()) + + +@then("one direct POST is sent and the image is returned with transport direct_http") +def step_verify_result(bdd_ctx: dict[str, Any]) -> None: + t: DirectHttpTransport = bdd_ctx["transport"] + images = bdd_ctx["images"] + get_post_count = bdd_ctx["get_post_count"] + + assert get_post_count() == 1 + assert len(images) == 1 + assert images[0].transport == "direct_http" + assert t.last_image_route == "migrated" diff --git a/tests/mcp/test_tools_wired.py b/tests/mcp/test_tools_wired.py index b975c5367..00457951e 100644 --- a/tests/mcp/test_tools_wired.py +++ b/tests/mcp/test_tools_wired.py @@ -52,6 +52,7 @@ class _FakeImage: seed: int = 12345 fife_url: str = "http://fake" display_name: str | None = None # mirrors GeneratedImage.display_name + transport: str | None = None # mirrors GeneratedImage.transport def _completed_video_result(media_id: str = "media-vid-wired") -> VideoResult: diff --git a/tests/services/test_video_captions.py b/tests/services/test_video_captions.py index 8e7961c56..ad019838b 100644 --- a/tests/services/test_video_captions.py +++ b/tests/services/test_video_captions.py @@ -133,9 +133,18 @@ def test_missing_chain_extra_fails_before_transcription(monkeypatch: pytest.Monk caption_video("clip.mp4", srt_path=Path("captions.srt")) -def test_transcribe_refuses_default_google_endpoint(media_files: tuple[Path, Path]) -> None: - with pytest.raises(ConfigurationError, match="GFLOW_CLI_LLM_BASE_URL"): - transcribe_video(str(media_files[0])) +def test_transcribe_refuses_default_google_endpoint( + media_files: tuple[Path, Path], monkeypatch: pytest.MonkeyPatch +) -> None: + # Pin the default: a developer's .env may point GFLOW_CLI_LLM_BASE_URL elsewhere, and an + # environment variable outranks the .env file, so this case cannot depend on the checkout. + monkeypatch.setenv("GFLOW_CLI_LLM_BASE_URL", config.DEFAULT_LLM_BASE_URL) + config.reset_settings() + try: + with pytest.raises(ConfigurationError, match="GFLOW_CLI_LLM_BASE_URL"): + transcribe_video(str(media_files[0])) + finally: + config.reset_settings() def test_transcribe_refuses_existing_srt_before_network( @@ -626,6 +635,38 @@ def record_load(*args: Any, **kwargs: Any) -> Any: assert loaded_sizes == [expected_initial, expected_fallback] +@pytest.mark.parametrize(("width", "height"), [(1280, 720), (720, 1280), (1920, 1080)]) +def test_caption_box_is_centred_on_the_text_ink(width: int, height: int) -> None: + # #1431: the box was drawn from the text origin, not from its ink, so it sat above the + # glyphs and descenders hung below its bottom edge. + from PIL import ImageDraw, ImageFont + + overlay, _top = service._caption_overlay( + width, + height, + "Generate the clips, narrate a voiceover, and burn in the captions.", + ImageDraw, + ImageFont, + ) + pixels = overlay.load() + ink = [ + (x, y) + for y in range(overlay.height) + for x in range(overlay.width) + if pixels[x, y][3] == 255 and min(pixels[x, y][:3]) > 128 + ] + box = [(x, y) for y in range(overlay.height) for x in range(overlay.width) if pixels[x, y][3]] + assert ink + ink_left, ink_right = min(x for x, _ in ink), max(x for x, _ in ink) + ink_top, ink_bottom = min(y for _, y in ink), max(y for _, y in ink) + box_left, box_right = min(x for x, _ in box), max(x for x, _ in box) + box_top, box_bottom = min(y for _, y in box), max(y for _, y in box) + + assert box_top < ink_top and ink_bottom < box_bottom + assert box_left < ink_left and ink_right < box_right + assert abs((ink_top - box_top) - (box_bottom - ink_bottom)) <= 2 + + def test_caption_background_is_translucent_on_rgb_frame() -> None: av = pytest.importorskip("av") from PIL import Image, ImageDraw, ImageFont @@ -653,6 +694,63 @@ def test_long_caption_wraps_within_frame(size: tuple[int, int]) -> None: assert all(draw.textlength(line, font=font) <= size[0] * 0.9 for line in lines) +@pytest.mark.parametrize("size", [(1280, 720), (720, 1280)]) +@pytest.mark.parametrize( + "text", + [ + # Long enough to overflow 1280 px even where the test font has no CJK glyphs and + # draws narrower placeholder boxes. + "先生成这几段片子,再配一段旁白,把字幕烧进画面里,最后今晚把成片上传到频道。" * 2, + "Install it from https://github.com/ffroliva/gflow-cli/releases/download/v0.105.1/" + "gflow_cli-0.105.1-py3-none-any.whl", + ], + ids=["cjk", "long-url"], +) +def test_caption_without_break_points_wraps_within_frame(size: tuple[int, int], text: str) -> None: + from PIL import Image, ImageDraw, ImageFont + + from gflow_cli.services.video_captions import _caption_overlay, _wrap_caption + + draw = ImageDraw.Draw(Image.new("RGB", size)) + font = ImageFont.load_default(size=40) + lines = _wrap_caption(text, font, draw, size[0] * 0.9) + assert len(lines) > 1 + assert all(draw.textlength(line, font=font) <= size[0] * 0.9 for line in lines) + assert "".join(lines).replace(" ", "") == text.replace(" ", "") + + overlay, _ = _caption_overlay(*size, text, ImageDraw, ImageFont) + ink = overlay.getchannel("A").point(lambda alpha: 255 if alpha == 255 else 0).getbbox() + assert ink is not None + assert ink[0] > 0 and ink[2] < size[0] + + +def test_caption_wrap_keeps_closing_punctuation_off_the_line_start() -> None: + from PIL import Image, ImageDraw, ImageFont + + from gflow_cli.services.video_captions import _wrap_caption + + draw = ImageDraw.Draw(Image.new("RGB", (400, 100))) + font = ImageFont.load_default(size=30) + max_width = draw.textlength("一二三四", font=font) + 1 + assert _wrap_caption("一二三四,五六", font, draw, max_width) == ["一二三", "四,五六"] + + +def test_caption_wrap_does_not_move_a_character_down_when_the_pair_is_too_wide() -> None: + from PIL import Image, ImageDraw, ImageFont + + from gflow_cli.services.video_captions import _wrap_caption + + draw = ImageDraw.Draw(Image.new("RGB", (400, 100))) + font = ImageFont.load_default(size=30) + # "iW" fits exactly, but "W," is wider than the line: the comma starts the next line + # instead of carrying "W" down into a line wider than the frame. + max_width = draw.textlength("iW", font=font) + assert draw.textlength("W,", font=font) > max_width + lines = _wrap_caption("iW,", font, draw, max_width) + assert all(draw.textlength(line, font=font) <= max_width for line in lines) + assert "".join(lines) == "iW," + + def test_resolve_video_source_accepts_local_and_verified_catalog_video( media_files: tuple[Path, Path], monkeypatch: pytest.MonkeyPatch ) -> None: diff --git a/tests/test_e2e_env_redaction.py b/tests/test_e2e_env_redaction.py index d16564830..4b3f70a2b 100644 --- a/tests/test_e2e_env_redaction.py +++ b/tests/test_e2e_env_redaction.py @@ -2,6 +2,7 @@ from __future__ import annotations +import re import subprocess import sys from pathlib import Path @@ -368,6 +369,11 @@ def test_trunc(monkeypatch): """) result = pytester.runpytest_subprocess("-l") output = result.stdout.str() + # --showlocals prints object reprs with hex memory addresses + # (e.g. <... MonkeyPatch object at 0x7a873abcdb80>), and a hex-only token + # fragment such as "abcd" can occur inside one by chance (#1429). Strip + # addresses before checking so only a real secret leak can fail the test. + output = re.sub(r"0x[0-9a-f]+", "", output, flags=re.IGNORECASE) for i in range(len(token) - 3): assert token[i : i + 4] not in output diff --git a/tests/test_telemetry.py b/tests/test_telemetry.py index 18933ee3d..f8e87466d 100644 --- a/tests/test_telemetry.py +++ b/tests/test_telemetry.py @@ -333,6 +333,34 @@ def test_an_engine_outside_the_enum_is_other_and_facts_reset_per_command(tmp_hom assert report["hosts"] == {"labs": 1} +def test_a_transport_run_counts_its_transport_once(tmp_home: Path) -> None: + telemetry.note_transport("direct") + telemetry.record("cli", "image t2i", [], "0", 3.0) + report = _report() + assert report["transports"] == {"direct": 1} + + +def test_a_transport_ui_counts_ui(tmp_home: Path) -> None: + telemetry.note_transport("ui") + telemetry.record("cli", "image t2i", [], "0", 3.0) + report = _report() + assert report["transports"] == {"ui": 1} + + +def test_a_transport_outside_the_enum_is_other(tmp_home: Path) -> None: + telemetry.note_transport("custom-grpc") + telemetry.record("cli", "image t2i", [], "0", 3.0) + report = _report() + assert report["transports"] == {"other": 1} + + +def test_an_unlisted_transport_counts_other(tmp_home: Path) -> None: + telemetry.note_transport("direct_http") # a raw transport name never reaches the totals + telemetry.record("cli", "image t2i", [], "0", 3.0) + report = _report() + assert report["transports"] == {"other": 1} + + def test_the_worker_flushes_a_queued_job_s_facts(tmp_home: Path) -> None: telemetry.note_engine("playwright") telemetry.note_host("migrated") diff --git a/tests/test_telemetry_notice.py b/tests/test_telemetry_notice.py index 20fe304fe..55b0f6789 100644 --- a/tests/test_telemetry_notice.py +++ b/tests/test_telemetry_notice.py @@ -511,3 +511,17 @@ def test_consent_to_an_earlier_notice_is_not_consent( assert telemetry.consent_at() is None # v2 wrote a bare timestamp telemetry.set_consent() assert telemetry.consent_at() is not None + + +def test_consent_to_v3_notice_is_not_consent_for_v4( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + """A v3 consent must be renewed now that notice v4 names image transport.""" + home = tmp_path / "gflow_home" + home.mkdir(exist_ok=True) + monkeypatch.setenv("GFLOW_CLI_HOME", str(home)) + monkeypatch.setattr(telemetry, "consent_region", lambda: True) + (home / telemetry.CONSENT_FILE).write_text("2026-11-01T00:00:00+00:00\n3", encoding="utf-8") + assert telemetry.consent_at() is None + telemetry.set_consent() + assert telemetry.consent_at() is not None diff --git a/tests/worker/test_daemon.py b/tests/worker/test_daemon.py index 699ee9900..f8e036fa4 100644 --- a/tests/worker/test_daemon.py +++ b/tests/worker/test_daemon.py @@ -33,6 +33,7 @@ class FakeGeneratedImage: seed: int = 12345 fife_url: str = "http://fake" display_name: str | None = None # mirrors GeneratedImage.display_name + transport: str | None = None # mirrors GeneratedImage.transport def _completed_video_result(media_id: str = "media-vid-123") -> VideoResult: diff --git a/uv.lock b/uv.lock index e7deb50a9..df7ba2356 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 5 requires-python = ">=3.11" resolution-markers = [ "python_full_version >= '3.14'", @@ -302,7 +302,7 @@ name = "browser-cookie3" version = "0.20.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "jeepney", marker = "'bsd' in sys_platform or sys_platform == 'linux'" }, + { name = "jeepney", marker = "sys_platform == 'linux' or 'bsd' in sys_platform" }, { name = "lz4" }, { name = "pycryptodomex" }, { name = "shadowcopy", marker = "sys_platform == 'win32'" }, @@ -718,7 +718,7 @@ wheels = [ [[package]] name = "fastapi" -version = "0.163.1" +version = "0.165.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "annotated-doc" }, @@ -729,9 +729,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "typing-inspection" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a4/62/19000d0f3699cacaeffe8a3c4cc7046d87aac3291163ffeb2ef08b82d859/fastapi-0.163.1.tar.gz", hash = "sha256:3d364b02a68b67292e833ff2dfed3b8dc3aeadf73e271c15316c6c166668792f", size = 544796, upload-time = "2026-11-15T09:51:31.271Z" } +sdist = { url = "https://files.pythonhosted.org/packages/27/f9/e7820ef181026fea100bde02d811445bf8e883362d7092b6928767147056/fastapi-0.165.0.tar.gz", hash = "sha256:dd94d4128319c1e1d50535ab023ab698f850a4d2822f0e181747b46f4ff3c0ab", size = 557984, upload-time = "2026-11-18T19:15:37.076Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/20/b6/2424da1e40825d3fc54539621811f34e21472499677c9490e4967270e38e/fastapi-0.163.1-py3-none-any.whl", hash = "sha256:68f2d8050f5c3583121c0d203046cc7def5c16a7d6c43a0e7707a8ea610fe2d3", size = 154541, upload-time = "2026-11-15T09:51:29.726Z" }, + { url = "https://files.pythonhosted.org/packages/c4/c1/3b74c030262a1b38b1fee180f80b4007bbc11c9ac12028cb18c7bcecaec9/fastapi-0.165.0-py3-none-any.whl", hash = "sha256:896f48462042bb4f162147eb8fac7e858753dc1f486765709baf105d70e4fc5b", size = 159475, upload-time = "2026-11-18T19:15:35.345Z" }, ] [[package]] @@ -869,7 +869,7 @@ wheels = [ [[package]] name = "gflow-cli" -version = "0.105.1" +version = "0.106.0" source = { editable = "." } dependencies = [ { name = "browser-cookie3" }, @@ -977,7 +977,7 @@ requires-dist = [ { name = "pytest-xdist", marker = "extra == 'dev'", specifier = ">=3.6" }, { name = "python-dotenv", specifier = ">=1.0.0" }, { name = "rich", specifier = ">=13.7.0" }, - { name = "ruff", marker = "extra == 'dev'", specifier = "==0.17.5" }, + { name = "ruff", marker = "extra == 'dev'", specifier = "==0.17.6" }, { name = "s3fs", marker = "extra == 's3'", specifier = ">=2024.2.0" }, { name = "sse-starlette", specifier = ">=2.0.0" }, { name = "structlog", specifier = ">=24.0.0" }, @@ -1001,7 +1001,7 @@ containers = [ { name = "pytest-bdd", specifier = ">=8.1.0" }, { name = "pytest-cov", specifier = ">=7.1.0" }, { name = "pytest-xdist", specifier = ">=3.6" }, - { name = "ruff", specifier = "==0.17.5" }, + { name = "ruff", specifier = "==0.17.6" }, { name = "s3fs", specifier = ">=2024.2.0" }, { name = "testcontainers", specifier = ">=4.8.0" }, { name = "universal-pathlib", specifier = ">=0.2.5" }, @@ -1017,7 +1017,7 @@ dev = [ { name = "pytest-bdd", specifier = ">=8.1.0" }, { name = "pytest-cov", specifier = ">=7.1.0" }, { name = "pytest-xdist", specifier = ">=3.6" }, - { name = "ruff", specifier = "==0.17.5" }, + { name = "ruff", specifier = "==0.17.6" }, ] [[package]] @@ -2191,11 +2191,11 @@ wheels = [ [[package]] name = "platformdirs" -version = "4.14.5" +version = "4.14.8" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d7/9a/8475be631fb33ca1466915e70fd594c42a4e84b512db650eaa14f90fe75d/platformdirs-4.14.5.tar.gz", hash = "sha256:32e9921db7385aa8169bee4fe9501923e5715ba9fb7ea3b9c69b0d8e0639f7a1", size = 71464, upload-time = "2026-11-04T16:54:50.358Z" } +sdist = { url = "https://files.pythonhosted.org/packages/71/18/0b0d99f5bf164f04a7a9534c3dbdbe4d5fd2b382667685ad40c192c4d3d1/platformdirs-4.14.8.tar.gz", hash = "sha256:96893d686e84e9e6f358a9ea41a8de544df66dbf2ba6cda250e7dc73acf85b9b", size = 87203, upload-time = "2026-11-20T08:14:52.63Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/7c/ae/ecbbbfd0e4343a6a521d49b3c8656fb4643dee2a4f6eaf941cf3280391a8/platformdirs-4.14.5-py3-none-any.whl", hash = "sha256:8e778c6fa421516f4d3369449f8df3b0e1b72c0e0005fe88e3ec772d0a14e750", size = 35402, upload-time = "2026-11-04T16:54:48.875Z" }, + { url = "https://files.pythonhosted.org/packages/5b/be/373cc7341f53bfd3acba3e5db62433fd960a45fcf73ad64a5f4d27e74910/platformdirs-4.14.8-py3-none-any.whl", hash = "sha256:1e34af590de4d978631b751eb2202f2fee4497537a17c1720b12fcf57b331392", size = 94267, upload-time = "2026-11-20T08:14:51.306Z" }, ] [[package]] @@ -2965,27 +2965,27 @@ wheels = [ [[package]] name = "ruff" -version = "0.17.5" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/86/cc/7b71512eb8b49926efb887cc66c74dd993642943c29eba51a877f6b85692/ruff-0.17.5.tar.gz", hash = "sha256:625e57d80cd43352d12ea81690f3eac46cddc8c0f35026d137fb0f157f94592e", size = 5368382, upload-time = "2026-11-12T17:54:55.04Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d4/f2/61df414cb4338617290a9023ad09486e207fb9a6d09357a7be34f2e369a4/ruff-0.17.5-py3-none-linux_armv6l.whl", hash = "sha256:d511dd302982e46a285528942fa6557d57730edc4bdb9def95e86a2603d77396", size = 10231309, upload-time = "2026-11-12T17:54:09.314Z" }, - { url = "https://files.pythonhosted.org/packages/d1/72/8ed970f3361f7c8d3f8e1b3b1af27cf086bc4b3a6b62ec20e21a1aaaaff5/ruff-0.17.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b72fbc232e328bdbb9cdddf4f1aedcd61bd1aa64d75fc012114b4add0bd7f26b", size = 10250018, upload-time = "2026-11-12T17:54:11.983Z" }, - { url = "https://files.pythonhosted.org/packages/dc/4b/8b10f6c9d0a18413301ae8dd2af9d180a81bb738b1b731d944a37404c523/ruff-0.17.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6f0db748508f04a04e3fbebcc636a5c8b3bd76274f8ed28f497c44d75c2ea2d7", size = 9504737, upload-time = "2026-11-12T17:54:14.567Z" }, - { url = "https://files.pythonhosted.org/packages/b7/ea/1b3afa3943239dede7a0755ea139bdb51879f0f3f96f92894081d5c7d2e5/ruff-0.17.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6f6a7b138edf9cc402ca736a59d9525e6d766e5395760b72e7e146e6251ac963", size = 10168006, upload-time = "2026-11-12T17:54:17.195Z" }, - { url = "https://files.pythonhosted.org/packages/31/08/ee641daa45f83792f91274b65796cb011f1065f588911bfa3909ad9e31e7/ruff-0.17.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e52622ecf3a0df9d03e796fe3eed4aa085adda65520db7e0619cbd2192a97342", size = 10043751, upload-time = "2026-11-12T17:54:19.815Z" }, - { url = "https://files.pythonhosted.org/packages/f8/cf/1c59fdb42d0b5671ad5b160636fab4005ee28db72cb06aef6e3f3c04f377/ruff-0.17.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:54c0f67d1be11b55d12c184a819fc229f5eee3ef45c16c4fcad41258e83b4882", size = 10690562, upload-time = "2026-11-12T17:54:22.789Z" }, - { url = "https://files.pythonhosted.org/packages/49/c5/578074716173fb0c1591e9648a9f85c469888d9530cb35b89b757dc1208b/ruff-0.17.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dd0dfe7c6fe5a447fce467c58e69893be1d9a7e4378f5b9906432da33d94a97f", size = 11338465, upload-time = "2026-11-12T17:54:25.523Z" }, - { url = "https://files.pythonhosted.org/packages/aa/b9/d6428bcf5ed88f4dc1d6e3417ee350236ed36e7a35f9477b727c00e437bf/ruff-0.17.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ec4ecf40fb4d6e1265b009dbe551727920926fc0f769070c452d6d84b422a74d", size = 10895501, upload-time = "2026-11-12T17:54:28.441Z" }, - { url = "https://files.pythonhosted.org/packages/f2/8a/1e29c0c3785ae7e5cd0d54ee8717a08867ef71545796340be4c653c57e24/ruff-0.17.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40ca8afaac309b41a5b2e09e4e7beb1f824826b93c25697c4d74f573324fba4e", size = 10613231, upload-time = "2026-11-12T17:54:30.862Z" }, - { url = "https://files.pythonhosted.org/packages/32/b6/88944350c14bb90651014d678ad554e233ae2a79c14ad52101845f93d15b/ruff-0.17.5-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:8e85601bd6d9b6c3e3b95c0e0dccdbac1d23c6bcef006d187fbcddaf8225a5df", size = 10562789, upload-time = "2026-11-12T17:54:33.869Z" }, - { url = "https://files.pythonhosted.org/packages/6f/fd/2792e955b0bf54295cdcdddc4bb3f380c0790d7e60e789f528a9e6e48a31/ruff-0.17.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f93d2b7d449ed9545304f6923699ca20d13c675b69f258481709a08ae61076db", size = 10069824, upload-time = "2026-11-12T17:54:36.663Z" }, - { url = "https://files.pythonhosted.org/packages/07/9c/d7cad341b4c19237948a6dd1fcea1c9c39c9d08b70f22f0e157d1236ebd6/ruff-0.17.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0e5c125c5b31dc8efc948d41357496a4c4a312977565ccba740030efdff83580", size = 10038961, upload-time = "2026-11-12T17:54:39.452Z" }, - { url = "https://files.pythonhosted.org/packages/cc/a1/9cd0d4c371ddc70267d3bd557e718e2bdfb94c25e49d25605edfabb764bd/ruff-0.17.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:50dfc3c6b3ebd0a932f11dfd579bd42234b0b7137e68940eb6abdbfdb9d69697", size = 10385012, upload-time = "2026-11-12T17:54:41.808Z" }, - { url = "https://files.pythonhosted.org/packages/8f/a9/35f078ce98d4df318328ea5270382b5b65e680f7953b3db54f8e009c420c/ruff-0.17.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:86bd1f3b83c25f9b8055c6e796f0685b39d3127ce947322098c3108cf82fd586", size = 10793672, upload-time = "2026-11-12T17:54:44.342Z" }, - { url = "https://files.pythonhosted.org/packages/2c/a5/2e136dede2a88aaaf54498bbbdc81bc810f788ef6ef01efb97037d73cd1d/ruff-0.17.5-py3-none-win32.whl", hash = "sha256:e1546609b2ad73f1d6c5c076881b788672b7b3cc3283981182cbdbb6524ed88a", size = 9929908, upload-time = "2026-11-12T17:54:47.067Z" }, - { url = "https://files.pythonhosted.org/packages/ec/8c/e4db9ae1e0ee233c04df007ab6d0d42f799ae9abd95d352b6092ee7bc4bf/ruff-0.17.5-py3-none-win_amd64.whl", hash = "sha256:aa415d57c244299279901d776607fee3df7831c2a7435433fbfacde8632c6550", size = 10275454, upload-time = "2026-11-12T17:54:49.401Z" }, - { url = "https://files.pythonhosted.org/packages/e6/65/a1648bc1550e7683bf7bf1e2ce2485c9f8535cbca6cca9ec7b73cc12fb8e/ruff-0.17.5-py3-none-win_arm64.whl", hash = "sha256:64a6fd668a336df959c522991de33e9e3c8be463afc0c9ac8f029f9d19ef756e", size = 9849020, upload-time = "2026-11-12T17:54:52.055Z" }, +version = "0.17.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/df/8e/6929d337aa5380aafc7355f3149f3ccfe55cba5fdd34a045697ebaceb5a0/ruff-0.17.6.tar.gz", hash = "sha256:2b04276561331300325040bdca21460770029ec574d4c479099e39e8ad1ed43c", size = 5374388, upload-time = "2026-11-19T15:56:27.106Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/5d/38ef6310c22cacb094e9ae0ff7964062e04ffeecb45ee296894c2b1acc54/ruff-0.17.6-py3-none-linux_armv6l.whl", hash = "sha256:084d9c8f5ec718e7eba007dba339e7cb4f7571d2f267558ae080bf428fb6a69b", size = 10174693, upload-time = "2026-11-19T15:55:52.414Z" }, + { url = "https://files.pythonhosted.org/packages/a2/ed/fd35261049920a4888ef7c787a5c27089502077a4910f6ca8f1213157d6d/ruff-0.17.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9d44ef2140402043fd6f689ef541858b80883a8b0a02e38539ef0614ebe57d0c", size = 10221650, upload-time = "2026-11-19T15:55:54.962Z" }, + { url = "https://files.pythonhosted.org/packages/ba/d4/c31391b36c729cd9fafa65b7a52a58850b99afb2b65da6be4263a53302f2/ruff-0.17.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:9fbddc08577592e283c265d865e0182de6e33db185494db7b06290d989d888e5", size = 9580986, upload-time = "2026-11-19T15:55:57.391Z" }, + { url = "https://files.pythonhosted.org/packages/eb/11/f3032684dcb3a676d7924545153d76fb56f76753e038f2ea650b99c71bdf/ruff-0.17.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:435241c61af5909a022f76219d3d1bf24730dc1bf0acabb5ddf4b569ab3cbb30", size = 10271368, upload-time = "2026-11-19T15:55:59.654Z" }, + { url = "https://files.pythonhosted.org/packages/08/30/c1e024eeb5bae99ae78c6b896ed108f64c9c845a03b56eaeff098e99b6e6/ruff-0.17.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d006bbb2945edb17b0ce6a0c1b5f5a8d81ba11dbac294a0a925effa22ce34feb", size = 9981564, upload-time = "2026-11-19T15:56:01.807Z" }, + { url = "https://files.pythonhosted.org/packages/7d/a5/da3e0c2d4bf02b3ca6c1d7fa4bb04d0081e340b1dd03c4f83b1bec3e15c1/ruff-0.17.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd661702202a89c00a4c9d0339008805fa5876bfa1c57e165495c2e62230dfbf", size = 10641991, upload-time = "2026-11-19T15:56:03.981Z" }, + { url = "https://files.pythonhosted.org/packages/4d/c1/6d7f981e86201c9db457cca99fd2c09b77574ebab37dff3e9239b218603c/ruff-0.17.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6a12c50a33936dc00db2be21ba25fb168a8b95c55eda2a3ac85005af69885e4b", size = 11403484, upload-time = "2026-11-19T15:56:05.778Z" }, + { url = "https://files.pythonhosted.org/packages/c3/92/8182f07b94998541d5f8f38f53da465aa28062afce24ecc398f45bfc62f1/ruff-0.17.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b5aba93b3db4b70c5697e4fee6e0d5b9c8452a9a3a03679611cadc25915a2173", size = 10892316, upload-time = "2026-11-19T15:56:08.016Z" }, + { url = "https://files.pythonhosted.org/packages/be/48/3df7d81249fd69ee6a49519b149fb5d11e13118fd7d0e8d65329a237087b/ruff-0.17.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa3b08254a732acba246891089a152c47c5733dc36b8ecb76ce8602f8326e5e4", size = 10645279, upload-time = "2026-11-19T15:56:09.785Z" }, + { url = "https://files.pythonhosted.org/packages/71/80/4d232281544345d7beb98d1d32c24dae804ed360780a6f7753738b81225e/ruff-0.17.6-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:0692088e6b33455572fb18465e891b443f196e98dc1986825685c77ff6f4c5ac", size = 10534501, upload-time = "2026-11-19T15:56:11.718Z" }, + { url = "https://files.pythonhosted.org/packages/98/0a/b477f075a4a94eb541bf1c759a3e72b2a3d6390af7a13a5be0887229f67c/ruff-0.17.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fb589e032806bb942e4fb526f30b80a1a64112147ed9f1d38cc3de2e255b6f45", size = 10136036, upload-time = "2026-11-19T15:56:13.779Z" }, + { url = "https://files.pythonhosted.org/packages/f1/d8/cf32fbfeb1fcda1470fb5c3bee50c69ee6bca257d487ec1eb17a0387edb4/ruff-0.17.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1939b3d701c7b6981b7cf93473de5bf88b129b9ba84efaed5154cc517c44634d", size = 9969640, upload-time = "2026-11-19T15:56:15.738Z" }, + { url = "https://files.pythonhosted.org/packages/a7/22/bb9f9752f7fcdfdc8b9c51576cc142bb377ade745290e35085173963c7be/ruff-0.17.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1a0bea6aa1216e0ec4cd35d3dbccec0d772a7c2aad28ec9c6e82571dff2c20b0", size = 10389427, upload-time = "2026-11-19T15:56:17.617Z" }, + { url = "https://files.pythonhosted.org/packages/81/c7/e09d220818ab146b736d62e0676dad215215d7de0884bbdad9fa075dc7d2/ruff-0.17.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3db61f5015600543a581b07fa7f6f64afa0eeedefe16034cadd88c4074087582", size = 10760296, upload-time = "2026-11-19T15:56:19.463Z" }, + { url = "https://files.pythonhosted.org/packages/2e/09/28329441dfa2c463e2d377a69d4ebbe4d51665e9dbd49fb421f3bc80d775/ruff-0.17.6-py3-none-win32.whl", hash = "sha256:c2f4af6670b7a0501904e881bb3f1f24bd0d964dec1eedbd85f0eb73786e1128", size = 9966266, upload-time = "2026-11-19T15:56:21.581Z" }, + { url = "https://files.pythonhosted.org/packages/4b/9d/18ba9730addfc7554c70d6f171fb8dc2c08e774d9fb2b98e7946ef845c59/ruff-0.17.6-py3-none-win_amd64.whl", hash = "sha256:9cd2fd9923e9806b8b6b67a3469e2258e84bd4d21e45d5a1a690afdfb9c8e57d", size = 10365847, upload-time = "2026-11-19T15:56:23.582Z" }, + { url = "https://files.pythonhosted.org/packages/70/8a/59c33e2a64a4f9672f7f842a0dc522915cfbbaffd13d37d0cec57d1c5c5d/ruff-0.17.6-py3-none-win_arm64.whl", hash = "sha256:d8b14e1473dc86ab9069cf7a2ba5041dc012f59110201844ed04cfddf07055a0", size = 9926224, upload-time = "2026-11-19T15:56:25.269Z" }, ] [[package]] @@ -3038,15 +3038,15 @@ wheels = [ [[package]] name = "starlette" -version = "1.3.1" +version = "1.10.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/eb/e3/7c1dc7381d9f8ab7d854328ebfa884e62cb3f3d8549ddfd37c7814f42afa/starlette-1.3.1.tar.gz", hash = "sha256:05d0213193f2fbaae60e2ecb593b4add4262ad4e46536b54abe36f11a71724e0", size = 2703240, upload-time = "2026-06-12T09:23:11.602Z" } +sdist = { url = "https://files.pythonhosted.org/packages/48/bb/3d8757f21e9a53d9035c9eb039a777047139a16bfdbedfc7a58241c3d914/starlette-1.10.0.tar.gz", hash = "sha256:b8399098d4c1e3522734f7235dc79b1fc967f96cf139c81e0fa30479e0685f9b", size = 2734356, upload-time = "2026-10-24T15:04:12.342Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ec/bb/2799cc2ede3ed41131f8975621e7213dfc7ef4acbbaadfa440f32500c370/starlette-1.3.1-py3-none-any.whl", hash = "sha256:c7372aae11c3c3f26a42df7bd626cec2f47d03483d261d369516a615a53714c6", size = 73632, upload-time = "2026-06-12T09:23:10.017Z" }, + { url = "https://files.pythonhosted.org/packages/88/2e/947cfe02def9371c07cd5bf5b6b61c829e9aecb9904db02a66cfafbc1eec/starlette-1.10.0-py3-none-any.whl", hash = "sha256:478c0ab3b4ced6e82719849c118fa406f0278a3499c1a898cd15cd31bdc38ce4", size = 80571, upload-time = "2026-10-24T15:04:10.371Z" }, ] [[package]] diff --git a/website/docs/ERRORS.md b/website/docs/ERRORS.md index b8784db48..d563fce12 100644 --- a/website/docs/ERRORS.md +++ b/website/docs/ERRORS.md @@ -238,6 +238,7 @@ members. They have no exit code of their own. |---|---|---|---|---| | `https://gflow-cli.dev/errors/unknown` | MCP and worker, an unclassified failure (the message is never shared; the worker's `detail` is its SHA-256 and `class` names the exception class; after the submit the worker stores the job `indeterminate` and sets `next_action: reconcile`) | — | `maybe` | `none` | | `https://gflow-cli.dev/errors/bad-parameter` | MCP, a tool argument it refuses | — | `no` | `fix_input` | +| `https://gflow-cli.dev/errors/confirmation-required` | MCP `gflow_media_trash` without `confirm=true`; CLI `gflow media trash` without `--yes` in non-interactive `--json` mode (exits 2, and its envelope omits `next_action`) | — | `no` | `fix_input` | | `https://gflow-cli.dev/errors/no-profile` | MCP, no profile, or its directory is missing | — | `no` | `reauth` | | `https://gflow-cli.dev/errors/no-default-profile` | MCP, several profiles and no default | — | `no` | `fix_input` | | `https://gflow-cli.dev/errors/profile-marker-missing` | MCP `gflow_auth_status` | — | `no` | `reauth` | diff --git a/website/docs/TELEMETRY.md b/website/docs/TELEMETRY.md index cf689fe5f..2fa31f163 100644 --- a/website/docs/TELEMETRY.md +++ b/website/docs/TELEMETRY.md @@ -10,7 +10,7 @@ Counters are kept in `/telemetry.db`, separately from the catalo grouped by ISO week and retained for 53 weeks. gflow counts command and flag names, outcomes, coarse duration buckets, command transitions, crash fingerprints made from exception and code names, and generation details read from the local catalog. It also records the storage service category and MCP -client category, and, for runs that selected a browser engine, the engine and the Flow site that served them. Prompts, argument values and other free-form text are not used as counter keys. +client category, image transport, and, for runs that selected a browser engine, the engine and the Flow site that served them. Prompts, argument values and other free-form text are not used as counter keys. `gflow telemetry show` prints the current week's report as JSON, including its random per-week `report_id`; this is the report sent by the uploader. `gflow data stats` shows your own local usage @@ -35,6 +35,7 @@ counts. | `crashes` | Counts of code-only crash fingerprints by surface. A fingerprint contains exception class names, up to three gflow-cli function names, and a third-party package marker where relevant. | | `engines` | Counts of generation, project and catalog commands and queued jobs that selected a browser engine, by engine: `playwright`, `patchright`, or `other`. A run is counted when the engine is selected, so a launch that then fails (a missing patchright install, a locked profile) still counts, which is what sizes an engine-specific failure. `gflow auth` commands and runs that launch no browser are not counted. | | `hosts` | For the same runs, the Flow site that served them, as observed from the page address when a generation is routed: `labs` (labs.google), `flow` (flow.google.com), or `unknown` when the run routed no generation (for example a credits, project or character read, or a run that failed first). It records which site served a run and says nothing about what that site supports. | +| `transports` | Counts of runs that generated at least one image, by the transport that made it: `direct` (the experimental direct HTTP transport) or `ui` (UI automation); any other value counts as `other`. One run counts once, by its last image generation. A run that generated no image adds nothing. | | `tools` | Counts by packaged prompt-tool name and whether it expanded or left the prompt unchanged. Custom tools, including tools that shadow a packaged name, are counted only as `custom`. | ## What is never sent @@ -82,7 +83,7 @@ read your IP address or locale to make this decision, and never sends the timezo Local counters still work in the EU/EEA and remain on your device unless you consent. To allow weekly uploads, run `gflow telemetry on`; this records your choice locally in `/telemetry.consent`, together with the notice version you agreed to. When the -notice changes (version 3 added the browser engine and the Flow site), uploads stop until you run +notice changes (version 4 added image transport), uploads stop until you run `gflow telemetry on` again. Run `gflow telemetry off` to withdraw consent and stop counting and uploads. Environment kill switches still take precedence. @@ -119,13 +120,13 @@ the sender is `src/gflow_cli/telemetry_upload.py` in this repository. ## Notice -Notice version: 3 +Notice version: 4 ```text gflow sends weekly usage totals to improve it, and we share overall figures publicly and with -sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and -your country as a total. No ID, prompts, paths or account details. Each report is added to -totals and discarded. +sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used, +error codes, and your country as a total. No ID, prompts, paths or account details. Each +report is added to totals and discarded. Turn it off: gflow telemetry off, or set GFLOW_CLI_TELEMETRY=0 See exactly what is sent: gflow telemetry show. Full notice: gflow docs TELEMETRY ``` @@ -133,7 +134,7 @@ See exactly what is sent: gflow telemetry show. Full notice: gflow docs TELEMETR The notice shown in the EU/EEA: ```text -gflow can send weekly usage totals to help improve it; overall figures are shared publicly and with sponsors. Commands, flag names, models, browser engine, the Flow site used, error codes, and your country as a total. No ID, prompts, paths or account details. Each report is added to totals and discarded. +gflow can send weekly usage totals to help improve it; overall figures are shared publicly and with sponsors. Commands, flag names, models, browser engine, image transport, the Flow site used, error codes, and your country as a total. No ID, prompts, paths or account details. Each report is added to totals and discarded. In your region nothing is sent unless you agree: gflow telemetry on (undo: gflow telemetry off) See exactly what would be sent: gflow telemetry show. Full notice: gflow docs TELEMETRY ``` diff --git a/website/requirements.in b/website/requirements.in index dc5c71e3b..b6d38affd 100644 --- a/website/requirements.in +++ b/website/requirements.in @@ -1,3 +1,3 @@ # Source spec for website/requirements.txt (hash-pinned — Scorecard Pinned-Dependencies). # Regenerate: uv pip compile --universal --generate-hashes --python-version 3.12 website/requirements.in -o website/requirements.txt -mkdocs-material>=9.8.1,<10 +mkdocs-material>=9.8.2,<10 diff --git a/website/requirements.txt b/website/requirements.txt index 0c32efe41..2b3eb1ead 100644 --- a/website/requirements.txt +++ b/website/requirements.txt @@ -328,9 +328,9 @@ mkdocs-get-deps==0.2.2 \ --hash=sha256:8ee8d5f316cdbbb2834bc1df6e69c08fe769a83e040060de26d3c19fad3599a1 \ --hash=sha256:e7878cbeac04860b8b5e0ca31d3abad3df9411a75a32cde82f8e44b6c16ff650 # via mkdocs -mkdocs-material==9.8.1 \ - --hash=sha256:2115af67ee680e1398bdd0ea02e517721e4bba88b342503a93f97ea8eb3de51c \ - --hash=sha256:cddae7d77bb98d1d347aa68ee252ab40926171a1b34ba8777c44e16de9629f00 +mkdocs-material==9.8.2 \ + --hash=sha256:005d942bdbfa22efa049f4818c31d42fb36bed6d362adb641dd7a2e948078f9d \ + --hash=sha256:ef1414cab33d64fcc13387e972af5ba4620f55f93482d1842933399ed2c69b02 # via -r website/requirements.in mkdocs-material-extensions==1.3.1 \ --hash=sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443 \ @@ -348,9 +348,9 @@ pathspec==1.1.1 \ --hash=sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a \ --hash=sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189 # via mkdocs -platformdirs==4.14.5 \ - --hash=sha256:32e9921db7385aa8169bee4fe9501923e5715ba9fb7ea3b9c69b0d8e0639f7a1 \ - --hash=sha256:8e778c6fa421516f4d3369449f8df3b0e1b72c0e0005fe88e3ec772d0a14e750 +platformdirs==4.14.8 \ + --hash=sha256:1e34af590de4d978631b751eb2202f2fee4497537a17c1720b12fcf57b331392 \ + --hash=sha256:96893d686e84e9e6f358a9ea41a8de544df66dbf2ba6cda250e7dc73acf85b9b # via mkdocs-get-deps pygments==2.20.0 \ --hash=sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f \