Skip to content

docs(agents): document current ctx.id.name availability and pin it with a cold-wake test#1928

Open
mattzcarey wants to merge 2 commits into
mainfrom
chore/do-name-current-runtime
Open

docs(agents): document current ctx.id.name availability and pin it with a cold-wake test#1928
mattzcarey wants to merge 2 commits into
mainfrom
chore/do-name-current-runtime

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Since 2026-03-15, the Workers runtime populates ctx.id.name inside a Durable Object addressed via idFromName()/getByName(), including in alarm handlers (constructor-time availability is pinned by workerd's own tests, workerd#6421). Our docs still described names as effectively unavailable inside the DO (citing workerd#2240, which was closed in April).

Changes

  • docs/agents/agent-class.md: replaces the stale "it's hard / not a perfect solution" caveat on this.name with the actual availability matrix: populated for idFromName()/getByName(); still undefinedper the DO id docs — for idFromString()/newUniqueId() addressing (deliberate design), names over 1,024 bytes, and alarms scheduled before 2026-03-15 or from a nameless context.
  • docs/shell/index.md: corrects the lazy-name-resolution rationale (the name may not be resolvable at field-init time, rather than never being available).
  • packages/agents/src/tests/name-resolution.test.ts (new): pins the new runtime behavior — a cold agent whose first-ever contact is a native RPC call resolves this.name purely from ctx.id.name, with no __ps_name seeding and no setName() bootstrap, for both idFromName() and getByName() addressing. The existing cold-wake tests in mcp/transports/rpc.test.ts that seed __ps_name are deliberately untouched; note that since they address via idFromName(), their seeds are inert under the current runtime — the legacy fallback paths are pinned upstream in partyserver's own test suite.

Deliberately not in this PR

Testing

  • pnpm run check green (exports, format, lint, all 116 TS projects).
  • New test file passes locally: 2/2 under the workers pool (miniflare 4.20260625.0).

@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 29f43e9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1928

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1928

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1928

create-think

npm i https://pkg.pr.new/create-think@1928

hono-agents

npm i https://pkg.pr.new/hono-agents@1928

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1928

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1928

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1928

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1928

commit: 29f43e9

Constructor-time availability is pinned by workerd's and partyserver's own
tests, not stated by the changelog; the rpc.test.ts cold-wake seeds are inert
under the current runtime (those tests address via idFromName()), so the
legacy-fallback pins live upstream in partyserver's suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant