Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#243 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@aron-cf arbeitet bereits daran.

Seit 15.10.2026.

  • #244 von @aron-cf — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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)
Vorherrschende Sprache
TypeScript
Sterne
9.6k
Forks
558
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
52

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus cloudflare/computer

Alle Issues in cloudflare/computer

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.