Skip to content

feat: add reliability score - #673

Open
avanibapna06 wants to merge 5 commits into
AditthyaSS:mainfrom
avanibapna06:feat/reliability-score
Open

feat: add reliability score#673
avanibapna06 wants to merge 5 commits into
AditthyaSS:mainfrom
avanibapna06:feat/reliability-score

Conversation

@avanibapna06

@avanibapna06 avanibapna06 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?
This PR introduces an Agent Reliability Score & Trust Insights system for the platform. It adds a visual TrustBadge component that displays a reliability score (0-100) on each agent card. The scoring engine calculates reliability using a heuristic-based approach, providing feedback on agent performance and maintenance status. This helps users quickly identify trustworthy agents and improves overall platform transparency.

Type of change
[x] UI improvement

[x] New feature (Reliability Scoring Engine)

Checklist
[x] I ran npm run build locally and it passed ✅

[x] I tested my changes in the browser ✅

[x] I did not break any existing agents ✅

[x] I did not use import agents from '../agents/registry' ✅

[x] My PR has a clear description above ✅

Screenshots
Screenshot 2026-07-01 024311

closes #617

Summary by CodeRabbit

  • New Features
    • Added trust/reliability badges on agent cards, showing a score out of 100 with color-coded status.
    • Introduced reliability scoring so agents can display a clearer trust level in the interface.

@avanibapna06
avanibapna06 requested a review from AditthyaSS as a code owner June 30, 2026 21:20
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@avanibapna06 is attempting to deploy a commit to the aditthyass' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "issues"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e3fe525e-e9eb-49c8-a02b-b01236bd10ec

📥 Commits

Reviewing files that changed from the base of the PR and between 440dd52 and 5043e3a.

📒 Files selected for processing (1)
  • src/pages/HomePage.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/HomePage.jsx

Walkthrough

Adds a new agent reliability scorer and trust badge UI, then wires both into the HomePage agent grid so each rendered card shows a computed score and trust level.

Related issues: #617

Changes

Trust Badge Feature

Layer / File(s) Summary
Reliability scoring and badge component
src/lib/reliabilityScorer.js, src/components/TrustBadge.jsx
Adds calculateReliabilityScore(agent), which computes a deterministic or randomized score clamped to 0–100 and classifies it into Low/Medium/High badges, and TrustBadge, a component that renders the badge label and score with badge-specific styling.
HomePage agent grid integration
src/pages/HomePage.jsx
Imports the new scorer and badge component, and renders a top-right TrustBadge overlay on each AgentCard in the filtered agent grid, computing score/badge per agent and logging the agent to console during that computation.

Sequence Diagram(s)

sequenceDiagram
  participant HomePage
  participant calculateReliabilityScore
  participant TrustBadge
  HomePage->>calculateReliabilityScore: agent data
  calculateReliabilityScore-->>HomePage: score, badge
  HomePage->>TrustBadge: score, badge props
  TrustBadge-->>HomePage: rendered badge overlay
Loading

Estimated code review effort: 2 (Simple) | ~12 minutes

Suggested reviewers: AditthyaSS

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds a score and trust badge, but it omits the broader insights dashboard and supporting metrics requested in #617. Add the remaining trust insights UI and populate it from richer agent metadata such as activity, ratings, updates, and community signals.
Out of Scope Changes check ⚠️ Warning The HomePage console.log is a debug change unrelated to the requested reliability scoring UI. Remove the console.log or keep it behind a temporary development-only debug flag.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main addition: a reliability score feature.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

hey @avanibapna06! 👋
Your PR title doesn't follow our required format.
Please update it to:
type: short description
Valid types: feat, fix, docs, style, refactor, test, chore
Example: feat: add sales discovery agent
@AditthyaSS

@mergify

mergify Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

hey @avanibapna06! 👋
Your PR doesn't seem to be linked to an issue.
Please add this line to your PR description:
Closes #issue_number
Replace issue_number with the actual issue number you are solving.
This helps us track what each PR is fixing! 🔗
@AditthyaSS

@mergify mergify Bot added the needs-fix label Jun 30, 2026
@mergify

mergify Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

⚠️ This branch is out of date with main.
Please click "Update branch" to sync before merging.

@avanibapna06 avanibapna06 changed the title Feat/reliability score feat: add reliability score Jun 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/lib/reliabilityScorer.js (1)

4-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Non-English code comments.

