Repository navigation
Conversation
… pending reconnects send() and listConversations() reject once the client is closed, rather than leaving their promises pending. follow() and close() clear a reconnect scheduled after a dropped socket, so it can no longer replace the followed socket or reconnect a closed client.
Resubscribe to every unended response after a reconnect, not only those of running turns, and report snapshot turns to activity listeners so a turn restarted under a new response while offline is followed.
🦋 Changeset detectedLatest commit: 456af28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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: |
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.
This PR fixes four follow-ups from the Channels stack: two Web client reconnect gaps, an AI SDK transport stream that never finishes, and a TUI stranded by an expired Cloudflare Access token. Stacked on #2479.
Why
WebChannelClientdropped any response whose turn was no longer running. A response can keep streaming after its turn settles, so listeners such as the AI SDK transport lost its remaining chunks and its end.responseIdwhile offline was invisible to the transport, which kept waiting on the old response.answer()returned left the stream open.agents tuifetched the Access token from feat(channels): agents tui logs in to Cloudflare Access by itself #2462 once at startup. Once it expired, every reconnect sent the stale token. AWebSocketconstructor is synchronous, so a fresh token must be read synchronously at upgrade time: the TUI now runscloudflared access token(non-interactive, readingcloudflared's cache) for each reconnect. Refreshing in the background on close was the alternative, but it races the 1 s reconnect timer.Public API Surface
WebChannelClient.onActivityturnactivitysendHeadersOnUpgradeaccessHeadersCode Changes
web/client.ts:#resumeresubscribes to every unended response from where it left off, and hides the ones whose turn moved on rather than deleting them. The snapshot handler updates state first, then emits its turns, so listeners read the new transcript.web/ai-sdk.ts:answer()callssettle()once it finishes sending.web/tui/access.ts: the returned function uses the startup token for the first upgrade and askscloudflaredagain for later ones, keeping the last token if that fails. It never opens a browser login after startup; if the Access session itself expired, the upgrade is rejected and restarting the TUI logs in again.web/tui/socket.ts,main.ts,app.ts: pass the header function through to the patchedWebSocket.