Skip to content

Conversation

@marc-romu
Copy link
Member

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

  • Verified model badge display shows correct "invalid model" badge for providers without capable models
  • Ensured existing badge logic continues to work for valid models

Checklist

  • This PR is focused on a single feature or bug fix
  • Version in Solution.props was updated, if necessary, and follows semantic versioning
  • CHANGELOG.md has been updated
  • PR title follows Conventional Commits format
  • PR description follows Pull Request Description Template

Copilot AI review requested due to automatic review settings October 12, 2025 14:24
@github-actions
Copy link
Contributor

🏷️ This PR has been automatically assigned to milestone 1.0.1-alpha based on the version in Solution.props.

@github-actions github-actions bot added this to the 1.0.1-alpha milestone Oct 12, 2025
@marc-romu marc-romu linked an issue Oct 12, 2025 that may be closed by this pull request
@marc-romu marc-romu added the scope: Component Base Issues related to the Component Base label Oct 12, 2025
Copy link
Contributor

Copilot AI left a 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.

Comment on lines +429 to +430
Debug.WriteLine($"[UpdateBadgeCache] START: provider={providerName}, component={this.Name}");

Copy link

Copilot AI Oct 12, 2025

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.

Copilot uses AI. Check for mistakes.

// Resolve model the user currently configured (for validation/replacement decisions)
string configuredModel = this.GetModel();
Debug.WriteLine($"[UpdateBadgeCache] configuredModel={configuredModel}, capability={this.RequiredCapability}");
Copy link

Copilot AI Oct 12, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +458 to +467
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}");
Copy link

Copilot AI Oct 12, 2025

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.

Suggested change
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}");

Copilot uses AI. Check for mistakes.
Comment on lines +458 to +467
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}");
Copy link

Copilot AI Oct 12, 2025

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.

Suggested change
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}");

Copilot uses AI. Check for mistakes.
&& !string.IsNullOrWhiteSpace(resolvedModel)
&& !string.Equals(configuredModel, resolvedModel, StringComparison.Ordinal))
|| hasCapabilityMismatch);
Debug.WriteLine($"[UpdateBadgeCache] badgeReplacedModel={this.badgeReplacedModel}");
Copy link

Copilot AI Oct 12, 2025

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.

Copilot uses AI. Check for mistakes.
|| hasNoCapableModel
|| hasCapabilityMismatch
|| this.badgeReplacedModel;
Debug.WriteLine($"[UpdateBadgeCache] badgeInvalidModel={this.badgeInvalidModel}");
Copy link

Copilot AI Oct 12, 2025

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.

Copilot uses AI. Check for mistakes.
this.badgeCacheValid = true;
}

Debug.WriteLine($"[UpdateBadgeCache] END: verified={this.badgeVerified}, deprecated={this.badgeDeprecated}, invalid={this.badgeInvalidModel}, replaced={this.badgeReplacedModel}, cacheValid={this.badgeCacheValid}");
Copy link

Copilot AI Oct 12, 2025

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.

Copilot uses AI. Check for mistakes.
catch (Exception ex)
{
// On any failure, mark cache invalid to avoid rendering
Debug.WriteLine($"[UpdateBadgeCache] EXCEPTION: {ex.Message}");
Copy link

Copilot AI Oct 12, 2025

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.

Suggested change
Debug.WriteLine($"[UpdateBadgeCache] EXCEPTION: {ex.Message}");
Trace.WriteLine($"[UpdateBadgeCache] EXCEPTION: {ex.Message}");

Copilot uses AI. Check for mistakes.
@marc-romu marc-romu merged commit af421ac into dev Oct 12, 2025
11 checks passed
@github-actions github-actions bot deleted the bugfix/1.0.1-fix-badge-display-criteria branch October 12, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: Component Base Issues related to the Component Base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong badge when non available for replacement

2 participants