Skip to content

GPT-5 model inserts thousands of empty lines when editing files #209

@vuyelwadr

Description

@vuyelwadr

Describe the bug

When using GPT-5 model, file edits frequently result in thousands of empty lines being added to the file. The changes show massive line additions (e.g., +99991 lines) where 99%+ of these lines are literally just empty lines with no content.

The behavior is:

  1. Request GPT-5 to edit a file
  2. The model makes the requested changes
  3. BUG: The file is padded with thousands of empty lines
  4. Git shows massive additions (e.g., +99991) that are almost entirely empty lines
  5. The actual code changes are correct, but buried in empty whitespace

Note: This issue does NOT occur with GPT-4 models (gpt-4o, gpt-4-turbo). It appears to be specific to GPT-5 model behavior.

Affected version

Version: 0.0.334
Commit: 26896a6

Steps to reproduce the behavior

  1. Start Copilot CLI with copilot
  2. Ensure you're using GPT-5 model
  3. Request any file edit, for example:
    • update README.md to add installation instructions
    • edit CONTRIBUTING.md to clarify the PR process
    • modify docs/api.md to document the new endpoint
  4. Observe the file changes in git
  5. Observe: The diff shows massive additions like (+99991) where the vast majority are empty lines

Expected behavior

File edits should only include the actual code changes without padding the file with thousands of empty lines. The behavior should match GPT-4 models which correctly edit files without adding spurious whitespace.

Example:

  • Expected: README.md with 150 lines, adding 20 lines of documentation = 170 lines total
  • Actual with GPT-5: README.md with 150 lines, adding 20 lines of documentation + 99,830 empty lines = 100,000+ lines total

Additional context

System Information

  • OS: macOS (Darwin 24.6.0)
  • Architecture: ARM64 (Apple Silicon)
  • Terminal: Apple Terminal
  • Shell: zsh
  • Node version: v23.5.0
  • Copilot CLI version: 0.0.334 (Commit: 26896a6)

Model Information

  • Affected Model: GPT-5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions