Skip to content

Fix /attachments command unreachable due to prefix match collision#43

Merged
yiwang merged 2 commits into
mainfrom
copilot/fix-attachments-command-reachability
Feb 19, 2026
Merged

Fix /attachments command unreachable due to prefix match collision#43
yiwang merged 2 commits into
mainfrom
copilot/fix-attachments-command-reachability

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

The /attachments command was unreachable because the /attach handler used starts_with("/attach"), which matched both commands.

Changes

  • Command matching logic (crates/cli/src/cli/chat.rs:236)
    • Changed from input.starts_with("/attach")
    • To input.starts_with("/attach ") || input == "/attach"
    • Now only matches /attach (exact) or /attach <args> (with space)
    • Allows /attachments to fall through to its own handler
// Before: matches /attach, /attachments, /attach-anything
if input.starts_with("/attach") {

// After: matches /attach or /attach <file>, not /attachments  
if input.starts_with("/attach ") || input == "/attach" {

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.pyke.io
    • Triggering command: /home/REDACTED/work/localgpt/localgpt/target/debug/build/ort-sys-64084d033ce2d210/build-script-main /home/REDACTED/work/localgpt/localgpt/target/debug/build/ort-sys-64084d033ce2d210/build-script-main -Wl,-Bstatic /home/REDACTED/work/localgpt/localgpt/target/debug/deps/libderive_builder_core-900--gdwarf-4 /home/REDACTED/work/localgpt/localgpt/target/debug/deps/libdarling-2d0a6446a3d830e--64 /home/REDACTED/work/localgpt/localgpt/target/debug/deps/libdarling_core-861269de9e-o 7.1/generated-include /home/REDACTED/work/localgpt/localgpt/target/debug/deps/libfnv-1215859a684cad45.rl/tmp/ccjdDOfG.s 7.1/include /home/REDACTED/work/localgpt/localgpt/target/debug/deps/libsyn-5a31f41abc6c2f2a.rlib 7.1/aws-lc/include /home/REDACTED/work/localgpt/localgpt/target/debug/deps/libproc_macro2-7e8392b0e59a7afb.rlib 7.1/aws-lc/third_party/s2n-bignum/include 407a�� 7.1/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/include 64-REDACTED-linux-gnu/lib/librustc_literal_escaper-f22bf791d1c2fd7e.rlib 7.1/aws-lc/third_party/jitterentropy/jitterentropy-library clude rgo/registry/src-Wl,--version-script=/tmp/rustcXeWJmr/list -fno-omit-frame--Wl,--no-undefined-version 89/out/ebcd52e9457b6221-i2d_pr.o (dns block)
    • Triggering command: /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/build/ort-sys-af27879de92f8ade/build-script-main /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/build/ort-sys-af27879de92f8ade/build-script-main -Wl,-Bstatic /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libderive_builder_core-9008c5fe8794bcb5.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libdarling-2d0a6446a3d830e5.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libdarling_core-861269de9e726a54.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libstrsim-8da5906b5f32b006.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libfnv-1215859a684cad45.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libident_case-0f6ad5d47d62a42b.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libsyn-5a31f41abc6c2f2a.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libquo�� /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libproc_macro2-7e8392b0e59a7afb.rlib /home/REDACTED/work/localgpt/.codeql-scratch/dbs/rust/working/target/debug/deps/libunicode_ident-6c344b3cd407a301.rlib 7.1/�� et/debug/build/o-I 7.1/generated-include -1949cf8c6b5b557-I 7.1/include -1949cf8c6b5b557-Wl,--version-script=/tmp/rustcoComur/list 7.1/aws-lc/include -1949cf8c6b5b557-m64 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>/attachments command is never reachable as we are checking first if command start with /attach</issue_title>
<issue_description>In chat command we are first checking for /attach which would be true even for /attachements making it unreachable.

You: /attach /Users/gautamkumar/Documents/workspace/localgpt/CLAUDE.md
Attached: CLAUDE.md (13734 bytes)
Type your message to send with attachment(s), or /attachments to list.

You: /attachements
Usage: /attach <file_path>

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: yiwang <142937+yiwang@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix attachments command to be reachable in chat Fix /attachments command unreachable due to prefix match collision Feb 19, 2026
Copilot AI requested a review from yiwang February 19, 2026 04:40
@yiwang yiwang marked this pull request as ready for review February 19, 2026 04:43
@yiwang yiwang merged commit 7865295 into main Feb 19, 2026
5 checks passed
@yiwang yiwang deleted the copilot/fix-attachments-command-reachability branch February 19, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/attachments command is never reachable as we are checking first if command start with /attach

2 participants