Commit a7ac9e8
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 a7ac9e8
3 files changed
Lines changed: 210 additions & 116 deletions
File tree
- apps
- api/src
- durable-objects
- runtime
- app/src/services
0 commit comments