Skip to content

fix: recover Server.name from storage on alarm wake#331

Open
jcheese1 wants to merge 1 commit intocloudflare:mainfrom
jcheese1:recover_name_from_alarm_wake
Open

fix: recover Server.name from storage on alarm wake#331
jcheese1 wants to merge 1 commit intocloudflare:mainfrom
jcheese1:recover_name_from_alarm_wake

Conversation

@jcheese1
Copy link

@jcheese1 jcheese1 commented Feb 18, 2026

Summary

  • Persist Server.name to DO storage in setName(), recover it at the top of alarm() when #_name is unset
  • Fixes crash when this.name is read inside onAlarm() or schedule callbacks after a cold wake (alarm is the only entry point that never called setName())
  • Real-world impact: Agent.runWorkflow() reads this.name to inject __agentName — crashes when triggered by this.schedule()

Test plan

  • New AlarmNameServer test DO with seed endpoint that writes name to storage without calling setName(), simulating cold wake
  • Test asserts nameWasCold: true (proving storage recovery path was exercised, not a warm instance no-op)
  • Test asserts this.name returns correct value inside onAlarm()
  • All 33 existing tests pass

@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2026

⚠️ No Changeset found

Latest commit: 56e4099

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

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

Comments