[Bug]: Framework-written FAILED status drops status.timestamp, persisting last_updated as NULL
Los mantenedores suelen responder en 2 días
@rohityan ya está trabajando en esto.
Desde el 9/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
What happened?
When the framework itself writes a terminal FAILED state (consumer failure, producer failure), the resulting TaskStatus carries no timestamp. Because TaskManager.save_task_event replaces the status wholesale via task.status.CopyFrom(event.status) (src/a2a/server/tasks/task_manager.py:265), the previously stamped status.timestamp is cleared, and DatabaseTaskStore.save derives last_updated from status.timestamp (src/a2a/server/tasks/database_task_store.py:152-156) — persisting NULL.
Consequences:
ListTasksordering (which sorts onlast_updated) drops the task to the end;- the
status_timestamp_afterfilter never matches the task again; - API responses lose the
status.timestampfield entirely.
The behavior is also internally inconsistent: the cancel-failure path _mark_task_as_failed (src/a2a/server/agent_execution/active_task.py:945-963) copies the existing status and only overwrites state (preserving the timestamp), while the consumer failure path _write_failed_status (active_task.py:161-169) and the producer failure path construct a fresh TaskStatus(state=...) with no timestamp.
Reproduction
Self-contained script (main @ 494a8ec, Python 3.10)
import asyncio
from a2a.auth.user import UnauthenticatedUser
from a2a.helpers.proto_helpers import new_task_from_user_message
from a2a.server.agent_execution import AgentExecutor
from a2a.server.context import ServerCallContext
from a2a.server.events import EventQueue
from a2a.server.request_handlers import DefaultRequestHandlerV2
from a2a.server.tasks import InMemoryTaskStore
from a2a.types.a2a_pb2 import (
AgentCapabilities,
AgentCard,
Message,
Part,
Role,
SendMessageConfiguration,
SendMessageRequest,
TaskState,
)
class ExplodingExecutor(AgentExecutor):
task_id = None
async def execute(self, context, event_queue):
task = new_task_from_user_message(context.message)
self.task_id = task.id
await event_queue.enqueue_event(task)
raise RuntimeError('agent crashed mid-flight')
async def cancel(self, context, event_queue):
pass
async def main():
task_store = InMemoryTaskStore()
executor = ExplodingExecutor()
handler = DefaultRequestHandlerV2(
agent_executor=executor,
task_store=task_store,
agent_card=AgentCard(
name='t',
version='1.0',
capabilities=AgentCapabilities(streaming=True),
),
)
params = SendMessageRequest(
message=Message(
role=Role.ROLE_USER, message_id='m1', parts=[Part(text='Hi')]
),
configuration=SendMessageConfiguration(
accepted_output_modes=['text/plain']
),
)
try:
await handler.on_message_send(
params, ServerCallContext(user=UnauthenticatedUser())
)
except Exception as e:
print(f'on_message_send raised {type(e).__name__} (expected)')
task = await task_store.get(
executor.task_id, ServerCallContext(user=UnauthenticatedUser())
)
print(
f'persisted: state={TaskState.Name(task.status.state)}, '
f'timestamp set={task.status.HasField("timestamp")}'
)
asyncio.run(main())
Observed output:
on_message_send raised RuntimeError (expected)
persisted: state=TASK_STATE_FAILED, timestamp set=False
Expected behavior
Every task state transition the framework writes — including failures — should carry a status.timestamp, matching what TaskUpdater.update_status does for agent-driven transitions.
Suggested fix
Either:
- stamp the current time in the three framework failure paths (
_write_failed_status, the producer failure path, and — for consistency —_mark_task_as_failed), or - in
TaskManager.save_task_event, preserve the previousstatus.timestampwhen the incoming status event has none.
Happy to submit a PR with tests.
Related
Observed as a secondary effect in the reproduction of #1313.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lenguaje dominante
- Python
- Estrellas
- 2.2k
- Forks
- 509
- Merge medio
- 3 d 11 h
- PR fusionados (30 d)
- 43
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de a2aproject/a2a-python
-
[Bug]: REST task/request id sanitizationPosiblemente ocupada @Linux2010 la tomó hace 105 días. Abiertomaintainers-only
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
a2aproject/a2a-python#805 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[Bug]: Agent card signature verification raises raw binascii.Error on a malformed protected header instead of SignatureVerificationErrorPosiblemente ocupada @rohityan la tomó hace 2 días. Abierto
a2aproject/a2a-python#1332 · 2 asignados ·
Los mantenedores suelen responder en 2 días
-
[Bug]: message/send hangs forever when the AgentExecutor returns without producing eventsPosiblemente ocupada @rohityan la tomó hace 2 días. Abierto
a2aproject/a2a-python#1330 · 2 asignados ·
Los mantenedores suelen responder en 2 días
-
Whole numbers in a data Part are returned as floats (e.g. 4326 becomes 4326.0)Posiblemente ocupada @rohityan la tomó hace 2 días. Abierto
a2aproject/a2a-python#1328 · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
[Feat]: Cluster mode: detect and recover tasks abandoned by a crashed replica (heartbeat/lease)Posiblemente ocupada @ishymko la tomó hace 2 días. Abiertocomponent: server status: needs review
a2aproject/a2a-python#1324 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de a2aproject/a2a-python
Issues similares
-
Claiming namespace `jft63`Abiertonamespace operations
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
EclipseFdn/open-vsx.org#14043 ·
Los mantenedores suelen responder en 1 día
-
netbox status: needs triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
netbox-community/netbox#23376 ·
Los mantenedores suelen responder en 1 día
-
feedback simulation workshop
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
githubnext/gh-aw-workshop#4455 ·
Los mantenedores suelen responder en 1 día
-
Triage 🩺
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_waitAbiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
krkn-chaos/krkn#1627 · 1 comentario ·
Los mantenedores suelen responder en 1 día