The best way to control Claude Code, Codex and more from any computer or phone
fix(shared): shortened agent paths like /tmp/... no longer become broken file chips (#30762)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 6, 2026 at 04:38 UTC
47a89f2ee7b78443ba91718c0557c125a5e63785
2 files changed
+9
packages/shared/src/markdownLinks.test.ts
+6
@@ -29,6 +29,12 @@ describe("inlineCodeFilePathCandidate", () => {
29
["share/man/ls.1", "share/man/ls.1"],
30
["src/main.ts/", null],
31
["./patches/", "./patches/"],
32
+ // regression: #30757 an agent's shortened path is not a file
33
+ ["/tmp/claude-1000/...", null],
34
+ ["/tmp/claude-1000/...:12", null],
35
+ ["/tmp/.../scratchpad/notes.md", null],
36
+ ["~/projects/…/notes.md", null],
37
+ ["src/.../main.ts", null],
38
])("distinguishes file paths from code and hostnames in %s", (source, candidate) => {
39
expect(inlineCodeFilePathCandidate(source)).toBe(candidate);
40
});
packages/shared/src/markdownLinks.ts
+3
@@ -33,6 +33,8 @@ const POSITION_ONLY_PATTERN = /^\d+(?::\d+)?$/;
33
const INLINE_CODE_DISQUALIFIER_PATTERN = /[\s`]/;
34
35
const PATH_SEPARATOR_PATTERN = /[\\/]/;
36
+// Agents shorten long paths with a `...` or `…` segment, which no file chip can open.
37
+const ELIDED_PATH_SEGMENT_PATTERN = /(?:^|[\\/])(?:\.{3,}|…)(?:[\\/]|$)/;
38
39
const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/;
40
const VERSION_SUFFIX_PATTERN = /\d\.\d[^.]*$/;
@@ -178,6 +180,7 @@ export function inlineCodeFilePathCandidate(codeText: string): string | null {
180
const candidate = isWindowsAbsolutePath(trimmed) ? trimmed : trimmed.replaceAll("\\", "/");
181
const hasPosition = POSITION_SUFFIX_PATTERN.test(candidate);
182
if (!hasPosition && !PATH_SEPARATOR_PATTERN.test(candidate)) return null;
183
+ if (ELIDED_PATH_SEGMENT_PATTERN.test(candidate.replace(POSITION_SUFFIX_PATTERN, ""))) return null;
184
185
const hasExplicitPathShape =
186
RELATIVE_PATH_PREFIX_PATTERN.test(candidate) ||