Skip to content

Send videos to InvokeAI 7: Initial Video, Ref Video, Recall and Remix - #403

Merged
lstein merged 1 commit into
masterfrom
lstein/feature/invokeai-video-recall
Sep 27, 2026
Merged

lstein merged 1 commit into
masterfrom
lstein/feature/invokeai-video-recall

Conversation

@lstein

@lstein lstein commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

InvokeAI 7 adds a video recall API (invoke-ai/InvokeAI-7#339) that mirrors the image recall API PhotoMap already uses. This PR adds InvokeAI buttons to the metadata drawer for videos:

Button Shown for What it does
Initial Video every video Puts it in the Video panel's Initial Video slot (the clip that gets extended)
Ref Video every video Appends it to the reference videos of the selected model (MiniMax H3 Ref2VA today)
Remix videos with InvokeAI video metadata Recalls every parameter except the seed (mode=remix, strict=true)
Recall videos with InvokeAI video metadata Recalls every parameter, including the seed (mode=recall, strict=true)

The buttons only appear when the linked InvokeAI's OpenAPI schema lists /api/v1/recall/video/{queue_id} (the new video_recall capability). Image buttons are unchanged.

How it works

  • Record → request (metadata_modules/invoke/video_recall.py):
    • The request is built from a whitelist over the raw record, not the Pydantic parse. The upstream request model is extra="forbid", and the raw record also carries ltx2_* fields PhotoMap doesn't model.
    • Models are sent by name, and LoRAs as model_name.
    • Each value is checked against the upstream bounds and dropped on its own if it fails. Upstream rejects the whole request (422) over a single bad value.
  • Sending the file (POST /invokeai/video/use_media):
    • A video InvokeAI may already have (UUID filename, or an InvokeAI record) is placed by name first.
    • On 401/403/404 it's uploaded through the /upload route instead, onto the configured board, falling back to Uncategorized.
    • A timeout while InvokeAI converts the video gives a message saying the video may still appear, so the user doesn't retry and create a duplicate.
  • Recall (POST /invokeai/video/recall):
    • Parameters InvokeAI couldn't use (listed in its skipped) are shown in a yellow note under the buttons.
    • If InvokeAI refuses the recall with a 403 because the record names media the user can't read, it's retried once without the media fields, and those are reported as skipped.

Also in this PR

  • Auth fallback fix (invokeai_client._request_with_auth_fallback). A 403 on a request that carried a token was always retried anonymously, and the token dropped. When that anonymous retry is refused with a 401, the backend still requires login, so the 403 was a real permission refusal: it's now returned as-is and the token kept. Before this, a board the user couldn't write to broke the board fallback on every other click, showing "401 Not authenticated". This affects image uploads too.
  • Test isolation fix (tests/backend/conftest.py). PHOTOMAP_CONFIG was set in a session fixture, which runs after test collection. A test module that imports a router at module level would bind the cached config manager to the developer's real config file, and the tests would then write to it. This happened while developing this PR. The variable is now set when conftest is imported, and a session check fails the run if the config path isn't the temp file.

Known limitations

  • The upstream API (feat(api): external video recall API invoke-ai/InvokeAI-7#339) isn't merged yet, and the InvokeAI frontend handler for the video_recall_requested event ships in a follow-up PR. Until that lands, the buttons report success but the InvokeAI UI doesn't change.
  • LTX-2 conditioning videos go through the same Ref Video button, so InvokeAI decides where a reference video goes based on the selected model. The API has no append route for the single LTX conditioning slot.
  • Models are sent by name, not by key, the same as image recall, so recall also works on a different InvokeAI install. On the install that produced the video, two models with the same name could resolve to the wrong one.

Test plan

  • uv run pytest tests: 1171 passed. The new tests/backend/test_video_recall.py covers the translation, both routes, board and auth fallbacks, withheld media, the timeout message and the capability flag.
  • npm test: 915 passed. New cases cover the four video modes, the skipped/warning note, success: false, and the capability class.
  • ruff check, npm run lint, npm run format:check
  • An adversarial fresh-context review; its confirmed findings are fixed here.
  • Manual: against a backend running InvokeAI-7#339, check that Initial Video, Ref Video, Recall and Remix send correctly and that InvokeAI emits video_recall_requested.
  • Manual: against an older InvokeAI, the video buttons are hidden.

🤖 Generated with Claude Code

InvokeAI 7 adds a video recall API (invoke-ai/InvokeAI-7#339) that mirrors
the image one. The metadata drawer now offers, for any video:

* Initial Video: place it in the Video panel's Initial Video slot.
* Ref Video: append it to the reference videos of the selected model.

and, for videos that carry an InvokeAI video generation record:

* Recall / Remix: send the record's parameters with strict=true, so the
  panel is reset to the record; Remix uses mode=remix to keep the seed.

The record is translated with a whitelist, and each value is checked
against the upstream request bounds and dropped on its own, because
InvokeAI refuses the whole request over one bad value. Videos InvokeAI may
already have are placed by name before falling back to an upload onto the
configured board, then Uncategorized. The buttons are gated on a new
video_recall capability read from InvokeAI's OpenAPI schema.

Also:

* The auth fallback no longer turns a genuine 403 into a 401. A 403 on a
  token-bearing request was always retried anonymously and the token
  dropped; when the anonymous retry is refused with a 401, the backend is
  still multi-user, so the 403 is returned and the token kept. This broke
  the board fallback on every other click.
* tests/backend/conftest.py sets PHOTOMAP_CONFIG at import time, not in a
  session fixture. A test module that imported a router at module level
  bound the cached config manager to the developer's real config file
  during collection, and the tests then wrote to it. A session guard now
  fails the run if the config path is not the temp file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lstein
lstein merged commit 939a620 into master Sep 27, 2026
10 checks passed
@lstein
lstein deleted the lstein/feature/invokeai-video-recall branch September 27, 2026 16:48
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