a2aproject / a2aproject/a2a-inspector

Task responses with status.message not displayed in UI

Abierto
#137 0 comentarios 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
490
Forks
152
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

# GitHub Issue for A2A Inspector

**Repository:** https://github.com/a2aproject/a2a-inspector
**Title:** Task responses with status.message not displayed in UI

---

## Description

The A2A Inspector UI displays "Task created with status: completed" instead of showing the actual agent response message when a task includes `status.message.parts[0].text`.

## Steps to Reproduce

1. Configure the inspector to connect to an A2A agent server
2. Send a message to the agent
3. Receive a task response with this structure:
```json
{
"jsonrpc": "2.0",
"id": "msg-1",
"result": {
"kind": "task",
"id": "task-123",
"contextId": "ctx-456",
"status": {
"state": "completed",
"message": {
"kind": "message",
"role": "agent",
"parts": [
{
"kind": "text",
"text": "Hello, how can I help you today?"
}
]
}
},
"history": [...]
}
}
```

## Expected Behavior

The UI should display:
```
task Hello, how can I help you today? ✅
```

## Actual Behavior

The UI displays:
```
task Task created with status: completed ✅
```

The actual message text is not shown.

## Technical Details

**Root Cause:** `frontend/src/script.ts` lines 1058-1068

The task event handler only displays `event.status.state` and ignores `event.status.message.parts[0].text`:

```typescript
} else if (event.status) {
// Only show task status if there are no artifacts
const statusHtml = `${event.kind} Task created with status: ${DOMPurify.sanitize(event.status.state)}`;
appendMessage('agent progress', statusHtml, displayMessageId, true, validationErrors);
}
```

## Inconsistency

The `status-update` event handler (lines 1071-1087) **correctly** extracts and displays the message:

```typescript
case 'status-update': {
const statusText = event.status?.message?.parts?.[0]?.text; // ✅ Correct
if (statusText) {
const renderedContent = DOMPurify.sanitize(marked.parse(statusText) as string);
const messageHtml = `${event.kind} Server responded with: ${renderedContent}`;
appendMessage('agent progress', messageHtml, ...);
}
}
```

The same logic should be applied to task events.

## Suggested Fix

Update the task event handler to check for and display `status.message.parts[0].text`:

```typescript
} else if (event.status) {
// Check if there's a message in the status
const statusText = event.status?.message?.parts?.[0]?.text;
if (statusText) {
// Display the actual message content
const renderedContent = DOMPurify.sanitize(
marked.parse(statusText) as string,
);
const messageHtml = `${event.kind} ${renderedContent}`;
appendMessage(
'agent',
messageHtml,
displayMessageId,
true,
validationErrors,
);
} else {
// Fallback: show task status if there's no message
const statusHtml = `${event.kind} Task created with status: ${DOMPurify.sanitize(event.status.state)}`;
appendMessage(
'agent progress',
statusHtml,
displayMessageId,
true,
validationErrors,
);
}
}
```

This mirrors the existing logic in the `status-update` handler and provides a fallback to the current behavior when no message is present.

## Impact

**Severity:** Medium
**Affected:** All A2A agents that return completed tasks with message content (standard A2A pattern)

## Current Workaround

Users can verify the response is actually present in the JSON by:
1. Checking browser DevTools Network tab
2. Using curl or other HTTP clients to see the raw JSON response
3. Using the backend logs (if available)

## Environment

- **Inspector Version:** Latest (as of 2026-01-16)
- **Browser:** Tested on multiple browsers
- **Test Server:** Custom A2A server implementing standard protocol

## Additional Context

The backend (`backend/app.py`) correctly passes through the full response including `status.message`, so no backend changes are needed. This is purely a frontend UI rendering issue.

The A2A protocol specification supports including messages in task status, and this is a common pattern for synchronous agent responses.

## Related Files

- `frontend/src/script.ts` (lines 1030-1121) - Event handlers
- `frontend/src/script.ts` (lines 23-48) - AgentResponseEvent interface

---

## Test Case for Verification

After the fix, test with this JSON-RPC request/response:

**Request:**
```json
{
"jsonrpc": "2.0",
"id": "test-1",
"method": "message/send",
"params": {
"contextId": "test-context",
"message": {
"messageId": "msg-1",
"role": "user",
"parts": [{"type": "text", "text": "Hello"}]
}
}
}
```

**Response:**
```json
{
"jsonrpc": "2.0",
"id": "test-1",
"result": {
"kind": "task",
"id": "task-123",
"status": {
"state": "completed",
"message": {
"kind": "message",
"parts": [{"kind": "text", "text": "Hi! How can I help?"}]
}
}
}
}
```

**Expected UI Display:**
```
task Hi! How can I help? ✅
```

---

Thank you for maintaining this excellent tool! Let me know if you need any additional information or testing assistance.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.