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

WorkspaceProxy wakes Durable Objects via idFromString(), clearing ctx.id.name for Agents/Lifecycle

Đang mở
#243 1 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

@aron-cf đang làm issue này rồi.

Từ ngày 15/10/2026.

  • #244 của @aron-cf — đang mở

Đánh giá

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

Mô tả

bug
Describe the bug

When a Durable Object using cloudflare/agents (Lifecycle / Agent / OpenCodeHarness) is paired with @cloudflare/computer's ContainerBackend (or WorkerShellBackend), WorkspaceProxy.#hostStub() and WorkspaceServiceProxy.#hostStub() always resolve the host Durable Object via ns.get(ns.idFromString(id)).

Because a running container outlives Durable Object idle evictions, restarts, and Worker deployments, computerd reconnecting over WorkspaceProxy (/api) is frequently the first caller to wake the Durable Object from a cold start.

In Cloudflare Workers, instantiating a Durable Object via idFromString() does not populate ctx.id.name, so ctx.id.name remains undefined for the entire lifetime of that in-memory Durable Object instance (which stays pinned while the /api WebSocket is open). Any subsequent Lifecycle startup on that instance fails with:

Error: <Class> could not determine its Durable Object name. Address it with idFromName() or getByName().
Expected behavior

WorkspaceRef, WorkspaceProxyProps, and WorkspaceServiceProxyProps should accept an optional name?: string (e.g. this.ctx.id.name) so WorkspaceProxy and WorkspaceServiceProxy resolve the target Durable Object via ns.idFromName(name) (when ns.idFromName(name).toString() === id), preserving ctx.id.name across cold wakes triggered by container callbacks.

A tested patch with workerd unit tests in packages/computer/tests/proxy.test.ts is available at:
https://github.com/4nkitd/computer/commit/efb5ded

Steps to reproduce
  1. Create a Durable Object class using withWorkspaceContainer(Base), ContainerBackend, and Lifecycle.install(this) (from agents/lifecycle).
  2. Address the Durable Object via env.Agent.getByName("main") and start a container command so computerd connects back via WorkspaceProxy.
  3. Redeploy the Worker or let the Durable Object evict while the container remains running so computerd reconnects via WorkspaceProxy (ns.get(ns.idFromString(id))) before the next external getByName("main") request.
  4. Trigger lifecycle.start() on the woken Durable Object; ctx.id.name is undefined and Lifecycle throws could not determine its Durable Object name.
Environment
  • @cloudflare/computer: 0.5.1
  • agents: 0.28.1
  • wrangler: 4.151.0 (compatibility_date: 2026-10-15)
Ngôn ngữ chính
TypeScript
Star
9.6k
Fork
558
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
52

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/computer

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

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.