Repository navigation
H2: ThinkHarness's runs are the chat module's turn definition - #3295
Conversation
|
| Name | Type |
|---|---|
| agents | Minor |
| @cloudflare/agent-think | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
5475689 to
509a0bd
Compare
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
f6da71a to
ee725ae
Compare
🔴 agents import sizes: 2 entry points over threshold
Changed exports (172)
…and 122 more exports in the workflow artifact. 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 |
ee725ae to
3c737b6
Compare
e769352 to
c5dd398
Compare
968e1eb to
b6e23dd
Compare
1d16b90 to
0d4e1ff
Compare
1760665 to
2989b09
Compare
a4ab736 to
27d8a51
Compare
0bc4cd1 to
3d39b88
Compare
…an approved tool cut off by a reset is reported interrupted (rv-6 on #3295)
195ec06 to
c550fd9
Compare
…ce 6, draft) (#3289) * WIP 4.iii slice 6: the chat module's host contract (ChatDeps, ChatHost, ChatModelCall with step, ChatHooks) * WIP 4.iii slice 6: chatTurnDefinition(deps, host, { name }) runs a turn end to end (respond, stream, store), tested on a minimal DO * WIP 4.iii slice 6: a later attempt continues the reply the earlier one was cut off in; cut-off tools are settled * WIP 4.iii slice 6: the reply is stored and its stream settled and dropped in one transaction (cutover) * WIP 4.iii slice 6: a tool-answer turn continues the reply that asked for the tool * WIP 4.iii slice 6: recovery budget, onRecovery, the stall watchdog and context overflow in the turn definition * WIP 4.iii slice 6: the turn definition sends every chunk and the end to the tabs * WIP 4.iii slice 6: respond may return a Response (event stream or plain text) * Chat: a replay after the cutover does not answer again; a transient in-band error is not stored; a stopped turn keeps what it streamed * Chat: review fixes in the turn definition (stop on clean close, ids for plain text, continuation base, overflow history, pinned question, persist:false, cut parts settled) * Chat: a turn's input may name its session; a regenerated reply is a new branch under its question * Test: the regenerate branch test does not depend on the fixture's reply id * Chat: Devin fixes on the turn definition (keep a tool answer recovery 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) * Chat: the stall watchdog times only the model, not a tool that runs; an approved tool cut off by a reset is reported interrupted (rv-6 on #3295) * Chat: the stall watchdog counts an approved continued call as running, 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)
…he harness's model-and-tools loop as its respond
…llel results stream at once, the stall watchdog watches the model only, an overflow after progress continues, a failed call keeps what it streamed, a failed regeneration stays on its branch, onRecovery gets the partial; the facet upgrade test takes the released path)
… tool result survives a sibling failing the turn, a tool's hooks see its step's attempt; the changeset names the rerun mark)
…or a tool safe to rerun; the rerun test checks both hooks' attempt
c550fd9 to
7fd8a21
Compare
ThinkHarness's runs are now the chat module's turn definition (
chatTurnDefinitionfrom #3289), registered under both of the harness's definitions and run on its per-session lanes. The first attempt places the operation and records the placement in the run's checkpoint, in the same transaction as the transcript write. Every attempt then calls the definition, and itsrespondis the harness's model-and-tools loop. That loop is one model call per step, with the context prepared andbeforeTurnrun each time. Every server tool runs as a durable step of the run, and approvals are requested in the stream. The definition owns the turn's stream, the store-and-cutover, recovery of an interrupted attempt (continue mode, the budget,onRecovery), the stall watchdog and the context-overflow retry. So the harness's own versions of these are deleted:#steps,#callModel,#recoverModel,#interrupted,#abandon, the per-call stream ids and the segment packing, and thebackoffMsoption. Slice (a)'sthinkResponderis deleted too; its singlestreamTextloop couldn't run the per-step hooks. The shipped read-only tools (the workspace's read, ls, grep and find,fetch_url, and the skills' activate and read-resource tools) are markedrecovery: "rerun". ThinkChat keeps its own protocol dispatch for now: the chat functions in #3298 start runs under the request id with aChatTurnInput, and the harness's runs carry its own input and ids.This is H2 of THINK-HARNESS.md: one implementation of a chat turn, with the harness as its first caller (#3289 merges together with this PR). Think's queued-submission behaviour is kept, per the overnight Q2 ruling: a queued turn's question enters the transcript when its turn starts, and a cancelled queued submission never appears. A server tool cut off by a reset is reported to the model as interrupted unless the tool is marked
recovery: "rerun". That now includes a call whose input had streamed but which hadn't started. Open runs from the release (the harness store's operations, carried into runs with aturncheckpoint) are placed from that progress: what their model call had streamed is kept, the tool calls they had started are reported as interrupted, and the reply is continued.Validated with the harness-think suite (132 of 132, with the released-row and default-table stream tests unchanged) a new upgrade test (a released version's running turn, carried forward and continued in a sub-agent) and a test of the shipped tools' recovery marks. The Think compat scoreboard matches the base at 290 passing. The one loss was a tool output with its own
toJSON, fixed by journaling tool results as JSON. Cost per prompt at ab48c9c (statements / rows written, harness-think meter): hello 87/25, a one-tool turn 103/31, two tools 113/35. Against main's harness: hello 71/20, and 33 and 37 rows written for the tool turns. Against the release's Think turn (PERF-BUDGETthink/turn-short, 87/30 on perf's workerd meter, a different probe): at or below. The text-turn increase over main comes from the definition writing each chunk to the stream as it arrives (the harness used to pack ten into one segment) and from its reply checkpoint. Batching those writes belongs in the definition and is asked of limits. The release's ThinkHarness (the harness-store version) has no perf scenario; perf is asked to add one. #3298'ssubmitTurnreads each message a tab sends (getMessageper message) to keep only new or changed ones; this PR doesn't callsubmitTurn(ThinkHarness places a turn's messages itself, and ThinkChat keeps its own dispatch until H2c), so it adds no such read. The harness's own placement already reads onegetMessageper message a client sends, to refuse rewriting a stored id, as on main. H2c, the first caller ofsubmitTurnthrough ThinkChat, will state that cost against today's per-request cost.