Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Resumable event streams via event ids and cursors

Abierto
#552 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
php

Línea de trabajo

Empieza por src/Runtime/functions-sse-response.php y las rutas de streaming; después compara su comportamiento con src/Channels/register-agents-chat-run-control-abilities.php, que ya gestiona cursores. Lee docs/external-clients.md para consultar el contrato actual del cliente y añade o ejecuta pruebas para las reconexiones, los cursores no válidos, la compatibilidad sin cursor y el orden de los eventos. Se considera terminado cuando los adaptadores compatibles reanudan la conexión después de Last-Event-ID o de un cursor explícito, mientras que los adaptadores no compatibles rechazan explícitamente la reanudación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Problem

Streaming has no resume. The SSE helper writes data: frames only, so a browser EventSource has no event id to send back and reconnects with no position. On a dropped connection, a PHP timeout, a proxy cutting an idle stream, or a phone changing network, everything emitted meanwhile is lost to that client.

The data is already there. agents/list-chat-run-events takes a cursor and returns one with has_more. The stream just does not expose it, so clients have to choose between replaying a whole run and losing part of it. Long runs are where this hurts, and long runs are what run control was built for.

Evidence

  • src/Runtime/functions-sse-response.php — agents_api_emit_sse_json_frame() writes data: and flushes. No id: line.
  • src/Channels/register-agents-chat-run-control-abilities.php — the events ability already accepts cursor and limit and returns cursor and has_more.
  • docs/external-clients.md documents message/stream with no resume path.

Required contract

  • Emit an id: line on each SSE frame, using the same event id agents/list-chat-run-events returns, so stream position and page cursor are the same coordinate.
  • Accept Last-Event-ID on the streaming routes, plus an explicit cursor parameter for clients that are not EventSource, and resume after that point.
  • An unknown or expired cursor returns an explicit error. Never silently restart from the beginning of the run, which is how duplicates reach the user.
  • Keep resume optional for adapters that cannot replay. Those reject the resume request rather than serving a partial stream as if it were complete.

Tests

  • A reconnect with Last-Event-ID receives only events after that id.
  • An unknown or expired cursor returns an explicit error, not a full replay.
  • A connection with no cursor behaves exactly as today.
  • Event ids on the stream sort in the same order as the ids from agents/list-chat-run-events for the same run.
Lenguaje dominante
PHP
Estrellas
33
Forks
9
Merge medio
25 min
PR fusionados (30 d)
20

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Automattic/agents-api

Todos los issues de Automattic/agents-api

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.