Skip to content

Fix(model install): wait for startup restore before imports - #9239

Merged
lstein merged 3 commits into
invoke-ai:mainfrom
JPPhoto:fix-model-install-race
Jun 5, 2026
Merged

Fix(model install): wait for startup restore before imports#9239
lstein merged 3 commits into
invoke-ai:mainfrom
JPPhoto:fix-model-install-race

Conversation

@JPPhoto

@JPPhoto JPPhoto commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a model install startup race where a new import could be enqueued before incomplete installs had finished restoring.

The model install service now tracks the startup restore thread with an event and waits for restore completion before accepting new imports or reporting install completion. This prevents duplicate or conflicting install work during app startup.

Updated:

  • invokeai/app/services/model_install/model_install_default.py
  • tests/app/services/model_install/test_model_install.py

Related Issues / Discussions

QA Instructions

Run pytest tests/app/services/model_install/test_model_install.py as well as all other tests.

The new test verifies that import_model() blocks while startup restore is still running, then proceeds after restore completes.

Merge Plan

No special merge handling required.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@JPPhoto
JPPhoto requested a review from blessedcoolant as a code owner May 27, 2026 02:22
@JPPhoto JPPhoto added the 6.13.5 Library Updates label May 27, 2026
@JPPhoto
JPPhoto requested review from dunkeroni and lstein as code owners May 27, 2026 02:22
@JPPhoto JPPhoto moved this to 6.13.5 LIBRARY UPDATES in Invoke - Community Roadmap May 27, 2026
@github-actions github-actions Bot added python PRs that change python files services PRs that change app services python-tests PRs that change python tests labels May 27, 2026
@lstein lstein self-assigned this May 27, 2026
@JPPhoto
JPPhoto force-pushed the fix-model-install-race branch from 9bfe96b to 2b650fb Compare May 27, 2026 21:23
@JPPhoto
JPPhoto force-pushed the fix-model-install-race branch from 2b650fb to 99def3c Compare May 29, 2026 11:02

@lstein lstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lstein
lstein enabled auto-merge (squash) June 4, 2026 23:57
@lstein
lstein merged commit db0b08b into invoke-ai:main Jun 5, 2026
14 checks passed
@JPPhoto
JPPhoto deleted the fix-model-install-race branch June 7, 2026 14:52
dunkeroni pushed a commit to dunkeroni/InvokeAI that referenced this pull request Jun 29, 2026
…i#9239)

* fix(model install): wait for startup restore before imports

* chore(backend): ruff

---------

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.13.5 Library Updates python PRs that change python files python-tests PRs that change python tests services PRs that change app services

Projects

Status: 6.13.5 LIBRARY UPDATES

Development

Successfully merging this pull request may close these issues.

2 participants