agent_crew icon indicating copy to clipboard operation
agent_crew copied to clipboard

Show inter-agent conversation events in the Activity feed

Open sre-helmcode opened this issue 9 months ago • 2 comments

Summary

The Activity feed in the Team Monitor page currently does not display messages or events exchanged between agents. We need to surface these inter-agent conversation events so users can observe how agents are collaborating in real time.

Background

The TeamMonitorPage.tsx renders an activity feed powered by the WebSocket endpoint /ws/teams/:id/activity. Agent-to-agent messages flow through NATS in the backend, but these events are not currently forwarded to the WebSocket stream and therefore are not visible in the UI.

Acceptance Criteria

  • [ ] Inter-agent messages (agent → agent) appear in the Activity feed in real time
  • [ ] Each event clearly identifies the sender agent and the recipient agent
  • [ ] Events are visually distinct from user messages and agent-to-user responses (use a different color/badge)
  • [ ] The backend WebSocket handler (handlers_ws.go) emits agent-to-agent events through the activity stream
  • [ ] The frontend correctly renders the new event type with an appropriate label (e.g., "Agent A → Agent B")
  • [ ] Existing activity events are not broken or regressed

Files to Modify

Backend:

  • internal/api/handlers_ws.go — forward inter-agent NATS messages to the WS activity stream
  • internal/nats/bridge.go — hook into inter-agent message flow
  • internal/protocol/messages.go — add/extend message type if needed

Frontend:

  • src/pages/TeamMonitorPage.tsx — render the new event type in the activity feed
  • src/types/index.ts — add/extend event type definition

Design Notes

The activity feed already handles multiple event types with color coding. The new agent_message (or similar) type should follow the same visual pattern but with a distinct accent color to differentiate peer-to-peer agent communication from user messages and direct agent responses.

sre-helmcode avatar Feb 21 '26 12:02 sre-helmcode

Sigue sin funcionar, en el panel de actividad no sale la conversación que tienen entre agentes:

[user_message]
user → leader
13:19:17
Hola amigo!
[task_result]
lead-team → leader
13:19:22
{
  "status": "completed",
  "result": "Hola! En qué puedo ayudarte hoy?"
}
[user_message]
user → leader
13:20:46
Quiero hacer cambios en el proyecto del frontend, el titulo de la web debería poner "Tenerife, Canarias"
[task_result]
lead-team → leader
13:21:27
{
  "status": "completed",
  "result": "Listo! El título de la web ha sido actualizado en `/workspace/frontend/index.html`:\n\n- **Antes:** `frontend`\n- **Después:** `Tenerife, Canarias`\n\nEste título es el que aparece en la pestaña del navegador. Si necesitas algún otro cambio en el frontend, dímelo."
}

Puedes testear usando el team "Devs" pidiendole un cambio en la aplicación de frontend o backend o en ambos sitios. Lo que debería pasar es que el Lead detecta los cambios y delega las tareas a esos agentes especializados, estos implementan los cambios y devuelven la respuesta al Lead para que el Lead responda al usuario por la UI del Chat. Pero toda esa interacción yo debería de poder verla por el panel de activity y no la veo. Solo veo la conversación entre el Lead y el user.

sre-helmcode avatar Feb 21 '26 13:02 sre-helmcode

Validated with automated tests.

Root cause: Two problems — (1) publishTaskResult was passing the NATS subject (team.X.leader) as the to field instead of the agent name (leader), so Message.To in the DB showed subjects instead of names. (2) The Activity feed had no dedicated endpoint to separate chat from inter-agent events.

Fixes applied (commit f60e0f6 frontend + 968fbf9 backend):

  • Backend: publishTaskResult corrected to use agent names; new GET /teams/:id/activity endpoint
  • Frontend: Dual-panel UI (Chat + Activity); isInterAgentMessage() detection; purple badge styling for inter-agent messages; activityApi consuming the new endpoint

Test evidence:

Backend (go test -v -race ./... — all 105 tests passing):

  • TestPublishTaskResult_SetsAgentNameNotSubject ✅
  • TestPublishTaskResult_SubjectBuiltFromAgentName ✅
  • TestGetActivity_AllInterAgentTypes ✅
  • TestGetActivity_PreservesAgentNames ✅
  • TestGetActivity_IsolationBetweenTeams ✅

Frontend (npm test — 195/195 tests passing):

  • src/services/api.test.ts — activityApi tests ✅
  • src/pages/TeamMonitorPage.test.tsx — 35 tests including inter-agent rendering and purple badge ✅

sre-helmcode avatar Feb 21 '26 13:02 sre-helmcode