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

deleteSubAgent doesn't stick while a client is still connected

Abierto
#2,003 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@cjol ya está trabajando en esto.

Desde el 5/8/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Steps:

  1. A client opens a WebSocket to a sub-agent (a /sub/... path through the parent).
  2. The parent calls deleteSubAgent for that sub-agent. hasSubAgent now returns false.
  3. The client sends one more message, or just disconnects.
  4. hasSubAgent returns true again. The sub-agent is back, with fresh state.

Expected: the sub-agent stays deleted.

Cause: the parent routes every incoming WebSocket frame with _cf_resolveSubAgent, which creates the sub-agent when it doesn't exist. deleteSubAgent doesn't close open connections. So the old connection survives the delete, and its next message (or its close event) recreates the sub-agent it was pointing at.

Repro on main (a68736f), using the existing test agents:

const parent = await getAgentByName(env.TestSubAgentParent, parentName);
await parent.subAgentPing(childName);
const ws = await connectWS(
  `/agents/test-sub-agent-parent/${parentName}/sub/counter-sub-agent/${childName}`
);

await parent.subAgentDelete(childName);
expect(await parent.has("CounterSubAgent", childName)).toBe(false);

ws.send("straggler"); // or just ws.close()
await expect.poll(() => parent.has("CounterSubAgent", childName)).toBe(true);

Workaround: in _cf_forwardSubAgentWebSocketMessage and _cf_forwardSubAgentWebSocketClose, check hasSubAgent first and drop the frame when the sub-agent is gone.

Lenguaje dominante
TypeScript
Estrellas
5.6k
Forks
726
Merge medio
1 d 11 h
PR fusionados (30 d)
86

Preparar el entorno

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 cloudflare/agents

Todos los issues de cloudflare/agents

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.