Patch Changes
-
#1332
7cb8acfThanks @threepointone! - ExposecreatedAton fiber and chat recovery contexts so apps can suppress continuations for stale, interrupted turns.FiberRecoveryContext(fromagents) gainscreatedAt: number— epoch milliseconds whenrunFiberstarted, read from thecf_agents_runsrow that was already tracked internally.ChatRecoveryContext(from@cloudflare/ai-chatand@cloudflare/think) gains the samecreatedAtfield, threaded through from the underlying fiber.
With this, the stale-recovery guard pattern described in #1324 is a short override:
override async onChatRecovery(ctx: ChatRecoveryContext): Promise<ChatRecoveryOptions> { if (Date.now() - ctx.createdAt > 2 * 60 * 1000) return { continue: false }; return {}; }
No behavior change for existing callers. See
docs/chat-agents.md(new "Guarding against stale recoveries" section) for the full recipe, including a loop-protection pattern usingonChatResponse.