fix: keep Auto model bindings and resolution consistent - #2153
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the robustness of Auto model configurations by introducing strict modality validation, handling model deletion cascades, and propagating a client-safe AutoModelUnavailableError across API endpoints, channels, and websockets. Review feedback points out a potential NameError due to missing exception imports in model.py, suggests using scalar_subquery() for SQLAlchemy 2.0 compatibility in admin_users.py, and recommends adding an early return guard in refresh_auto_model_abilities to avoid redundant database operations.
qinxuye
reviewed
Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto model bindings could retain routing metadata that no longer matched their saved models, and resolving an omitted compact model could fail because an unrelated default Auto configuration was broken. This also left stale candidate references and inconsistent errors across entrypoints.
Validation: 394 related tests passed, including 22 database-backed consistency regressions and protocol/channel error handling coverage. Ruff and git diff checks passed. Full-package mypy reported 43 errors in 16 unchanged files; no type errors remain in changed files.
Existing inconsistent Auto bindings now fail explicitly and must be corrected. Changing the identity of a model referenced by the owner's Auto configuration requires removing that binding first; credential changes remain supported.
Follow-up to #2117.