Skip to content

Copilot CLI rg compaction corrupts filenames with multiple numeric suffixes #5560

Done

Description

@aaroneng

Describe the bug

When the built-in rg tool compacts search results, it can truncate filenames with multiple numeric suffixes and display part of the filename where the line number should be. It can also group matches from two distinct files under one truncated filename. Standalone ripgrep returns the correct filenames and line numbers.

Affected version

1.0.114

Steps to reproduce the behavior

  1. Run this in a shell. It creates two files with 32 matching lines each and prints their directory. The long directory path helps trigger compaction.

cd "$(mktemp -d /tmp/copilot-rg-compaction-repro-with-a-long-absolute-directory-path.XXXXXX)"
for file in sample.log.2-3-71-109 sample.log.2-3-73-112; do
awk 'BEGIN { for (i = 0; i < 32; i++) print "RG_REPRO" }' > "$file"
done
pwd

  1. Start copilot in that directory and enter this prompt, replacing with the path printed above:
    Use the built-in rg tool, not Bash, to search for RG_REPRO in . Use glob sample.log.*, content output, line numbers enabled, and a head_limit of 20. Show the tool output as-is.

The built-in tool reports 40 matches across 1 file. It groups both files under sample.log.2 and displays entries like 3- 71-109:1:RG_REPRO.

Expected behavior

The tool should report 40 matches across 2 files, preserving both full filenames and lines 1–20 for each. To compare, run rg -Hn -m 20 RG_REPRO sample.log.* in the same directory. Standalone ripgrep returns the same 40 matches with the correct filenames and line numbers.

Additional context

No response

Activity

  1. added theissue type on Nov 23, 2026
  2. added
    area:tools
    and removed on Nov 24, 2026
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:tools

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions