Skip to content

Python: dispatch the model kind by shape in the declarative schema - #9867

Closed
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/model-dispatch-dead-branch
Closed

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/model-dispatch-dead-branch

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Motivation & Context

agent_schema_dispatch contained two case "model" branches. The first returned a ModelResource, making the branch returning a Model unreachable dead code, so a model specification carrying its actual fields (provider, apiType, connection, options) raised a TypeError and no input shape could load a Model through the dispatch.

Description & Review Guide

  • What are the major changes? The duplicate branch is removed and the single model case now dispatches by shape: a schema carrying any model specification field loads as a Model, with the kind tag dropped before construction, and everything else keeps loading as the model resource exactly as the existing dispatch tests pin.
  • What is the impact of these changes? Model specifications become loadable through the exported dispatch while resource shaped payloads are unaffected, including the name plus id form covered by the current tests.
  • What do you want reviewers to focus on? The discriminator set (provider, apiType, connection, options) covering every field unique to the model specification, so neither class can capture the other's payloads.

Related Issue

Fixes #9866

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Two case branches shared the model kind, leaving the Model branch unreachable dead code, so a model specification raised a TypeError instead of loading. The dispatch now sends provider carrying shapes to Model and keeps name carrying shapes on the model resource.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Understood, sorry for racing ahead of the review process. #9866 now uses the bug report template with the dispatch reproduction, and this stays closed until the team agrees.

This branch was previously deployed

1 inactive deployment
github-app-auth — d685cf96 Deployed Oct 30, 2026 by ManoharPaturi via team_check #8070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: a declarative Model component cannot be loaded through agent_schema_dispatch

2 participants