The best way to control Claude Code, Codex and more from any computer or phone
fix(client-runtime): keep model ids in inline code from becoming file chips (#13909)
Otavio Salvador committed
Sep 29, 2026 at 21:02 UTC
88fbc2cac77ff2bf0d406c44754ecd8014976f5f
2 files changed
+13
packages/client-runtime/src/markdownLinks.test.ts
+9
@@ -22,6 +22,15 @@ describe("inlineCodeFilePathCandidate", () => {
22
["127.0.0.1:3000", null],
23
["example.com/index.html", null],
24
["example.pl/index.html", null],
25
+ ["z-ai/glm-5.3", null],
26
+ ["z-ai/glm-5.3:12", null],
27
+ ["python/3.12", null],
28
+ ["Qwen/Qwen2.5-Coder", null],
29
+ ["meta-llama/Llama-3.1-8B", null],
30
+ ["share/man/ls.1", "share/man/ls.1"],
31
+ ["usr/lib/libfoo.so.1", "usr/lib/libfoo.so.1"],
32
+ ["vendor/jquery-3.6.0.min.js", "vendor/jquery-3.6.0.min.js"],
33
+ ["./models/glm-5.3", "./models/glm-5.3"],
34
])("distinguishes file paths from code and hostnames in %s", (source, candidate) => {
35
expect(inlineCodeFilePathCandidate(source)).toBe(candidate);
36
});
packages/client-runtime/src/markdownLinks.ts
+4
@@ -14,6 +14,9 @@ const POSITION_ONLY_PATTERN = /^\d+(?::\d+)?$/;
14
const INLINE_CODE_DISQUALIFIER_PATTERN = /[\s`]/;
15
const PATH_SEPARATOR_PATTERN = /[\\/]/;
16
const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/;
17
+// A final dot between digits marks a version or model id (`glm-5.3`,
18
+// `Qwen2.5-Coder`), not an extension. `ls.1` and `libfoo.so.1` stay files.
19
+const VERSION_SUFFIX_PATTERN = /\d\.\d[^.]*$/;
20
const NUMERIC_DOTTED_PATTERN = /^\d+(?:\.\d+)+$/;
21
// Standard OS and dev-container roots; deliberately excludes app-route-ish
22
// prefixes like /app/ or /chat/ so SPA routes never read as files.
@@ -176,6 +179,7 @@ export function inlineCodeFilePathCandidate(codeText: string): string | null {
179
.replace(/[/\\]+$/, "")
180
.split(/[\\/]/)
181
.at(-1) ?? "";
182
+ if (VERSION_SUFFIX_PATTERN.test(basename)) return null;
183
if (!hasPosition && !FILE_EXTENSION_PATTERN.test(basename)) return null;
184
}
185
return candidate;