Comments mix Hindi/Romanized text ("Agar agent object hi nahi mila", "taaki dashboard bhara hua lage") with English code. For a public OSS project, consistent English comments improve readability for all contributors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/reliabilityScorer.js` around lines 4 - 29, The comments in
reliabilityScorer’s scoring logic are mixed Hindi/Romanized and English, so
standardize them to clear English throughout the calculate/score path. Update
the inline comments around the agent guard, data extraction, scoring fallback,
and badge assignment in reliabilityScorer.js so they are consistent and readable
for all contributors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/TrustBadge.jsx`:
- Around line 5-11: The badge color mapping in getBadgeColor is light-theme
only, so add matching dark-mode Tailwind variants for each badge state to keep
TrustBadge consistent with the app’s dark UI. Update the returned class strings
for the High, Medium, and default cases in TrustBadge.jsx so they include
appropriate dark: background, text, and border colors similar to the patterns
used in AgentCard.jsx.

In `@src/lib/reliabilityScorer.js`:
- Around line 11-20: The fallback in reliabilityScorer’s scoring logic should
not generate a random “Trust Score” when usageCount and rating are missing,
because that fabricates reliability data. Update the scorer to return an
explicit neutral/unknown state (for example, “Unrated” or “Not enough data”)
from the reliabilityScorer.js logic instead of a random number, and make sure
any downstream label/formatting that currently assumes a numeric score handles
that state cleanly.

In `@src/pages/HomePage.jsx`:
- Line 522: Remove the debug console.log from HomePage’s agent card rendering
path; it is logging the full agent object on every render. Update the relevant
render logic in HomePage to eliminate the Agent Data Check statement so no debug
output ships in production.
- Around line 518-526: The inline IIFE inside the AgentCard render is
recomputing calculateReliabilityScore on every re-render, which causes the
TrustBadge to change unexpectedly for agents that fall back to random scoring.
Move the score calculation out of the JSX and memoize it once per agent, using
useMemo in HomePage keyed by the agent list (or by agent identity) or by storing
the computed score when agents are loaded. Then render TrustBadge from the
cached score/badge instead of recalculating inside the AgentCard block.

---

Nitpick comments:
In `@src/lib/reliabilityScorer.js`:
- Around line 4-29: The comments in reliabilityScorer’s scoring logic are mixed
Hindi/Romanized and English, so standardize them to clear English throughout the
calculate/score path. Update the inline comments around the agent guard, data
extraction, scoring fallback, and badge assignment in reliabilityScorer.js so
they are consistent and readable for all contributors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ca2090a-e1ed-4d6b-980e-95c736bd5566

📥 Commits

Reviewing files that changed from the base of the PR and between d9add56 and 440dd52.

📒 Files selected for processing (3)
  • src/components/TrustBadge.jsx
  • src/lib/reliabilityScorer.js
  • src/pages/HomePage.jsx

