Skip to content

Facets started via ctx.exports lack ctx.id.name, which breaks Cloudflare Agents sub-agents #237

Description

@dleviminzi

On Celld 0.6.0, a Durable Object facet created from a class in ctx.exports with an ID from idFromName() starts correctly. Inside the facet, however, ctx.id.name is undefined.

The Cloudflare Agents SDK 0.24 requires this name, so subAgent() and agentTool() in Agents and @cloudflare/think fail on Celld. The same code works on workerd.

Versions

  • Celld: v0.6.0, two nodes, fleet durability, S3-compatible bucket (SeaweedFS)
  • agents: 0.24.0
  • @cloudflare/think: 0.19.0
  • Works on: workerd via Wrangler local dev

Reproduction

A parent Durable Object (an Agents Agent or Think agent) starts a child facet the way subAgent() does. The child class comes from this.ctx.exports.<ChildClass>, and the ID comes from idFromName("<child-name>").

// Parent DO. Adjust to the exact facets call Agents 0.24 makes.
const facet = this.ctx.facets.get("child", () => ({
  class: this.ctx.exports.Child,
  id: this.ctx.exports.Child.idFromName("child"), // or the namespace's idFromName
}));

await facet.fetch("https://facet/ping");

In the child facet:

export class Child extends DurableObject {
  fetch() {
    return new Response(String(this.ctx.id.name));
  }
}

The child is exported from the Worker entry point, but has no binding or migration of its own, as with Agents sub-agents.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions