Repository navigation
Agent tools: R3-identity (draft): a child's run is its chat turn's run - #3346
mattzcarey wants to merge 38 commits into
Conversation
|
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
|
✅ agents import sizes: no significant changes ( |
… chatDispatch over ChatDeps
…treaming turn and its stream
…ut messages, cancel-continuation, one continuation per batch, the leaf read first)
…swer starts no turn, and is dropped once its socket closed (rv-1)
… a tool answer's continuation extends the reply that holds the call (Devin on #3298)
… live answer's continuation names its reply, once per batch; a stopped waiting request keeps its question; injected answers pass the chunk hook (Devin)
…a client tool call does not hold the stall watchdog off (rv-6, rv-5)
… request to continue is kept for its batch (rv-1)
… chunk keeps the capability's chunk limit; a held stopped question survives a reset; continue requests are cleared at a turn's end (rv-1, Devin)
…arked on its run, and stores its question when reached (replaces the held list); a stop drops remembered continue requests; a denial answers a call (rv-1, Devin)
…drops only the stopped turn's continue request; a stopped queued turn settles aborted (rv-1)
…a reset while a server tool runs keeps the call (verify F18)
…ed; progress outputs are not flushed one by one (Devin)
… as the hosts' reply streams do, so a short reply cut off is kept (rv-1, harness-think)
…le it is quiet keeps what it sent (harness-think's eviction tests)
…bmitTurn and chatDispatch
… replaced request is told it was skipped; tests for drop, merge, debounce and a regenerate under drop (rv-3)
…ssages as submitTurn
…t, an empty reply answered again, stored or pinned body, a signal) (rv-6)
…ff settles its stream
…d (ChatDeps.kv, the recent-terminals record; arch ruling)
…module (ChatDeps.kv)
…all carries the run's checkpoint, cancelTurn takes a reason (agent-runs' R3 needs)
…ent; ChatDeps.webSockets needs only getConnections
…inition and routes chat frames through chatDispatch (34 ai-chat test files fail; next: connect, public methods, the seam, deletions)
18937c2 to
1ecafc6
Compare
…he chat's lane and transcript; the test worker's queue and idle reads follow
…he tab that sent it, at once on a stop; queued message ids come from the waiting runs
…nt-tool child rows (expected to fail until R3-identity)
… chunks, progress, cancel)
… run's metadata; tests on the chat-turn fixture
d9d0dfd to
f7bc622
Compare
6ae1fda to
0342490
Compare
|
Closed while too much is in flight; not next (it waits on the seam in #3361). The branch slim/agent-runs-r3 stays and the PR reopens when S1 lands. |
Draft of R3-identity, the last R step (CLOSEOUT 1b): the parts that do not depend on limits' 6f switch. Do not merge; it grows into R3-identity once the switch lands.
R3-identity makes a child's agent-tool run its chat turn's run on the new core (
chatTurnDefinition, run id = request id, one stream per run across attempts) and deletes the child's own run store. What this draft has now:cf_agent_tool_child_runs,cf_agent_tool_milestones, think 0.24's exact DDL) and AIChatAgent (cf_ai_chat_agent_tool_runs,cf_ai_chat_agent_tool_milestones, ai-chat 0.12.3's): a completed run with output and a milestone, an error, an abort. After the carry-forward each inspects as it did, and the released tables are gone. On main the inspections already match and the tables stay, so the test isit.fails(it fails today for exactly that); R3-identity turns it intoit. The open-row case (a turn being recovered at the upgrade) belongs with the switch's upgrade step and is added then.What R3-identity will delete (line counts on main 751cad2):
packages/agents/src/chat/agent-tool-run-store.ts(500) and its four tables, released rows carried forward;chat/agent-tool-runs.ts(1,179):AgentToolRunsHost(44),rebind(12),isRecoveredRunCancelled(4),admitRecoveredTurn(18),reconcileStale(42),#recoveryOfand the chat-recovery incident read (44),reconcileOwn(10),isStale(3), plus the store calls throughout; what stays is inspect, chunks, tail, progress and the frame observer as functions;AgentToolBroadcastHookstype inchat/agent-tools.ts(37; the observer stays, taking its maps as arguments);createAgentToolRunStore, therebindandadmitRecoveredTurncalls,reconcileAgentToolChildRuns).packages/agents/src/index.ts: 4,101 lines on main; R3-identity does not add to it, and its target at the end of R is at or below 4,100.Tests here: the two upgrade tests, which pass as expected failures. No changeset.