bruno icon indicating copy to clipboard operation
bruno copied to clipboard

SSE events in preview are shown by newlines, making them unreadable.

Open sammaji opened this issue 4 months ago โ€ข 4 comments

Internal - [BRU-4097]

I have checked the following:

  • [x] I have searched existing issues and found nothing related to my issue.

This bug is:

  • [ ] Making Bruno unusable for me.
  • [x] Slowing me down but I'm able to continue working.
  • [x] Annoying.
  • [ ] This feature was working in a previous version but is broken in the current release.

Bruno version

4.0.0

๐Ÿ’ป Operating System

macOS

Specific OS Version / Distro

No response

๐Ÿž Describe the bug

Problem

When a request receives a text/event-stream (SSE) response, the live response viewer renders each payload by newline separation.

Here's how it looks for openai /v1/responses

Sample Request

 curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4.1",
    "input": "Hello",
    "stream": true
  }'

Response (as seen in curl):

event: response.created
data: {"type":"response.created","response":{"id":"resp_010b164d1e79f616006a632641a87c81958e0dc085416168e1","object":"response","created_at":1784882753,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0}

event: response.in_progress
data: {"type":"response.in_progress","response":{"id":"resp_010b164d1e79f616006a632641a87c81958e0dc085416168e1","object":"response","created_at":1784882753,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1}

event: response.output_item.added
data: {"type":"response.output_item.added","item":{"id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2}

event: response.content_part.added
data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"Hello","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"tTRgNzqqtzM","output_index":0,"sequence_number":4}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"!","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"LRGfLyD0EGDa9rr","output_index":0,"sequence_number":5}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" How","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"TEhvusAtc0HE","output_index":0,"sequence_number":6}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" can","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"tVNGZegcE2k9","output_index":0,"sequence_number":7}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" I","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"ItxiSYRPeZ9e0Q","output_index":0,"sequence_number":8}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" help","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"4eqRBaY53OH","output_index":0,"sequence_number":9}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" you","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"VCkQIsrDSvue","output_index":0,"sequence_number":10}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" today","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"erGHs4msOj","output_index":0,"sequence_number":11}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"?","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"iX8zm92xJyMzaas","output_index":0,"sequence_number":12}

event: response.output_text.done
data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"output_index":0,"sequence_number":13,"text":"Hello! How can I help you today?"}

event: response.content_part.done
data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"Hello! How can I help you today?"},"sequence_number":14}

