Repository navigation
Set lifecycle=active on constructed ModelInfo descriptors (issue #13) - #14
Merged
Merged
Conversation
The anthropic SDK 2.x line (which HA 2026.11 pairs at 2.3.0) made `lifecycle` a required field on anthropic.types.ModelInfo. Every model descriptor this integration constructs without it raises `pydantic ValidationError: lifecycle Field required`, which broke OpenRouter model-list refreshes on 2026.11 (reported by mkruseonline) and, on the same construction shape, four more paths: - openai_chat_provider.normalize_model() (list refresh + retrieve passthrough) - openai_chat_provider.fetch_model() retrieve-failure fallback - openai_chat_provider.fetch_model() non-Model-body fallback (z.ai empty-200) - coordinator.get_model_info() not-found fallback - anthropic_provider.fetch_model() empty-response fallback All five sites now construct with lifecycle="active". SDKs elsewhere in the manifest pin range (0.108.0+) declare the field as an allowed extra rather than a schema field, so passing it unconditionally is safe across the entire range; the pinned test tree (anthropic 0.125.0) exercises exactly that path. Construction verified clean against anthropic==2.3.0 on Python 3.13. Tests: new retrieve-failure regression test; lifecycle assertions added to normalize-model, both fetch-degrade, and coordinator not-found tests. Suite: 146 passed, 2 skipped (145/2 baseline + 1).
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.
Closes #13.
Summary
The anthropic SDK 2.x line (which HA 2026.11 pairs at 2.3.0) made
lifecyclea required field onanthropic.types.ModelInfo. Every descriptor the integration constructs without it raisespydantic ValidationError: lifecycle Field required. The reporter (@mkruseonline) hit this on OpenRouter model-list refreshes; this PR setslifecycle="active"at all five construction sites:openai_chat_provider.normalize_model()(list refresh and retrieve passthrough)openai_chat_provider.fetch_model()retrieve-failure fallbackopenai_chat_provider.fetch_model()non-Model-body fallback (z.ai empty-200)coordinator.get_model_info()not-found fallbackanthropic_provider.fetch_model()empty-response fallbackSDKs elsewhere in the manifest pin range (0.108.0+) declare the field as an allowed extra rather than a schema field, so passing it unconditionally is safe across the entire range; the pinned test tree (anthropic 0.125.0) exercises exactly that path.
Test plan
models.retrievefailure degrades to a descriptor carryinglifecycle="active"ModelInfo(lifecycle="active")construction verified againstanthropic==2.3.0on Python 3.13: cleanShips as 1.3.2 (manifest + CHANGELOG included).