gemini-cli - 💡(How to fix) Fix Bug: /executeCommand SSE stream omits blank-line event delimiters

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

The handler emits \n instead of \n\n. The existing streaming test did not catch this because it used a Mocha-style done callback, which Vitest 3 does not honor, so the test returned before its asynchronous assertions ran.

Fix Action

Fix / Workaround

A spec-compliant SSE/EventSource client requires a blank line (\n\n) to dispatch an event. Without that blank line, consecutive data: lines are folded into one record and the final event is never properly terminated, so clients cannot parse individual streaming updates.

Code Example

res.write(`data: ${JSON.stringify(jsonRpcResponse)}\n`);

---

data: {...}\n\n
RAW_BUFFERClick to expand / collapse

What happened?

The A2A server streaming /executeCommand endpoint writes Server-Sent Events with a single trailing newline:

res.write(`data: ${JSON.stringify(jsonRpcResponse)}\n`);

A spec-compliant SSE/EventSource client requires a blank line (\n\n) to dispatch an event. Without that blank line, consecutive data: lines are folded into one record and the final event is never properly terminated, so clients cannot parse individual streaming updates.

What did you expect to happen?

Each JSON-RPC response emitted by the streaming endpoint should be a separate SSE event, delimited by a blank line:

data: {...}\n\n

Root cause

The handler emits \n instead of \n\n. The existing streaming test did not catch this because it used a Mocha-style done callback, which Vitest 3 does not honor, so the test returned before its asynchronous assertions ran.

Proposed fix

Append the missing blank line to each event and convert the streaming test to async/await so it genuinely validates emitted events.

Related PR: #27549

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix Bug: /executeCommand SSE stream omits blank-line event delimiters