WorkspaceProxy wakes Durable Objects via idFromString(), clearing ctx.id.name for Agents/Lifecycle
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
- Create a Durable Object class using
withWorkspaceContainer(Base),ContainerBackend, andLifecycle.install(this)(fromagents/lifecycle). - Address the Durable Object via
env.Agent.getByName("main")and start a container command socomputerdconnects back viaWorkspaceProxy. - Redeploy the Worker or let the Durable Object evict while the container remains running so
computerdreconnects viaWorkspaceProxy(ns.get(ns.idFromString(id))) before the next externalgetByName("main")request. - Trigger
lifecycle.start()on the woken Durable Object;ctx.id.nameisundefinedandLifecyclethrowscould not determine its Durable Object name.
Environment
@cloudflare/computer:0.5.1agents:0.28.1wrangler:4.151.0(compatibility_date: 2026-10-15)
Thanks for the bug report, will get this fixed.