Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

deleteSubAgent doesn't stick while a client is still connected

Đang mở
#2,003 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@cjol đang làm issue này rồi.

Từ ngày 5/8/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
5.6k
Fork
726
Merge trung bình
23 giờ 36 phút
Pull request đã merge (30 ngày)
86

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cloudflare/agents

Tất cả issue của cloudflare/agents

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.