Repository navigation
switch: the turn definition applies the released chatRecovery budget; AIChatAgent's classifier and stall timeout (recovery side of #3361) - #3415
Conversation
|
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
🟡 agents import sizes: 2 entry points grew
Changed exports (2)
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 |
…Recovery budget (the released evaluator over an incident kept with the run); terminalMessage and onExhausted on give-up
…sed evaluator over an incident kept with the run; terminalMessage and onExhausted when it is spent; AIChatAgent passes its whole config
…all timeout: a provider's transient failure and a stalled stream are retried inside the turn's run
…de the turn, which completes (8 tests rewritten to that outcome)
…un again inside the turn; a declined recovery ends in error with one model call (incident-record assertions removed)
…: a declined recovery ends with that failure, recovery attempts that keep failing are bounded by maxAttempts, and the provider's retry-after sets the wait; AIChatAgent's config is read when a turn runs
…leted, skipped, failed); persist: false and two failures in a row complete inside the turn
c67c56d to
21a0a82
Compare
…etried inside the turn, and a turn that stalls on every attempt ends in error at its budget
For the 6f switch (#3361), onto
slim/chat-fn-6s1. The recovery side: the turn definition applies the host's releasedchatRecoverybudget, and AIChatAgent gives it what it needs to recover a provider's transient failure. Work in progress; more commits follow, one behaviour at a time.What is here
chat-host.ts(the definition's recovery block only). A turn found cut off is judged by the released budget, through the released pure evaluator (evaluateChatRecoveryIncident), with what it counted kept in one checkpoint of the run (chat:incident) and progress measured as the chunks the turn has streamed:shouldKeepRecovering;onRecoverygets the incident's attempt number (1 on the first recovery, as released);terminalMessageas its error, andonExhaustedis told the reason.ChatOptions.recoverytakes the released config object (plusstallTimeoutMs). The default of three attempts by run attempt is gone. Think's released default is the same ten, and the harness's own suite passes (142).ai-chat/src/index.ts(_chatHost()only). It passes the wholechatRecoveryobject, its error classifier (the expression the old engine used) and its stall timeout. Without the classifier every transient provider failure mid-stream ended the turn as an error with no retry.Tests
chat-turn-definition.test.ts(61 pass): "gives up on a cut-off turn past its attempt budget, with the app's message and reason" (rewritten), "continues a turn cut off for the fourth time: the budget is ten attempts without progress", "starts the attempt count again when the cut-off attempt streamed more".durable-chat-recovery.test.ts: the provider-error tests and the dropped-connection test now expect what the core does: the failure is retried inside the turn's run and the turn completes with the kept text followed by the retry's. Their assertions on incident records are removed (the record is the old engine's).Behaviour change to state at the switch
A transient provider failure or a stalled stream is retried inside the same run.
saveMessagesand the like returncompletedwith the reply, where they returnedabortedand a recovery finished the reply later. This is the decided design for the shared definition; it needs a changeset line and a migration note on the switch.Still to do on this branch
The rest of
durable-chat-recovery.test.ts(26 in "platform-transient reader errors"): the provider's retry-after wait, the transient retry budget,persist: false, stops during a retry's wait, a question sent during it. Then the context fields (recoveryData,lastBody,lastClientTools), a turn cut off before its stream opened, and thecontinue: falseending.