event: response.output_item.done
data: {"type":"response.output_item.done","item":{"id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"Hello! How can I help you today?"}],"role":"assistant"},"output_index":0,"sequence_number":15}

event: response.completed
data: {"type":"response.completed","response":{"id":"resp_010b164d1e79f616006a632641a87c81958e0dc085416168e1","object":"response","created_at":1784882753,"status":"completed","background":false,"completed_at":1784882754,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"Hello! How can I help you today?"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":8,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":10,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":16}

Response (as seen in postman):

Each event is shown correctly.

Image Image

Response (as seen in bruno):

Image Image

Root cause

In packages/bruno-electron/src/ipc/network/index.js, the SSE stream handler parses and forwards every raw stream.on('data', chunk) read straight to the renderer as an independent message:

stream.on('data', (newData) => {
  response.sseChunks?.push(newData);
  seq += 1;
  const parsed = parseDataFromResponse({ data: newData, headers: {} });
  mainWindow.webContents.send('main:http-stream-new-data', { ...., data: parsed });
});

A data: chunk boundary from the network (TCP/HTTP2 read) is not the same as an SSE event boundary (a blank line, \n\n). There is no buffering of partial lines/events across chunks, so a JSON payload that spans more than one network read gets split at an arbitrary byte offset and each fragment is parsed/rendered independently, producing the corrupted output seen above. This also means legitimate SSE-multi-byte (UTF-8) characters can be split across chunks.

๐Ÿ“ Steps to reproduce

Any api that returns standard SSE events will work. Here's how it looks for openai /v1/responses

Sample Request

 curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4.1",
    "input": "Hello",
    "stream": true
  }'

Response (as seen in curl):

event: response.created
data: {"type":"response.created","response":{"id":"resp_010b164d1e79f616006a632641a87c81958e0dc085416168e1","object":"response","created_at":1784882753,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0}

event: response.in_progress
data: {"type":"response.in_progress","response":{"id":"resp_010b164d1e79f616006a632641a87c81958e0dc085416168e1","object":"response","created_at":1784882753,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1}

event: response.output_item.added
data: {"type":"response.output_item.added","item":{"id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2}

event: response.content_part.added
data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"Hello","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"tTRgNzqqtzM","output_index":0,"sequence_number":4}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"!","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"LRGfLyD0EGDa9rr","output_index":0,"sequence_number":5}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" How","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"TEhvusAtc0HE","output_index":0,"sequence_number":6}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" can","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"tVNGZegcE2k9","output_index":0,"sequence_number":7}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" I","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"ItxiSYRPeZ9e0Q","output_index":0,"sequence_number":8}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" help","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"4eqRBaY53OH","output_index":0,"sequence_number":9}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" you","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"VCkQIsrDSvue","output_index":0,"sequence_number":10}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":" today","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"erGHs4msOj","output_index":0,"sequence_number":11}

event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"?","item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"obfuscation":"iX8zm92xJyMzaas","output_index":0,"sequence_number":12}

event: response.output_text.done
data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","logprobs":[],"output_index":0,"sequence_number":13,"text":"Hello! How can I help you today?"}

event: response.content_part.done
data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"Hello! How can I help you today?"},"sequence_number":14}

event: response.output_item.done
data: {"type":"response.output_item.done","item":{"id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"Hello! How can I help you today?"}],"role":"assistant"},"output_index":0,"sequence_number":15}

event: response.completed
data: {"type":"response.completed","response":{"id":"resp_010b164d1e79f616006a632641a87c81958e0dc085416168e1","object":"response","created_at":1784882753,"status":"completed","background":false,"completed_at":1784882754,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_010b164d1e79f616006a6326422ef881958cfe52eff315efe8","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"Hello! How can I help you today?"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":8,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":10,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":16}

Response (as seen in postman):

Each event is shown correctly.

Image Image

Response (as seen in bruno):

Image Image

๐Ÿ“ Collection to reproduce

No response

๐Ÿ“ท Screenshots/Live demo link

Image Image

sammaji avatar Jul 24 '26 08:07 sammaji

๐Ÿ”— Related PRs

usebruno/bruno#8136 - fix(generate-code)!: generate code URL issues [merged] usebruno/bruno#8741 - feat(timeline-headers): show headers info in timeline [closed] usebruno/bruno#8763 - fix: broken sse event rendering in ui [open] usebruno/bruno#8766 - fix(timeline): headers info in response timeline [open] usebruno/bruno#8802 - Adding support for GraphQL Subscriptions [open]


๐Ÿ“ Issue Planner

Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

  • [ ] Create Plan

๐Ÿงช Issue enrichment is currently in open beta.

You can configure auto-planning by selecting labels in the issue_enrichment configuration.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

๐Ÿ’ฌ Have feedback or questions? Drop into our discord!

coderabbitai[bot] avatar Jul 24 '26 09:07 coderabbitai[bot]

Hi @sammaji, thanks for reporting this, and apologies for the delay in getting back to you.

We've shared this with our engineering team for further investigation, and they'll take a closer look at the behaviour. We'll keep you updated as we have more information.

Rohan-Bruno avatar Aug 03 '26 07:08 Rohan-Bruno

@sid-bruno / @Rohan-Bruno any updates on this?

sammaji avatar Oct 24 '26 06:10 sammaji

Hi @sammaji, we're tracking this internally and discussing it with a larger team. I'll share an update here once we decide how to move forward. Thanks!

aditya-bruno avatar Nov 16 '26 10:11 aditya-bruno