[Bug] @file attachments can load the wrong file when a filename contains a Unicode space #2161
PLASMA-FR
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Affected area: Coding agent and CLI —
@filearguments.The documented file-argument workflow can attach a different document from the one requested when the filename contains a Unicode space. With an existing
report\u00a0draft.txt(U+00A0, non-breaking space), read-path resolution first changes the name toreport draft.txt(U+0020). If that second file exists, its contents are attached. If it does not exist, resolution returns a nonexistent path despite the requested file being present.Reproduced from source at
427ea4c72cc606ac061a14287c0c15c471eff002(main, package version 0.9.4), on Ubuntu 24.04.4 LTS, aarch64, Node 26.8.1, npm 11.19.0, Bash 5.2.21 in a noninteractive shell. This uses the real argument parser and attachment processor with temporary text files; no daemon or model credentials are needed.From the repository root after
npm ci:Actual output:
Expected: resolution finds the existing U+00A0 filename, and the attachment contains
INTENDED DOCUMENTeven when the ordinary-space sibling exists.The cause is in read-path resolution: Unicode-space normalization happens before the first existence check. History and the existing tests show that normalization and macOS screenshot fallbacks are intentional. Proposed scope, subject to maintainer invitation: give an existing literal read path precedence, retain those fallbacks when the literal path is absent, and cover both the missing-path and wrong-attachment cases, including relative and absolute paths. Add the required coding-agent changelog fragment.
Validation already run: all 16 existing tests pass with
npx tsx ../../node_modules/vitest/dist/cli.js --run test/path-utils.test.tsfrompackages/coding-agent; an ordinary-space attachment control also passes. An approved fix would run the focused path and attachment regressions plusnpm run check.I found no matching Discussion or issue, and no open PR changes read-path resolution. The attachment-file overlap in #1980 only renames a type import. No implementation changes have been made. I would like to take this scope if maintainers invite it and approve PR submission.
All reactions