Repository navigation
fix(ui): keep following a chat turn when its stream breaks - #3198
Open
garlicKim21 wants to merge 1 commit into
Open
garlicKim21 wants to merge 1 commit into
garlicKim21 wants to merge 1 commit into
Conversation
A proxy between the browser and the controller can close a stream that has
been quiet for a while, for example while a model reads a long prompt. The
task keeps running on the server and completes, but the UI reported the turn
as failed ("network error").
Once the stream has named its task, a transport failure (Unknown or
Unavailable) now re-attaches to that task with SubscribeToTask instead of
failing the turn. SubscribeToTask is read-only and returns the stored task
when it has already finished, so the message is never sent twice. Errors
the controller decided, a broken stream before any task is known, and a
user abort still end the turn as before. Re-attaching gives up after three
consecutive failures with no frame in between.
Signed-off-by: Golden Garlic <148346166+garlicKim21@users.noreply.github.com>
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.
Summary
Fixes #3197
When the chat stream (
A2AService/SendStreamingMessageover gRPC-Web) breaks while the task is still running, the UI reports the turn as failed ("The agent could not finish this turn / network error"), even though the task keeps running on the server and completes, with its result in the task history.This is easy to hit behind a proxy that closes quiet streams. A model reading a long prompt sends nothing for a minute or more, and an idle timeout somewhere on the path (an ingress, a reverse proxy, a CDN) ends the response. In our case the controller logged both streams as
Canceledafter exactly 60,015 ms. Both tasks finished one to two minutes after the cut, by which time the UI had already shown the error banner.This change keeps following the task instead of failing the turn:
statusUpdatecarriestaskId), a transport failure re-attaches withSubscribeToTask. The gateway already implements it (go/core/internal/a2agateway/interactions.go). It is read-only and returns the stored task when the task has already finished, so the user's message is never sent twice.Unknown(a barenetwork error, or a body that ends without its trailer) andUnavailable(HTTP 502/503/504). Errors the controller decided, a broken stream before any task id is known, a task that has already reached a terminal or input-required state, and a user abort behave as before.The change is confined to
A2AGrpcChatClient.send; the event handling for each frame is unchanged, so atasksnapshot returned by the subscription goes through the existingtaskbranch.Testing
ui/src/api/chat/a2aGrpcChatClient.test.ts:FailedPrecondition) still surfaces and does not re-attachyarn typecheck: passes.yarn lint: 0 errors; the same 6 existing warnings as onmain.yarn test: 59 files, 598 tests pass.node:24.13.0(ui/.nvmrc) with Corepack andyarn install --immutable, as in theui-testsCI job. Browser (Playwright) tests were not run locally.