Skip to content

Edit tools' diffs are a mess in line ordering. #3249

Description

@dolfandringa

Describe the bug

When copilot cli asks me for approval on edits, it very often makes an absolute mess on line ordering, making the review nearly impossible. In the example below you can see the line numbers make absolutely no sense.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Edit file                                                                                                             │
│ ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
│ settler.py +44 -34                                                                                                    │
│ /my_service                                                                                                             │
│              
 463                                                                                                                   │
│ 464                                                                                                                   │
│ 465 +   async def handle_settlement_sqs_message(msg_body: str) -> None:                                               │
│ 466 +       await on_community_bucket_expired(msg_body)                                                               │
│ 467 +                                                                                                                 │
│ 468 +                                                                                                                 │
│ 469     class MeasurementHandler:                                                                              │
│ 470         def __init__(self) -> None:                                                                               │
│ 471             self._task: asyncio.Task[None] | None = None                                                          │
│ 472                                                                                                                   │
│ 473         async def start(self) -> None:                                                                            │
│ 458 -          """Schedule the Redis expiry listener task. Call from within an async context (e.g. FastAPI            │
│        lifespan)."""                                                                                                  │
│ 474 +          """Schedule the settlement scanner task. Call from within an async context (e.g. FastAPI lifespan).""" │
│                                                                                                                       │
│ 475             log = logging.getLogger(__name__)                                                                     │
│ 476             log.info("Starting S2PowerMeasurementHandler")                                                        │
│ 477             self._task = asyncio.create_task(                                                                     │
│ 474            """Schedule the key scans"""                                                                                                  │
│ 475             log = logging.getLogger(__name__)                                                                     │
│ 476             log.info("Starting MeasurementHandler")                                                        │
│ 461 -           self._task = asyncio.create_task(                                                                     │
│ 462 -               start_expiry_listener(                                                                            │
│ 463 -                   {                                                                                             │
│ 464 -                       "my_service:measurements:*:last_message": on_community_bucket_expired      │
│ 465 -                   }                                                                                             │
│ 466 -               )                                                                                                 │
│ 467 -           )                                                                                                     │
│ 477 +           self._task = asyncio.create_task(settlement_scanner())                                                │
│ 478                                                                                                                   │
│ 479             def task_done_callback(t: asyncio.Task[None]) -> None:                                                │
│ 480                 if t.cancelled():                                                                                 │
│ 471 -                   log.info("Expiry listener task was cancelled")                                                │
│ 481 +                   log.info("Settlement scanner task was cancelled")                                             │
│ 482                 elif t.exception():                                                                               │
│ 483                     log.exception("Expiry listener task failed", exc_info=t.exception())                          │
│ 484                 else:                                                                                             │
│ 480                 if t.cancelled():                                                                                 │
│ 481                     log.info("Expiry listener task was cancelled")                                                │
│ 482                 elif t.exception():                                                                               │
│ 473 -                   log.exception("Expiry listener task failed", exc_info=t.exception())                          │
│ 483 +                   log.exception("Settlement scanner task failed", exc_info=t.exception())                       │
│ 484                 else:                                                                                             │
│ 475 -                   log.info("Expiry listener task completed normally")                                           │
│ 485 +                   log.info("Settlement scanner task completed normally")                                        │
│ 486                                                                                                                   │
│ 487             self._task.add_done_callback(task_done_callback)                                                      │
│ 488                                                                                                                   │
│ 487             self._task.add_done_callback(task_done_callback)                                                      │
│ 488                                                                                                                   │
│ 489         async def stop(self) -> None:                                                                             │
│ 480 -           """Cancel the Redis expiry listener task and wait for it to finish."""                                │
│ 490 +           """Cancel the settlement scanner task and wait for it to finish."""                                   │
│ 491             if self._task is not None:                                                                            │
│ 492                 self._task.cancel()                                                                               │
│ 493                 try:                                                                                              │
│                              

Affected version

GitHub Copilot CLI 1.0.45.

Steps to reproduce the behavior

I run copilot on the cli and ask it for confirmation of every edit so i review and guide it as its writing code (rather than a single large diff)

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on May 11, 2026
  2. added
    area:terminal-renderingDisplay and rendering: flickering, scrolling, line wrapping, output formatting
    area:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior
    on May 12, 2026
  3. copilot-cli-bot commented on Oct 9, 2026

    @copilot-cli-bot

    This appears to be resolved as of GitHub Copilot CLI v1.0.94. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:terminal-renderingDisplay and rendering: flickering, scrolling, line wrapping, output formattingarea:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions