Skip to content

fix: keep Auto model bindings and resolution consistent - #2153

Merged
rogercloud merged 5 commits into
xorbitsai:mainfrom
rogercloud:fix/auto-model-consistency
Sep 6, 2026
Merged

fix: keep Auto model bindings and resolution consistent#2153
rogercloud merged 5 commits into
xorbitsai:mainfrom
rogercloud:fix/auto-model-consistency

Conversation

@rogercloud

Copy link
Copy Markdown
Collaborator

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.

  • Validate profile input modalities against saved model abilities when saving and resolving Auto configurations. Protect bound model identity changes, prune external references when an owner changes a model, and keep configured runtime abilities tied to the actual downstream model.
  • Resolve only missing default slots, using the explicit general model as fallback for an unset specialized slot.
  • Preserve Auto configuration errors and expose safe, actionable responses in HTTP, A2A, v1 reply, Builder WebSocket, Slack, and Feishu entrypoints.
  • Remove bindings that lose visibility after user deletion while preserving surviving grants, and refresh Auto abilities after candidate edits or pruning.

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.

@XprobeBot XprobeBot added the bug Something isn't working label Sep 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/xagent/web/api/model.py
Comment thread src/xagent/web/api/admin_users.py
Comment thread src/xagent/web/services/model_store.py
Comment thread src/xagent/web/api/websocket.py

@qinxuye qinxuye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@rogercloud
rogercloud enabled auto-merge September 6, 2026 15:37
@rogercloud
rogercloud added this pull request to the merge queue Sep 6, 2026
Merged via the queue into xorbitsai:main with commit 45192ce Sep 6, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants