Repository navigation
Chat: the chat module's host contract and turn definition (4.iii, slice 6, draft) - #3289
Merged
Merged
Conversation
|
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Contributor
|
✅ agents import sizes: no significant changes ( |
mattzcarey
force-pushed
the
slim/chat-fn-6
branch
from
November 26, 2026 16:15
5475689 to
509a0bd
Compare
mattzcarey
force-pushed
the
slim/chat-fn-6
branch
from
November 26, 2026 17:11
e769352 to
c5dd398
Compare
mattzcarey
marked this pull request as ready for review
November 26, 2026 17:20
mattzcarey
force-pushed
the
slim/chat-fn-6
branch
from
November 26, 2026 23:07
1d16b90 to
0d4e1ff
Compare
…t, ChatModelCall with step, ChatHooks)
…rn end to end (respond, stream, store), tested on a minimal DO
…e was cut off in; cut-off tools are settled
…pped in one transaction (cutover)
…d context overflow in the turn definition
…n-band error is not stored; a stopped turn keeps what it streamed
…or plain text, continuation base, overflow history, pinned question, persist:false, cut parts settled)
…ew branch under its question
… discards on, skip discarded chunks, a clear via Tasks keeps nothing, a recovered regenerate stays on its branch, settle a client tool cut mid-input, flag a continuation's first frame)
mattzcarey
force-pushed
the
slim/chat-fn-6
branch
from
November 26, 2026 23:52
a4ab736 to
27d8a51
Compare
…an approved tool cut off by a reset is reported interrupted (rv-6 on #3295)
…, and a call awaiting approval or a tool's progress output correctly; an approved client tool cut off by a reset still waits for its result (Devin)
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.
4.iii slice 6 (arch ruling "4.iii slices"): the chat module's host contract and its one turn definition, internal in
agents/chat. Per arch it merges with its first caller (harness's H2, #3295, or the AIChatAgent move); 6a (ChatDepsbuilt once per host) lands with that caller.chat-host.tshas the RFC's contract as agreed with harness:ChatDeps(webSocketsoptional),ChatHost { respond, hooks, options },ChatModelCallwithstep(name, fn)(the run'sstep.do),ChatHookswithrepairInterruptedToolPart(part, { recovery }),ChatTurnInputandChatTurnResult. ThenchatTurnDefinition(deps, host, { name }), a framework task handler a host registers withtasks.register("__cf…", …)on its own lanes. A run:respond(a UI chunk stream, an AI SDK result, or aResponse: an event stream or plain text);transformChunk) to the run's stream and to the tabs, giving the reply an id when the model sent none;repairInterruptedToolPart(a client tool call stays waiting), and callsrespondwithmode: "continue".options.recoverycaps attempts andonRecoverymay stop it or drop the partial;TaskSettlement.retryafter a backoff, stream left open; a transient in-band error isn't stored); on an overflow, callsonContextOverflowand asks once more with the shortened transcript;aborted; a chat clear keeps nothing.22 tests on a minimal Durable Object (Tasks, Streams, Sessions) cover these. Not yet here: settling the stream of a run cancelled while it waits out its retry backoff (6f, with the lane's cancel path).
Cost: no hot path changes (nothing calls it in production yet).