Repository navigation
fix(image): re-introduce i2i ref-attach (#50) with locale-agnostic media-dialog selectors (#56) - #60
Conversation
Local --ref paths now ride GenerateImageRequest.ref_paths and attach through the editor add-media dialog (reusing the R2V _attach_references path) instead of the REST uploadImage endpoint, which 401s (closes ffroliva#39). Bare-UUID refs still flow through refs unchanged. Adds CLI-layer and transport-layer test coverage. Live-verified end-to-end via the real CLI: image i2i --ref <png> -> uploadImage 200, imageInputs[] populated, image returned. Signed-off-by: svasakorn <s.vasakorn@gmail.com>
The i2i ref-attach (ffroliva#50) hung on non-English Chrome profiles (ffroliva#56): the 'Upload media' button was matched by localized text, so the file-chooser click missed and silently timed out (~34s). Flow renders the media dialog in the Chrome PROFILE language (NOT the Google account language; the --lang=en-US arg cannot override an already-configured profile). - UPLOAD_MEDIA_BUTTON: anchor on the locale-free `upload` icon ligature (:text-is, exact, so it doesn't grab the 'Uploads' tab), scoped to the open dialog. Keep the original English-text selector as a graceful fallback tier (matches if Google changes the icon but keeps the English label). - 'Add to Prompt' (no icon): select structurally as the only iconless button in the open dialog via .filter(has_not=<icon>). - _upload_via_open_dialog: if neither tier opens a chooser within short per-tier timeouts, raise a clear error + screenshot (no silent hang) telling the operator to set the CHROME PROFILE language to English -- explicitly NOT the Google account language. Thread out_dir from both callers. - Add an opt-in i2i e2e variant (GFLOW_CLI_E2E_PROFILE-gated). Verified end-to-end via the real CLI on an English-rendering profile: upload 200 -> reference_attached -> image returned, no 34s gap. The icon/structural selectors are locale-independent by construction; the ffroliva DOM in ffroliva#56 confirms the same `upload` icon under pt-BR. Refs ffroliva#56, ffroliva#24. Signed-off-by: svasakorn <s.vasakorn@gmail.com>
|
Thanks for the contribution. This PR has been marked as an external contribution and routed for maintainer review. Before merge, please make sure:
GitHub Copilot code review may be requested as an advisory first pass, but maintainer approval is still required. |
Verification on ffroliva (pt-BR) ✅ — production code passes. But the test has a bug that needs a 1-line fix before merge.Verification ledger (5 layers)
The locale-agnostic Test transport bug — please amend before merge# tests/e2e/test_transports_e2e.py:169
async with _make_client("evaluate_fetch", profile) as client: # ← REST
image = await client.generate_image(req=req)…but the docstring three lines up explicitly says:
So the test as committed routes through This means your own EN-profile verification was a false positive (sorry to be the bearer): your test sent a REST request with the prompt, Flow generated a text-only image, the Only after patching to One-line amend- async with _make_client("evaluate_fetch", profile) as client:
+ async with _make_client("ui_automation", profile) as client:(Could optionally inline a Optional follow-up (separate PR / your call)The assertion State of PRs from this session
Thanks again for the speed on this — the focused scope, the |
|
Thanks for merging #60! Heads-up: my test-transport fix ( |
The i2i e2e (test_e2e_i2i_local_ref_attach, added in #60) routed through `_make_client("evaluate_fetch", ...)` — the REST transport, which silently drops `ref_paths` and cannot drive the add-media dialog. It returned a text-only image and the `media_name`/`https://` asserts passed, so it was a false positive: the locale-agnostic media-dialog selectors from #60 were never exercised. (Caught in #60 review; the transport fix landed just after the squash-merge, so it missed the merge.) - transport: evaluate_fetch -> ui_automation (so the test drives the media dialog the fix actually changed). - assert a `ui_automation_video.reference_attached` event fires (via the existing `install_log_capture` fixture) so a silently-dropped ref fails the test loudly instead of passing on a text-only image. Test-only; no production change (the selector fix is already on develop). Verified on an EN profile: gated e2e `test_e2e_i2i_local_ref_attach` 1 passed (72s) + real CLI `gflow image i2i --ref <png>` -> image_uploaded 200 -> reference_attached -> image returned (768x1376). Refs #60, #56. Signed-off-by: svasakorn <s.vasakorn@gmail.com>
…ostic media-dialog selectors (ffroliva#56) (ffroliva#60) * feat(image): bind i2i local refs via editor media dialog Local --ref paths now ride GenerateImageRequest.ref_paths and attach through the editor add-media dialog (reusing the R2V _attach_references path) instead of the REST uploadImage endpoint, which 401s (closes ffroliva#39). Bare-UUID refs still flow through refs unchanged. Adds CLI-layer and transport-layer test coverage. Live-verified end-to-end via the real CLI: image i2i --ref <png> -> uploadImage 200, imageInputs[] populated, image returned. Signed-off-by: svasakorn <s.vasakorn@gmail.com> * fix(image): locale-agnostic i2i media-dialog selectors + upload fallback The i2i ref-attach (ffroliva#50) hung on non-English Chrome profiles (ffroliva#56): the 'Upload media' button was matched by localized text, so the file-chooser click missed and silently timed out (~34s). Flow renders the media dialog in the Chrome PROFILE language (NOT the Google account language; the --lang=en-US arg cannot override an already-configured profile). - UPLOAD_MEDIA_BUTTON: anchor on the locale-free `upload` icon ligature (:text-is, exact, so it doesn't grab the 'Uploads' tab), scoped to the open dialog. Keep the original English-text selector as a graceful fallback tier (matches if Google changes the icon but keeps the English label). - 'Add to Prompt' (no icon): select structurally as the only iconless button in the open dialog via .filter(has_not=<icon>). - _upload_via_open_dialog: if neither tier opens a chooser within short per-tier timeouts, raise a clear error + screenshot (no silent hang) telling the operator to set the CHROME PROFILE language to English -- explicitly NOT the Google account language. Thread out_dir from both callers. - Add an opt-in i2i e2e variant (GFLOW_CLI_E2E_PROFILE-gated). Verified end-to-end via the real CLI on an English-rendering profile: upload 200 -> reference_attached -> image returned, no 34s gap. The icon/structural selectors are locale-independent by construction; the ffroliva DOM in ffroliva#56 confirms the same `upload` icon under pt-BR. Refs ffroliva#56, ffroliva#24. Signed-off-by: svasakorn <s.vasakorn@gmail.com> --------- Signed-off-by: svasakorn <s.vasakorn@gmail.com>
…liva#61) The i2i e2e (test_e2e_i2i_local_ref_attach, added in ffroliva#60) routed through `_make_client("evaluate_fetch", ...)` — the REST transport, which silently drops `ref_paths` and cannot drive the add-media dialog. It returned a text-only image and the `media_name`/`https://` asserts passed, so it was a false positive: the locale-agnostic media-dialog selectors from ffroliva#60 were never exercised. (Caught in ffroliva#60 review; the transport fix landed just after the squash-merge, so it missed the merge.) - transport: evaluate_fetch -> ui_automation (so the test drives the media dialog the fix actually changed). - assert a `ui_automation_video.reference_attached` event fires (via the existing `install_log_capture` fixture) so a silently-dropped ref fails the test loudly instead of passing on a text-only image. Test-only; no production change (the selector fix is already on develop). Verified on an EN profile: gated e2e `test_e2e_i2i_local_ref_attach` 1 passed (72s) + real CLI `gflow image i2i --ref <png>` -> image_uploaded 200 -> reference_attached -> image returned (768x1376). Refs ffroliva#60, ffroliva#56. Signed-off-by: svasakorn <s.vasakorn@gmail.com>
Summary
Re-introduces the i2i local-file ref-attach from #50 (reverted in #57) and fixes the #56 root cause by making the media-dialog upload selectors locale-agnostic. Branched off
develop@5345c1bas you suggested.Root cause (#56)
It turned out to be a locale leak, not an intermediate-menu / nesting difference. Your
ffrolivadump (#issuecomment-4528075496) shows the same popover with the same "Upload media" button at the same level as mine — just rendered in pt-BR (Enviar mídia). The oldUPLOAD_MEDIA_BUTTON = button:has-text('Upload media')didn't match the pt-BR label, so the click missed →expect_file_choosernever fired → the ~34s silent timeout.Flow renders the dialog in the Chrome profile language, which
--lang=en-UScannot override on an already-configured profile (matches your "server-side locale overrides the launch arg" observation; same class as #51 / #24).Changes
src/gflow_cli/api/transports/ui_automation_video.py:UPLOAD_MEDIA_BUTTON→ the locale-freeuploadicon ligature,:text-is('upload')(exact — so it doesn't also grab theUploadstab whose icon isdrive_folder_upload), scoped to[role='dialog'][data-state='open']. This is the selector you recommended, with the exact-match refinement.has-text('Upload media')), tried only if the icon misses. Covers the narrow case where Google changes the icon ligature but keeps the English label. Short per-tier timeouts so two misses can't recreate a long silent hang..filter(has_not=<i.google-symbols>)) instead of by localized text.RuntimeError. The message explicitly tells the operator to set the Chrome profile language to English (chrome://settings/languages) and that the Google account language is not enough — that distinction is genuinely easy to get wrong.tests/e2e/test_transports_e2e.py:test_e2e_i2i_local_ref_attach),GFLOW_CLI_E2E_PROFILE-gated, ui-automation transport only (the REST transports can't drive the add-media dialog). Generates a tiny PNG inline — no asset dependency.The shared
_upload_via_open_dialogis also used by I2V/R2V, so this hardens those upload paths too.Verification
Real CLI, English-rendering profile, this branch:
Honest caveat: I can only verify on an English-rendering profile, where both the icon and text selectors would match — so this proves the end-to-end path works, but not the pt-BR path specifically. The icon selector is locale-independent by construction and your
ffrolivadump confirms the sameuploadligature there. Could you run the gated e2e (or yourcapture_image_add_media_dom.pyfrom #59) onffrolivato confirm before closing #56? I deliberately wrote "Refs", not "Closes".Not fixed here (focused PR — flagging per your preference)
FRAME_SLOT_BY_LABEL(I2V Start/End slots,div[aria-haspopup='dialog']:has-text('{label}')) is still text-based and will hit the same locale issue on a non-English profile. It's the I2V frame-slot path, separate from this upload fix, and belongs with #24 — happy to follow up separately rather than widen this PR.Test plan
check_repo_hygiene.py— clean (255 files)ruff check src tests— cleanruff format --check src tests— clean (103 files)pyright src— 0 errorspytest -q -m "not e2e and not live"— 806 passed, 6 skipped (single local interpreter)gflow image i2i --ref <png>on an EN profile — image returned (timeline above)action_required; needs your approve-and-run)GFLOW_CLI_E2E_PROFILE=...)DCO-signed (both commits). Refs #56, #24.