8000 fix: preserve SSE events across chunk boundaries by Linxiushen · Pull Request #555 · google/adk-web · GitHub
[go: up one dir, main page]

Skip to content

fix: preserve SSE events across chunk boundaries - #555

Open
Linxiushen wants to merge 1 commit into
google:mainfrom
Linxiushen:fix/sse-chunk-boundaries-113
Open

Linxiushen wants to merge 1 commit into
google:mainfrom
Linxiushen:fix/sse-chunk-boundaries-113

Conversation

@Linxiushen
Copy link
Copy Markdown

Fixes #113.

When a fetch chunk contains a complete SSE event followed by only part of the next event, runSse replays the first event on the next read. A chunk boundary inside the data: prefix can also drop an event entirely. Following the line-buffering approach suggested in #113, keep only the unfinished line between reads and process each complete data line once. A malformed, newline-terminated JSON payload now reaches the existing observable error handler instead of being treated as an unfinished chunk.

Regression coverage includes batched complete/partial events, a split data: prefix, single-byte UTF-8/CRLF chunks, and invalid complete JSON with loading-state cleanup.

Validation:

  • The first three regressions fail on the unchanged source (17 existing tests pass).
  • npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI --include=src/app/core/services/agent.service.spec.ts: 21 passed.
  • npm run build: passed.
  • The full headless test command exited 0 and reported 678 successful tests, 37 skipped, against an initial total of 865. The count discrepancy is not resolved, so this is not a claim that all 865 tests ran.

Tests ran on Windows with headless Chromium; no manual browser testing is claimed.

Developed with AI assistance (Codex).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

output messed up when cdns buffering the response data

1 participant

0