Repository navigation
feat(chat): outcome on terminal frames and useAgentChat onTurnEnd - #2378
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: e7970f9 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 |
Contributor
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
…dedupe Co-authored-by: Cursor <cursoragent@cursor.com>
Merged
tombeckenham
added a commit
to tombeckenham/agents-tom
that referenced
this pull request
Oct 7, 2026
Brings react-agui.tsx level with the legacy hook in agents/chat/react, which received these through the upstream merge: - cloudflare#2344 the server snapshot heals a diverged observed assistant - cloudflare#2348 an observer skips replayed continuation frames it already applied - cloudflare#2361 onToolCall fires only after the stream ends - cloudflare#2378 onTurnEnd fires once per ended request - cloudflare#2383 turns settle across replay, resume and observers (held and recovering requests, the resume:false idle probe) - cloudflare#2496 streaming protection is released when the socket closes - cloudflare#2394 follow the socket when the agent name changes - cloudflare#2403 the tool-result cleanup no longer dispatches per chunk - cloudflare#2039 keep an optimistic send the reconnect transcript omits The last three had no failing test: their upstream tests are ported into react-tests (the address-change one against a fake of useAgent's pending socket, since this package has no test worker) and failed before the fix. restoreBufferedSends, MAX_REMEMBERED_ENDED_TURNS and isSocketAddressPending are exported from agents/chat/react so the two hooks share them.
tombeckenham
added a commit
to tombeckenham/agents-tom
that referenced
this pull request
Oct 7, 2026
…ge ids and per-event seq Ports the server half of upstream cloudflare#2334, cloudflare#2365, cloudflare#2378, cloudflare#2383 and cloudflare#2348 into AGUIChatAgent. An in-band RUN_ERROR now marks its stream errored when the body ends (a settled stream cannot be re-marked, which had broken cloudflare#1575's errored replay) and rides an error frame the client transport still delivers as an event.
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.
Follow-up to #2365 for #2280. Apps no longer need to read raw WebSocket frames to settle optimistic sends.
Wire: terminal
cf_agent_use_chat_responseframes carryoutcome:completed,error,aborted,skipped, orrecovering. Before this, a skipped or cancelled request looked the same as a completed one. Whenoutcomeis absent (older servers), clients treat the turn aserrorif this frame or an earlier one haderror, and ascompletedotherwise.React:
useAgentChat({ onTurnEnd })fires once per ended request with{ requestId, messageIds, outcome, error, replay }. This covers this tab, other connections, and replays. It is deduped per request and never fires forrecovering, because the successor request reports the samemessageIds.ChatTurnEndEventandChatTurnOutcomeare exported fromagents/chat/react,@cloudflare/ai-chat/react, and@cloudflare/think/react.Docs: new "Settle sends when a turn ends" section. "Correlate terminal frames with sent messages" is updated for
outcome.Tests cover the outcome at each server site in ai-chat and Think, plus a hook test with completed, error, skipped, recovering, successor, duplicate replay, and replayed error.
Made with Cursor