Skip to content

Commit de96a07

Browse files
committed
Fix agent store metrics mapping
1 parent 35eb48b commit de96a07

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

web/src/app/store/store-client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ export default function AgentStoreClient({
234234
if (!initialAgents?.length) return []
235235

236236
return initialAgents.map((agent) => {
237-
// Key matches how metrics are stored: publisherId/agentName
238-
const metricsKey = `${agent.publisher.id}/${agent.name}`
237+
// Key matches how metrics are stored: publisherId/agentId
238+
const metricsKey = `${agent.publisher.id}/${agent.id}`
239239
const metrics = metricsMap?.[metricsKey]
240240

241241
return {

web/src/server/agents-transform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ export function buildAgentsBasicInfo(params: {
436436
}): AgentBasicInfo[] {
437437
const { agents } = params
438438

439-
// Dedupe to latest version per agent
439+
// Dedupe to latest version per agent (stable by publisher + agent id).
440440
const latestAgents = new Map<
441441
string,
442442
{ agent: AgentRowSlim; agentName: string }
443443
>()
444444
agents.forEach((agent) => {
445445
const agentName = agent.name || agent.id
446-
const key = `${agent.publisher.id}/${agentName}`
446+
const key = `${agent.publisher.id}/${agent.id}`
447447
if (!latestAgents.has(key)) {
448448
latestAgents.set(key, { agent, agentName })
449449
}
@@ -483,7 +483,7 @@ export function buildAgentsBasicInfo(params: {
483483
return result
484484
}
485485

486-
// Build metrics map from usage data - keyed by "publisherId/agentName"
486+
// Build metrics map from usage data - keyed by "publisherId/agentId"
487487
export function buildAgentsMetricsMap(params: {
488488
usageMetrics: UsageMetricRow[]
489489
weeklyMetrics: WeeklyMetricRow[]

0 commit comments

Comments
 (0)