Skip to content

Ffroliva develop - #2

Merged
C1ph3r404 merged 8 commits into
developfrom
ffroliva-develop
Jul 7, 2026
Merged

C1ph3r404 merged 8 commits into
developfrom
ffroliva-develop

Conversation

@C1ph3r404

Copy link
Copy Markdown
Owner

Summary

Validation

  • Focused tests added or updated for behavior changes
  • Documentation updated or explicitly marked not applicable
  • uv run python scripts/ci/check_doc_links.py
  • uv run ruff check src tests
  • uv run pyright src
  • Relevant pytest command:

Contribution Checklist

  • This PR targets develop, unless it is a release or emergency fix
  • My commits use my real Git identity or GitHub noreply email
  • External contribution commits include Signed-off-by: (git commit -s)
  • I did not include secrets, cookies, account tokens, signed URLs, or private captured data
  • I reviewed any AI-assisted changes before submitting

C1ph3r404 added 8 commits July 6, 2026 17:26
The display_name was previously ignored when parsing the batchGenerateImages response, causing the CLI to rely on the prompt text when searching for generated images in the remote UI picker.

Changes:
- api/dto.py: Extract the 'workflows' array from the response and map workflow IDs to their display names, injecting the 'display_name' into the GeneratedImage model.
- data/recorder.py: Save the extracted 'display_name' into the asset's metadata_json during database upsert.
Fixes the regression where image tasks with remote UUID references were not
resolved to display names, causing the UI automation transport to ignore them
and submit standard text-to-image prompts.

- Updates _resolve_payload_ref_names to resolve image refs on a best-effort basis (satisfying PR ffroliva#245).
- Adds ref_names to GenerateImageRequest.
- UI automation transport now properly searches and attaches UUID refs via the media dialog.
This commit introduces full support for Camoufox (`GFLOW_CLI_BROWSER_ENGINE=camoufox`), an anti-detect Firefox build, to provide stronger WAF and bot-detection evasion compared to the default Playwright Chromium engine.

### Core Changes
* **Engine Configuration**: Added `CAMOUFOX` to the `BrowserEngine` enum in `config.py` and updated `_engine.py` to resolve it and handle `camoufox.async_api.Error` in the retry logic.
* **Authentication**: Implemented `CamoufoxAuthStrategy` (and registered it in `auth/factory.py` and `cli.py`) so users can perform the one-time Google login natively via `gflow auth login --browser camoufox`.
* **Transport Lifecycle (`ui_automation.py`)**:
  * Updated the UI transport setup to correctly launch an `AsyncCamoufox` persistent context rather than a headless Playwright context when the engine is selected.
  * Bypassed manual `navigator.webdriver=false` injection for Camoufox since it handles fingerprint spoofing natively.
  * Replaced `.insert_text()` with `.type()` for keyboard input specifically on Camoufox to ensure compatibility with Flow's Slate.js editor.
  * Added exception guards to catch and ignore `NS_BINDING_ABORTED` errors during `page.goto`, a known quirk in Firefox's network stack when navigating quickly.

### Bug Fixes & Stability
* **reCAPTCHA Crash in Camoufox (`client.py`)**: Camoufox natively blocks trackers, which prevents `recaptcha/enterprise.js` from loading. Previously, `_drive_images_generation` unconditionally attempted to mint a token, crashing the Camoufox worker. We now skip the `_mint_recaptcha_token` step entirely for the `ui_automation` transport (since the UI handles token generation natively), completely resolving the crash and eliminating a 20-second timeout penalty.
* **Workflow Name Mapping (`ui_automation.py`)**: Improved the `_collect_images_from_body` parser to extract display names from the `workflows` array, ensuring generated images correctly reflect their reference names.
…e extraction

This commit adds tests to guarantee the stability of two recent fixes:

- Verified that a WAF Rejection now correctly attempts a recovery using `page.goto(page.url)` instead of `page.reload()`, validating the cache-bypassing client exception fix for Camoufox.

- Added a new unit test for `_collect_images_from_body` to assert that fully-qualified resource paths (e.g. `projects/.../workflows/...`) correctly have their prefixes stripped, ensuring the `display_name` is not silently dropped during generation.
…t assertions

This fixes test regressions after changing how _remote_option_tile and picker button interact, and adds a check for dialog auto-closing without 'add to prompt' click on some accounts.
…th goto(page.url)

When regenerating an image in an existing project, page.reload() was hanging in the Camoufox engine causing a 45s timeout. Using goto(page.url) bypasses this and reloads the page reliably.
…alth

This commit resolves multiple interconnected issues across the MCP transport, test reliability, and browser stealth layers:

- **Video Model Fallback**: Enforces the `I2V_DEFAULT_MODEL` (veo-lite) in `gflow_generate_video` when running in `i2v` mode. This prevents the default `omni-flash` model from silently dropping the initial frame and burning generation credits, mirroring the protection already present in the CLI.
- **MCP Tool Parameter Parity**: Exposes `model`, `duration`, and `count` arguments in the `gflow_generate_video` MCP schema to bring it in line with the CLI, ensuring proper model selection is available to agents.
- **Wired Test Suite Resilience**: Updates `test_tools_wired.py` to correctly mock `gflow_cli.mcp.tools.FlowApiClient` (rather than the daemon's internal client). This fixes tests leaking real headless Playwright sessions due to the recently introduced `_SessionManager`.
- **Domain Object Mock Integrity**: Adds the `display_name` property to `_FakeImage` to prevent `AttributeError` crashes when the newly introduced display_name parser runs against the mocked test objects.
- **Browser Stealth (Camoufox)**: Adds an optional `mcp_warmup` routine to the `FlowApiClient` initialization to mimic human-like navigation patterns (Google Search -> Flow) to reduce WAF rejections, and switches from fast Playwright `.fill()` to simulated keystroke `.type()` inside the agentic driver when using Camoufox.
@C1ph3r404
C1ph3r404 merged commit d70b098 into develop Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant