Skip to content

fix(chat): resolve complete file paths in transcripts - #1222

Merged
vastsa merged 10 commits into
vastsa:mainfrom
caulif:fix/issue-1169-file-paths
Sep 29, 2026
Merged

vastsa merged 10 commits into
vastsa:mainfrom
caulif:fix/issue-1169-file-paths

Conversation

@caulif

@caulif caulif commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1169

Problem

Chat could fail to open a file the assistant had just written. For example, C:\demo project\readme.md could be left as plain inline code or scanned as only its trailing segment, while clicking the Write tool path could report no match. Spaces in POSIX paths, Windows drive letters and backslashes, UNC paths, and multi-dot filenames exposed related parsing failures. A same-named file elsewhere could also make an incorrect fallback look plausible.

Changes

  • Keep complete file references through chat prose, inline code, Markdown links, and tool rows, including spaced absolute paths, Windows and UNC syntax, Unicode names, and multi-dot filenames. Preserve separate links when prose contains multiple paths.
  • Send absolute references to the existing main-process resolver intact. Resolve an absolute path only to that exact file within an allowed project, session scratch, or attachment root; distinguish an outside-root path from a missing in-root file in the UI.
  • Validate real paths and regular-file status before returning relative, attachment-blob, or indexed fuzzy matches. Escaping or dangling links cannot redirect an exact reference to a same-named file; fuzzy matching retains the existing root and suffix priority while skipping stale or escaping entries. The downstream open operation still performs its own access check.
  • Update the IPC contract, localized messages, specifications, E2E scenario, and regression tests.

Unmarked relative paths whose first segment contains spaces remain plain text because they cannot be reliably distinguished from ordinary prose. An explicit @"my project/page.md" reference remains available. Home paths remain plain text.

Validation

  • Synced with upstream main at 110fc6675; pnpm check:pr-base and git diff --check upstream/main...HEAD passed.
  • Windows: 104 relevant desktop tests passed, 0 skipped. The attachment-root junction escape assertion runs without file-symlink privileges.
  • Ubuntu WSL: 29 file-resolution tests passed, 0 skipped, including a real attachment-blob file-symlink escape assertion. The Windows junction test and POSIX file-symlink test exercise different link types.
  • Workspace dependency build, desktop typecheck, Electron/Vite build, lint, and docs checks passed.
  • The reporter manually checked Windows chat-click scenarios on an earlier packaged candidate and reported success. The candidate after this upstream sync has not received another manual UI pass.

Remaining verification

pnpm test:e2e:transcript did not produce a UI verdict: Electron's renderer returned no probe result (exit=null). This is not counted as a passing E2E test. Actual macOS/Linux UI clicks have not been tested; the WSL result above is a resolver test.

Keep spaced and Windows absolute paths intact from chat text and tool rows through file resolution. Resolve absolute references only at their exact path inside allowed roots, and report access limits separately from missing files.

Fixes vastsa#1169
Keep dotted directory paths and decorated filenames intact while avoiding ambiguous prose matches. Cover cross-platform paths and explicit references in the chat link tests.
The blob symlink assertion required Windows file-link privileges and was skipped on this machine. Exercise attachment-root containment with a junction on Windows while retaining the real blob symlink assertion on POSIX, so both platforms run a meaningful boundary test without a permission-dependent skip.
@vastsa
vastsa merged commit 23deef5 into vastsa:main Sep 29, 2026
4 checks passed
@caulif
caulif deleted the fix/issue-1169-file-paths branch October 5, 2026 02:55
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.

[Bug] 聊天无法完整识别含空格的文件路径,Windows 路径还有盘符与反斜杠问题

2 participants