Repository navigation
refactor(chat): the auto-continuation turn runs and settles in the turn core - #2876
Open
mattzcarey wants to merge 5 commits into
Open
mattzcarey wants to merge 5 commits into
mattzcarey wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: a68db39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Contributor
🔴 agents import sizes: 1 entry point over threshold
Changed exports (9)
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
refactor/turn-core-continuation
branch
from
November 17, 2026 16:11
811cd7b to
13cc169
Compare
mattzcarey
changed the base branch from
refactor/chat-turn-core
to
refactor/turn-core-programmatic
November 17, 2026 16:11
mattzcarey
force-pushed
the
refactor/turn-core-continuation
branch
from
November 17, 2026 16:15
13cc169 to
b87bafb
Compare
mattzcarey
force-pushed
the
refactor/turn-core-continuation
branch
from
November 17, 2026 21:54
b87bafb to
7d5cf0e
Compare
mattzcarey
force-pushed
the
refactor/turn-core-continuation
branch
from
November 18, 2026 17:42
7d5cf0e to
133c082
Compare
…ontinuation's fire to its turn, and a tab draws a watched continuation as the message it is stored in
… check and failure report; drop the started flag
… appended without a turn does not drop it, and the answer check reads the reply it answers
mattzcarey
force-pushed
the
refactor/turn-core-continuation
branch
from
November 19, 2026 17:09
133c082 to
a68db39
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.
On top of #2870, the auto-continuation turn moves into the turn core.
ChatTurns.runContinuationTurnowns it from the moment a tool result fires it to the moment it settles, and both classes run it through the turn body #2870 gave every other turn (_runServerTurnReply,_runModelTurn).Think's connection-less continuation is the same turn with no pending continuation.AIChatAgentandThinkeach wrote this lifecycle and disagreed at the edges. Where they differed both now do this, and apps can observe it:AIChatAgentused to drop on astopfinish.onChatResponsefor a failed continuation runs after the turn left the queue, so it can callsaveMessages.AIChatAgentemitsmessage:errorfor it.chat:continuation:droppedevent with the reason (answered,moved_on,stopped).Thinkcontinuation gets context-overflow recovery, because it runs_runModelTurn.Thinkapproval of a paused execution: one that arrives after the conversation moved on is stored, starts no turn, and emitschat:continuation:droppedwithmoved_on. The next turn's model call reads it. An approval that leaves the execution paused starts no turn either.waitForIdleandwaitUntilStabledo not resolve between a continuation firing and its turn, whatever the host's enqueue awaits first.Thinktool continuation draws it as the message it is stored in. It used to draw the text twice. A continuation's chunk frames carrymessageIdfor this.Validation:
agentschat tests,ai-chatworkers and thethinksuite ran, withpnpm run check. Each behavior change has a test that failed before it.ChatTurnsTLA+ model was changed first and merged with the models of the PRs below, with a broken variant for each guard incontinuation-turn.ts. The merged models pass all their cases.Read
packages/agents/src/chat/continuation-turn.tsfirst, thenturn-failure.ts. The two_fireAutoContinuations are what is left in the hosts.