Classic Duo Chat - Code Refactoring Output Truncated

Summary

GitLab Duo truncates refactoring output when working with large code files, cutting off mid-function without completing the refactored code or providing a summary message.

This issue is similar to #575987 (closed) but occurs specifically when using the /refactor command in GitLab Duo, rather than during code explanation/chat interactions.

Steps to Reproduce

  1. Open a large Python file in your (Web) IDE (see attached example.py)
  2. Highlight the entire code
  3. Type /refactor in the IDE GitLab Duo side panel
  4. Observe the truncated output

Expected Behavior

  • GitLab Duo should complete the full refactored code
  • A summary message should appear at the end recapping the changes made
  • All functions should be fully refactored and complete

Actual Behavior

  • Output is cut off mid-function (stops at function definition with no body)
    • No summary message is provided
  • Refactored code is incomplete and unusable

Additional Context

This truncation issue also occurs when:

  • Asking Duo to create large Python scripts (e.g., single functions ≥260 lines)
  • Working with highly complex code that would generate lengthy responses

This suggests a general output length restriction/limit in GitLab Duo's response handling.

Attachments

  • example.py - Original file used for reproduction
  • output.md - Truncated output received from GitLab Duo

Impact

All of our Duo Classic Chat users (regardless self managed, gitlab.com + regardless which version, because it seems again AI Gateway limit related) cannot effectively refactor large or complex code files using GitLab Duo, limiting its usefulness for real-world codebases.

Edited by Manuel Kraft