Repository navigation
fix: don't fail activation on chat models without a family - #1137
Open
dividedmind wants to merge 1 commit into
Open
dividedmind wants to merge 1 commit into
dividedmind wants to merge 1 commit into
Conversation
dividedmind
requested review from
kgilpin
and
a balanced review from Copilot
November 11, 2026 22:18
There was a problem hiding this comment.
🟡 Changes recommended
The new tests short-circuit before the family comparison because token counts differ, leaving the equal-token missing-family crash untested in either input order.
1 open issue
What changed in this PR
This PR addresses #1133 by making chat-model sorting tolerate missing provider metadata and preventing chat initialization failures from blocking the rest of the AppMap extension.
Changes:
- Default missing token counts and families to safe values, using family only to break token-count ties.
- Catch and report chat initialization failures during activation.
- Add regression tests for incomplete model metadata across different provider orders.
| File | Description |
|---|---|
test/unit/services/chatCompletion.test.ts |
Adds sorting tests for models missing metadata. |
src/services/chatCompletion.ts |
Makes model sorting null-safe and corrects tie-breaking. |
src/extension.ts |
Logs and reports chat initialization failures while allowing activation to continue. |
Review effort: Balanced
ChatCompletion.refreshModels() sorted models with b.family.localeCompare(a.family). Language model providers other than Copilot can return models with no family (despite the typings), which threw a TypeError from inside activate() and left most of the extension unregistered. Whether it threw depended on the order the provider listed the models in. Treat a missing family as '' and a missing maxInputTokens as 0, and use || so the family only breaks ties on token count. Also catch and report ChatCompletion.initialize failures in activate(), so a broken provider can't take the rest of the extension down with it. Fixes #1133 Assisted-by: Claude:claude-opus-5-5
dividedmind
force-pushed
the
fix/chat-model-sort-missing-family
branch
from
November 11, 2026 23:00
42c0159 to
c5dd365
Compare
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.

ChatCompletion.refreshModels() sorted models with b.family.localeCompare(a.family). Language model providers other than Copilot can return models with no family (despite the typings), which threw a TypeError from inside activate() and left most of the extension unregistered. Whether it threw depended on the order the provider listed the models in.
Treat a missing family as '' and a missing maxInputTokens as 0, and use || so the family only breaks ties on token count. Also catch and report ChatCompletion.initialize failures in activate(), so a broken provider can't take the rest of the extension down with it.
Fixes #1133
Assisted-by: Claude:claude-opus-5-5