Duo Chat code block formatting breaks intermittently
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
When using Duo Chat prompts to generate code intermittently, the generated code block formatting breaks. This affects both Duo Chat in the GitLab Web UI and also in VSCode.
We have been able to reproduce this after running the same prompt a few times on all versions since GitLab 17.11.
It seems that the first time the prompt is used the response is always correctly formatted as shown in this example:
Now on repeating the same prompt (sometimes this does not happen until after a few repetitions) the output formatting is broken rendering the response very hard to use:
Steps to reproduce
This can be reproduced using the attached project
- open the attached C project in VSCode
- open the file
src/stuctures.cin the IDE - in Duo Chat execute the following prompt
Can you provide a comprehensive test stub function for all functions present in src/stuctures.c in the current project (including the complete function code) using the provided structure definitions, macros definitions, type definitions, file operation macros and constants present in student.h in the format of temp.c - watch the output where the test code is generated
- It may be necessary to repeat the same prompt a few times as for me the problem never showed on the first run
Example Project
What is the current bug behavior?
The code block output becomes garbled and is hard to work with.
What is the expected correct behavior?
The code block output should be correctly formatted
Relevant logs and/or screenshots
See above
Output of checks
Results of GitLab environment info
- Gitlab: This can be reproduced using GitLab.com (currently 18.6.0-pre 7aa1c604) but also against 17.11.x instances.
- VSCode:
Version: 1.105.0 - GitLab Workflow extension:
Version 6.49.9
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

