cjols lessons
Notes from learning the internals of the Cloudflare Agents SDK. In-progress and unedited.
Lessons
-
06
Browser inside codemode
Two code-mode sandboxes (browser and codemode) that never met, made one. The codemode runtime hook (#1566) supplies the per-execution lifecycle a reusable browser session (#1492) needs, so the cdp namespace joins state.* in a single code block (#1501).
-
05
isStreamingstuck on abort during an MCP tool callThe report blames a server-side MCP tool, but the server signals stream end correctly (proven by a reproduction). The stuck flag is client-side: the three-signal isStreaming derivation in react.tsx over-counts a frozen tool part after abort (#1614).
-
04
Workspace.rm range scan
Replacing the LIKE pattern in @cloudflare/shell's recursive rm with a prefix range scan, and the sibling-prefix nuance that makes the lower bound matter (#1539).
-
03
In-band stream error replay parity
Why a reconnecting client sees a stale terminal turn after an in-band model error, and the wire and storage shape needed to fix it (#1575, Part 1).
-
02
Startup recovery wedge
How #1595 wedged a class of Durable Objects permanently, and how #1604 fixed it by moving cross-DO recovery off the startup gate.
-
01
Chat stream lifecycle
How a chat turn moves through Think and AIChatAgent across the wire, the durable store, and programmatic surfaces. With diagrams.