Comment on lines +5 to +11
const getBadgeColor = (badge) => {
switch (badge) {
case 'High': return 'bg-green-100 text-green-700 border-green-200';
case 'Medium': return 'bg-yellow-100 text-yellow-700 border-yellow-200';
default: return 'bg-red-100 text-red-700 border-red-200';
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Missing dark-mode color variants.

Colors (bg-green-100 text-green-700, etc.) are light-theme only. Per the PR screenshots, the app is dark-themed throughout (AgentCard.jsx consistently pairs classes with dark: variants, e.g. dark:bg-surface-input dark:text-text-muted). Without dark variants, the light pastel backgrounds will look out of place / have poor contrast against the dark card background.

♻️ Proposed fix
   const getBadgeColor = (badge) => {
     switch (badge) {
-      case 'High': return 'bg-green-100 text-green-700 border-green-200';
-      case 'Medium': return 'bg-yellow-100 text-yellow-700 border-yellow-200';
-      default: return 'bg-red-100 text-red-700 border-red-200';
+      case 'High': return 'bg-green-100 text-green-700 border-green-200 dark:bg-green-500/10 dark:text-green-400 dark:border-green-500/20';
+      case 'Medium': return 'bg-yellow-100 text-yellow-700 border-yellow-200 dark:bg-yellow-500/10 dark:text-yellow-400 dark:border-yellow-500/20';
+      default: return 'bg-red-100 text-red-700 border-red-200 dark:bg-red-500/10 dark:text-red-400 dark:border-red-500/20';
     }
   };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const getBadgeColor = (badge) => {
switch (badge) {
case 'High': return 'bg-green-100 text-green-700 border-green-200';
case 'Medium': return 'bg-yellow-100 text-yellow-700 border-yellow-200';
default: return 'bg-red-100 text-red-700 border-red-200';
}
};
const getBadgeColor = (badge) => {
switch (badge) {
case 'High': return 'bg-green-100 text-green-700 border-green-200 dark:bg-green-500/10 dark:text-green-400 dark:border-green-500/20';
case 'Medium': return 'bg-yellow-100 text-yellow-700 border-yellow-200 dark:bg-yellow-500/10 dark:text-yellow-400 dark:border-yellow-500/20';
default: return 'bg-red-100 text-red-700 border-red-200 dark:bg-red-500/10 dark:text-red-400 dark:border-red-500/20';
}
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/TrustBadge.jsx` around lines 5 - 11, The badge color mapping
in getBadgeColor is light-theme only, so add matching dark-mode Tailwind
variants for each badge state to keep TrustBadge consistent with the app’s dark
UI. Update the returned class strings for the High, Medium, and default cases in
TrustBadge.jsx so they include appropriate dark: background, text, and border
colors similar to the patterns used in AgentCard.jsx.

Comment on lines +11 to +20
// 3. Scoring Logic:
// Agar real data hai toh use karo, agar nahi hai toh random score do (UI testing ke liye)
let score = 0;

if (usage > 0 || rating > 0) {
score = (rating * 15) + (Math.min(usage, 500) / 10);
} else {
// Fallback: Random score between 40 and 95 taaki dashboard bhara hua lage
score = Math.floor(Math.random() * (95 - 40 + 1) + 40);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Random fallback fabricates a "Trust Score" — undermines the feature's purpose.

When usageCount and rating are both absent/zero, the function returns a random score between 40–95 instead of a neutral/unknown state. This is presented to users as a real reliability metric ("Low/Medium/High Trust • N/100"), but for agents without usage data it's pure noise that changes on every call. This actively misleads users — the opposite of what a "Trust Insights" feature should do — and conflicts with the PR's stated goal of "helping users identify trustworthy agents."

Consider returning an explicit "Unrated"/"Not enough data" state instead of a fabricated number.

♻️ Proposed fix
   let score = 0;
-  
   if (usage > 0 || rating > 0) {
     score = (rating * 15) + (Math.min(usage, 500) / 10);
   } else {
-    // Fallback: Random score between 40 and 95 taaki dashboard bhara hua lage
-    score = Math.floor(Math.random() * (95 - 40 + 1) + 40);
+    // No usage/rating data available; surface this explicitly rather than fabricating a score.
+    return { score: null, badge: 'Unrated' };
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// 3. Scoring Logic:
// Agar real data hai toh use karo, agar nahi hai toh random score do (UI testing ke liye)
let score = 0;
if (usage > 0 || rating > 0) {
score = (rating * 15) + (Math.min(usage, 500) / 10);
} else {
// Fallback: Random score between 40 and 95 taaki dashboard bhara hua lage
score = Math.floor(Math.random() * (95 - 40 + 1) + 40);
}
// 3. Scoring Logic:
// Agar real data hai toh use karo, agar nahi hai toh random score do (UI testing ke liye)
let score = 0;
if (usage > 0 || rating > 0) {
score = (rating * 15) + (Math.min(usage, 500) / 10);
} else {
// No usage/rating data available; surface this explicitly rather than fabricating a score.
return { score: null, badge: 'Unrated' };
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/reliabilityScorer.js` around lines 11 - 20, The fallback in
reliabilityScorer’s scoring logic should not generate a random “Trust Score”
when usageCount and rating are missing, because that fabricates reliability
data. Update the scorer to return an explicit neutral/unknown state (for
example, “Unrated” or “Not enough data”) from the reliabilityScorer.js logic
instead of a random number, and make sure any downstream label/formatting that
currently assumes a numeric score handles that state cleanly.

Comment thread src/pages/HomePage.jsx
Comment thread src/pages/HomePage.jsx
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
iloveagents Ready Ready Preview, Comment Jul 1, 2026 3:22pm

@mergify

mergify Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Hey @avanibapna06! This PR has a merge conflict that needs to be resolved before we can review or merge it.
Please sync your branch with the latest main and fix the conflicts.
Need help? Check out resolving merge conflicts.
@AditthyaSS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Agent Reliability Score & Trust Insights Dashboard

2 participants