-
Notifications
You must be signed in to change notification settings - Fork 0
fix(component): fix model badge display #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🏷️ This PR has been automatically assigned to milestone 1.0.1-alpha based on the version in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes incorrect model badge display behavior where "model replaced" badge was shown instead of "invalid model" badge when a provider has no capable model for the required capability.
- Corrected the badge logic to prevent marking a model as "replaced" when the provider has no capable model
- Added debug logging to track badge state determination for troubleshooting
- Updated CHANGELOG.md to document the fix
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/SmartHopper.Core/ComponentBase/AIStatefulAsyncComponentBase.cs | Fixed badge logic and added debug logging to UpdateBadgeCache method |
| CHANGELOG.md | Added entry documenting the model badge display fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| Debug.WriteLine($"[UpdateBadgeCache] START: provider={providerName}, component={this.Name}"); | ||
|
|
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
|
|
||
| // Resolve model the user currently configured (for validation/replacement decisions) | ||
| string configuredModel = this.GetModel(); | ||
| Debug.WriteLine($"[UpdateBadgeCache] configuredModel={configuredModel}, capability={this.RequiredCapability}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| Debug.WriteLine($"[UpdateBadgeCache] resolvedModel={resolvedModel}"); | ||
|
|
||
| // Gather validation messages (may include provider/model issues) | ||
| var (isValid, validationMessages) = req.IsValid(); | ||
| Debug.WriteLine($"[UpdateBadgeCache] isValid={isValid}, messageCount={validationMessages?.Count ?? 0}"); | ||
| if (validationMessages != null) | ||
| { | ||
| foreach (var msg in validationMessages) | ||
| { | ||
| Debug.WriteLine($"[UpdateBadgeCache] - {msg.Severity} {msg.Code}: {msg.Message}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| Debug.WriteLine($"[UpdateBadgeCache] resolvedModel={resolvedModel}"); | |
| // Gather validation messages (may include provider/model issues) | |
| var (isValid, validationMessages) = req.IsValid(); | |
| Debug.WriteLine($"[UpdateBadgeCache] isValid={isValid}, messageCount={validationMessages?.Count ?? 0}"); | |
| if (validationMessages != null) | |
| { | |
| foreach (var msg in validationMessages) | |
| { | |
| Debug.WriteLine($"[UpdateBadgeCache] - {msg.Severity} {msg.Code}: {msg.Message}"); | |
| Trace.WriteLine($"[UpdateBadgeCache] resolvedModel={resolvedModel}"); | |
| // Gather validation messages (may include provider/model issues) | |
| var (isValid, validationMessages) = req.IsValid(); | |
| Trace.WriteLine($"[UpdateBadgeCache] isValid={isValid}, messageCount={validationMessages?.Count ?? 0}"); | |
| if (validationMessages != null) | |
| { | |
| foreach (var msg in validationMessages) | |
| { | |
| Trace.WriteLine($"[UpdateBadgeCache] - {msg.Severity} {msg.Code}: {msg.Message}"); |
| Debug.WriteLine($"[UpdateBadgeCache] resolvedModel={resolvedModel}"); | ||
|
|
||
| // Gather validation messages (may include provider/model issues) | ||
| var (isValid, validationMessages) = req.IsValid(); | ||
| Debug.WriteLine($"[UpdateBadgeCache] isValid={isValid}, messageCount={validationMessages?.Count ?? 0}"); | ||
| if (validationMessages != null) | ||
| { | ||
| foreach (var msg in validationMessages) | ||
| { | ||
| Debug.WriteLine($"[UpdateBadgeCache] - {msg.Severity} {msg.Code}: {msg.Message}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| Debug.WriteLine($"[UpdateBadgeCache] resolvedModel={resolvedModel}"); | |
| // Gather validation messages (may include provider/model issues) | |
| var (isValid, validationMessages) = req.IsValid(); | |
| Debug.WriteLine($"[UpdateBadgeCache] isValid={isValid}, messageCount={validationMessages?.Count ?? 0}"); | |
| if (validationMessages != null) | |
| { | |
| foreach (var msg in validationMessages) | |
| { | |
| Debug.WriteLine($"[UpdateBadgeCache] - {msg.Severity} {msg.Code}: {msg.Message}"); | |
| Trace.WriteLine($"[UpdateBadgeCache] resolvedModel={resolvedModel}"); | |
| // Gather validation messages (may include provider/model issues) | |
| var (isValid, validationMessages) = req.IsValid(); | |
| Trace.WriteLine($"[UpdateBadgeCache] isValid={isValid}, messageCount={validationMessages?.Count ?? 0}"); | |
| if (validationMessages != null) | |
| { | |
| foreach (var msg in validationMessages) | |
| { | |
| Trace.WriteLine($"[UpdateBadgeCache] - {msg.Severity} {msg.Code}: {msg.Message}"); |
| && !string.IsNullOrWhiteSpace(resolvedModel) | ||
| && !string.Equals(configuredModel, resolvedModel, StringComparison.Ordinal)) | ||
| || hasCapabilityMismatch); | ||
| Debug.WriteLine($"[UpdateBadgeCache] badgeReplacedModel={this.badgeReplacedModel}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| || hasNoCapableModel | ||
| || hasCapabilityMismatch | ||
| || this.badgeReplacedModel; | ||
| Debug.WriteLine($"[UpdateBadgeCache] badgeInvalidModel={this.badgeInvalidModel}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| this.badgeCacheValid = true; | ||
| } | ||
|
|
||
| Debug.WriteLine($"[UpdateBadgeCache] END: verified={this.badgeVerified}, deprecated={this.badgeDeprecated}, invalid={this.badgeInvalidModel}, replaced={this.badgeReplacedModel}, cacheValid={this.badgeCacheValid}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| catch (Exception ex) | ||
| { | ||
| // On any failure, mark cache invalid to avoid rendering | ||
| Debug.WriteLine($"[UpdateBadgeCache] EXCEPTION: {ex.Message}"); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug.WriteLine statements should be removed from production code or replaced with proper logging using a logging framework. These debug statements can impact performance and clutter the debug output.
| Debug.WriteLine($"[UpdateBadgeCache] EXCEPTION: {ex.Message}"); | |
| Trace.WriteLine($"[UpdateBadgeCache] EXCEPTION: {ex.Message}"); |
Description
Fixes model badge display issue where "invalid model" badge was not shown when provider has no capable model, instead showing "model replaced" badge incorrectly.
Breaking Changes
No breaking changes.
Testing Done
Checklist