Commit 0939c5b
Make WorkflowAgent hibernation-safe by eliminating fragile in-memory state
The DO uses WebSocket hibernation where all in-memory fields are lost on
sleep. Replace in-memory Maps and setTimeout with persistent mechanisms:
- executionIndex Map → connection state scan via getConnections()
- executionBuffer Map → DO transactional storage (this.ctx.storage)
- setTimeout debounce → Agent SDK schedule() system
- persistInFlight tracking → removed (callback is idempotent)
Also add frontend defense-in-depth: track active execution ID and
auto-re-subscribe after WebSocket reconnection.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 635e342 commit 0939c5b
2 files changed
Lines changed: 213 additions & 115 deletions
0 commit comments