Skip to content

[BUG] image i2i fails with AuthExpiredError: HTTP 401 (missing UI-automation for uploads) #39

Closed

Description

@ffroliva

[BUG/FEATURE] Robust i2v and i2i support via "API-via-Browser" Bypass

Description:
Character consistency in v0.7.0 is currently blocked because i2v and i2i require an image upload. The current transport logic falls back to a legacy HTTP POST which fails with 401 Unauthorized.

Empirical research using browser-harness has identified a highly robust "API-via-Browser" bypass that eliminates the need for complex UI clicking and solves the auth issue.

Technical Discovery:

  • Hidden Gateway: Google Flow maintains a persistent hidden file input: input[type="file"][accept="image/*"].
  • Direct Upload: Verified that calling page.set_input_files(selector, path) on this input automatically triggers the uploadImage XHR request without any button clicking.
  • UUID Extraction: The image UUID (needed for generation) is returned in the JSON response at media.name.
  • Auth Solution: By using page.evaluate(fetch, ...) inside the browser session, we can reuse the application's internal Authorization (Bearer) tokens and session state.

Proposed Implementation (Task 0 Fix):

  1. Implement upload_image in ui_automation.py:

    • Use page.set_input_files('input[type="file"][accept="image/*"]', path).
    • Register a page.on("response") listener to capture the result from https://aisandbox-pa.googleapis.com/v1/flow/uploadImage.
    • Return the extracted media[0].name.
  2. Implement i2v (Image-to-Video) in ui_automation_video.py:

    • Instead of navigating dropdowns, capture the Authorization header from the upload request.
    • Use page.evaluate() to call the batchAsyncGenerateVideoStartAndEndImage endpoint using fetch().
    • This ensures all cookies and tokens are valid, bypassing the 401 error.

Impact:

  • Restores character consistency for automated pipelines (Stickman/Kitten archetypes).
  • significantly faster than UI-automation based clicking.
  • Robust against UI layout changes.

Verification:

  • Verified manually using a standalone script that successfully triggered the upload and captured the UUID.
  • Requires integration into the UiAutomationTransport protocol.

Activity

  1. added 3 commits that reference this issue on May 24, 2026
    529d335
    32c2331
    822866d
  2. added 3 commits that reference this issue on Aug 24, 2026
    2137f56
    fde9bff
    e491d46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions