Repository navigation
feat(agents): resume dropped /run streams in createAI - #2589
Merged
mattzcarey merged 2 commits intoOct 14, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: c3216f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🟡 agents import sizes: 1 entry point grew
Changed exports (1)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
mattzcarey
force-pushed
the
feat/createai-stream-resume
branch
from
October 14, 2026 13:16
62baf27 to
5d11058
Compare
mattzcarey
added this pull request to stack #2590
October 14, 2026 13:30
mattzcarey
force-pushed
the
feat/createai-stream-resume
branch
from
October 14, 2026 13:31
5d11058 to
7a7340a
Compare
mattzcarey
force-pushed
the
feat/createai-stream-resume
branch
from
October 14, 2026 13:45
7a7340a to
600a620
Compare
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
mattzcarey
force-pushed
the
feat/createai-stream-resume
branch
from
October 14, 2026 14:31
600a620 to
1cc5c84
Compare
mattzcarey
force-pushed
the
feat/createai-stream-resume
branch
from
October 14, 2026 15:18
1cc5c84 to
c3216f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
createAI(agents/models/ai-sdkandagents/models/pi-ai) now resumes a streamed answer from AI Gateway's/runwhen the connection drops mid-stream. It reconnects through the binding and replays from the last complete event, so the consumer's stream keeps going with nothing lost or repeated. Stacked on #2576.A streamed
/runanswer names its run incf-aig-run-id, and the Run Durable Object keeps the run's events. The binding replays them from an event index, through a routeaig-entryserves for it:run()wraps a streamed/runbody that carries a run id. Every caller gets resume with nothing to configure: AI SDK catalog models and dynamic routes, pi-ai catalog models, andagents/models/opencode, which wraps the AI SDK provider. Workers AI streams and provider-native requests have no run id and are returned as they are.core/resume.tspasses on only complete SSE events and holds back a trailing partial one.fromcounts complete events, so after a drop the replay starts on the boundary: nothing duplicated, nothing cut.CloudflareAIErrorafter five drops, or on a404once the gateway no longer holds the run. An abort or a cancel never reconnects, and an abort reaches the consumer as the error it is.Checked live on the
agentsaccount'sdefaultgateway. To get a real drop, a test Worker wrapped the realAIbinding and cut the first/runstream partway through an event, as a dropped connection would.createAIthen resumed against the real gateway buffer. Each answer came back complete: one to forty in order, nothing repeated or missing.anthropic/claude-haiku-4.5openai/gpt-5-minianthropic/claude-haiku-4.5dynamic/<route>(served byopenai/gpt-5-mini)dynamic/<route>The resume route also returns
404 {"error":"Request not found"}for an unknown run.pnpm run checkand the model tests pass.