Duo Chat: Code Block Formatting Breaks When Markdown Block Truncated

Background

When a Duo Chat response containing a code block (like a Python script) gets cut off before the closing ``` markers, the code block appears broken in the UI.

Current Behavior

  • Code formatting breaks when truncated
  • Syntax highlighting disappears

image

Reproducing

You can reproduce it with this prompt

I'm testing the chat
can you reply with a python function in markdown
start with ```python
but do not include the ending ```
as I am simulating the response getting truncated  

Expected Behavior

  • Code blocks should maintain proper formatting even when truncated
  • Syntax highlighting should be preserved for the visible portion of the code

Acceptance Criteria

  1. Code blocks maintain proper formatting when truncated
  2. Syntax highlighting remains intact
Edited by 🤖 GitLab Bot 🤖