Skip to content

fix: persist agent run ratings and surface aggregate on agent cards - #769

Open
Quantumboy80 wants to merge 4 commits into
AditthyaSS:mainfrom
Quantumboy80:fix/persist-agent-ratings
Open

fix: persist agent run ratings and surface aggregate on agent cards#769
Quantumboy80 wants to merge 4 commits into
AditthyaSS:mainfrom
Quantumboy80:fix/persist-agent-ratings

Conversation

@Quantumboy80

@Quantumboy80 Quantumboy80 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

RunRating (the 👍/👎 prompt shown after every agent run) collected feedback but never persisted it — the vote lived in local component state only and vanished the moment the component unmounted. Both call sites rendered with no props at all, so there was also no way to associate a rating with a specific agent even if it had been saved.

This PR wires it up properly:

Adds src/lib/useAgentRatings.js, a localStorage-backed hook mirroring the existing useFavorites.js pattern (same cross-component sync approach). Stores { [agentId]: { up, down } } under ila_ratings.
RunRating now accepts an agentId prop and calls rateAgent() on click instead of discarding the vote.
AgentRunner.jsx and WorkflowRunner.jsx now pass the relevant agentId through to RunRating.
AgentCard.jsx shows a 👍 XX% badge next to the provider badge, only once an agent has received at least one rating.

No new dependencies, no backend — fully consistent with the existing client-side/localStorage architecture already used for favorites and history.

Note: unrelated to the marketplace listing star-ratings (marketplace.js) that recently landed — that rates published listings; this rates individual run outputs, regardless of whether the agent is published.

Closes #675

Type of change

  • New agent
  • Bug fix
  • UI improvement
  • Documentation
  • Other

Checklist

  • I ran npm run build locally and it passed ✅
  • I tested my changes in the browser ✅
  • I did not break any existing agents ✅
  • I did not use import agents from '../agents/registry'
  • My PR has a clear description above ✅

Screenshots (if UI change)

Screenshot 2026-07-09 152050 Screenshot 2026-07-09 152157 Screenshot 2026-07-09 152232 Screenshot 2026-07-09 160045

Rating badge on AgentCard (bottom-right, next to provider badge), only shown once an agent has ≥1 rating:

👍 100% — small pill, same style/sizing as the existing provider badge, light/dark theme aware.

Summary by CodeRabbit

  • New Features

    • Added visible positive-rating summaries to agent cards (including a thumbs-up indicator with percentage and details when available).
    • Ratings in runner views are now linked to the relevant agent context.
    • Ratings are persisted locally so they remain available across sessions.
  • Bug Fixes

    • Ensured rating submissions are consistently recorded and immediately reflected across the related UI.

@Quantumboy80
Quantumboy80 requested a review from AditthyaSS as a code owner July 9, 2026 10:32
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

@Quantumboy80 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 Jul 9, 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: 0149de7a-a930-4016-b246-245ffc26ee4c

📥 Commits

Reviewing files that changed from the base of the PR and between 5f66a60 and 38b69a2.

📒 Files selected for processing (1)
  • src/lib/useAgentRatings.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/useAgentRatings.js

Walkthrough

Adds a useAgentRatings hook that persists per-agent thumbs-up/down counts in localStorage with cross-component synchronization. RunRating receives an agentId, runner flows pass agent identifiers, and AgentCard displays aggregate ratings when available.

Changes

Agent ratings persistence and display

Layer / File(s) Summary
Ratings persistence and synchronization
src/lib/useAgentRatings.js
Loads and saves per-agent ratings in localStorage, synchronizes hook instances through listeners, and exposes rating and aggregation functions.
Rating submission wiring
src/components/RunRating.jsx, src/components/AgentRunner.jsx, src/pages/WorkflowRunner.jsx
RunRating persists ratings for its agentId; both runner call sites pass the relevant agent identifier.
Rating display on cards
src/components/AgentCard.jsx
Computes aggregate ratings and conditionally renders a percentage badge with a total-count tooltip beside the provider badge.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RunRating
  participant useAgentRatings
  participant localStorage
  participant AgentCard

  User->>RunRating: click thumbs up/down
  RunRating->>useAgentRatings: rateAgent(agentId, value)
  useAgentRatings->>localStorage: save updated counts
  useAgentRatings-->>AgentCard: synchronized rating state
  AgentCard->>User: display percentage badge
Loading

Possibly related PRs

Suggested labels: level:intermediate

Suggested reviewers: AditthyaSS

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: persisted agent ratings and an aggregate badge on agent cards.
Linked Issues check ✅ Passed The changes satisfy #675 by persisting per-agent ratings, wiring agent IDs through both flows, and surfacing an aggregate rating on AgentCard.
Out of Scope Changes check ✅ Passed The modified files stay focused on the rating persistence and display work with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hey @Quantumboy80! 👋
Wow — your first contribution to iloveAgents! This is a big deal and I want you to know it means a lot. 🎊
Every agent on this platform started exactly like this — someone like you deciding to spend their time building something useful for everyone. That is something to be proud of.
A few things while you wait for the review:

  • Star the repo if you haven't already. Star it here
  • 📖 Check the Contributing Guide
  • 💬 Drop a comment if you get stuck — I reply within 24 hours
    Can't wait to ship this with you. 🚀
    Welcome to the iloveAgents family. 🙏
    @AditthyaSS

@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: 1

🤖 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/lib/useAgentRatings.js`:
- Around line 15-17: The saveRatings helper currently writes directly to
localStorage via setItem, which can throw and break the rating flow. Update
saveRatings to catch write failures around the localStorage.setItem call and
handle them safely, keeping the rest of the useAgentRatings behavior intact.
🪄 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: 1ee61056-8f34-4fc7-b9e2-9b6369440aab

📥 Commits

Reviewing files that changed from the base of the PR and between 5edfa3a and 5f66a60.

📒 Files selected for processing (5)
  • src/components/AgentCard.jsx
  • src/components/AgentRunner.jsx
  • src/components/RunRating.jsx
  • src/lib/useAgentRatings.js
  • src/pages/WorkflowRunner.jsx

Comment thread src/lib/useAgentRatings.js

@mergify mergify Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ Build is failing on this PR.
Please fix before merging:

  1. Run npm run build locally
  2. Fix any errors shown
  3. Push your fix — the check will re-run automatically
    Most common issue: broken registry import.
    Replace:
    import agents from '../agents/registry'
    With:
    import { useAgents } from '../lib/useAgents'
    const { agents } = useAgents()
    See CONTRIBUTING.md for help. 🙏

@mergify

mergify Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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

@vercel

vercel Bot commented Jul 10, 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 10, 2026 3:56pm

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 10, 2026
@mergify

mergify Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

⚠️ Hey @Quantumboy80! 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

…bit review feedback — setItem can throw in private browsing or when storage quota is exceeded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Agent run ratings (👍/👎) are collected but never saved or used anywhere

2 participants