[VS Code] Clickable file links in agent responses don't work in multi-repo workspaces
Description
Description
Clickable file links rendered in chat (auto-linkified inline-code paths, and relative markdown links) fail to open in a VS Code window whose workspace root is a non-git parent containing multiple repos (root = / or ~/workspace, with child repos like ~/workspace/backend, ~/workspace/frontend). Clicking a relative reference such as spec/foo_spec.rb:12 or a bare foo.rb produces "File not found" or an ambiguous multi-match picker. Only absolute-path links open reliably.
This shares a root cause with the companion bug where the Files-Changed / worktree UI is hidden in multi-repo workspaces: both resolve against the workspace root instead of the session's actual working directory.
Root cause (code links pinned to commit 63a38f5)
packages/ui/src/file-path.ts:9— the path regex allows bare relative names (no leading slash), sofoo.rbandspec/foo_spec.rb:12are treated as file references, applied to every inline-code span atpackages/ui/src/context/marked.tsx:669.packages/kilo-vscode/webview-ui/src/App.tsx:122— clicking postsopenFile(filePath, line, column).packages/kilo-vscode/src/kilo-provider/editor-actions.ts:175— a relative path is joined todir:vscode.Uri.joinPath(vscode.Uri.file(dir), filePath).packages/kilo-vscode/src/kilo-provider/editor-actions.ts:147— on a miss it globs**/<basename>underdir; its comment claims the search is "scoped to the active session's directory ... can't cross into another worktree/branch."packages/kilo-vscode/src/KiloProvider.ts:4681— butdir=getWorkspaceDirectory(currentSession?.id), which falls back to the workspace root for non-worktree sessions. So the "scoped to the session directory" safety claim is void — the glob spans the entire root tree.
Net effect in a multi-repo workspace: relative links join to / (miss), then glob across everything under /, yielding "File not found" or an ambiguous picker. Absolute paths work only because openFile short-circuits isAbsolutePath before this logic.
Suggested fix
Resolve relative file links (and scope the findFallback glob) against the active session's working directory / the repo the referenced file lives in, rather than the workspace root. This is the same underlying fix as the git-detection bug filed in https://github.com/Kilo-Org/kilocode/issues/12832: give sessions a real working-directory concept instead of falling back to a single workspace root. Note a complete fix also needs to account for bare relative filenames being inherently ambiguous across a multi-repo tree.
Plugins
No response
Kilo version
7.4.17
Steps to reproduce
- Open VS Code with a non-git parent as the workspace root (root =
/or a folder containing multiple git sub-repos). - In a Kilo session, get the assistant to reference a file with a relative path (e.g. inline-code
spec/foo_spec.rb:12, or a markdown link[x](spec/foo_spec.rb)) inside one of the child repos. - Click the link. Observe: "File not found" or an ambiguous multi-match picker.
- Reference the same file by absolute path → it opens correctly.
Screenshot and/or share link
No response
Operating System
macOS 26.5
Terminal
No response
Hey @ehudc, I am trying to reproduce the issue and I wasn't able to. Could you check if you still see this issue in the latest release?
Updated to 7.4.21, also can't reproduce now. Relative file links and path:line jumps into child repos now open correctly in a multi-repo (non-git-root) workspace.
The fix is upstream of the code I pinned: editor-actions.ts and file-path.ts are unchanged, but getWorkspaceDirectory(session) now resolves to the session's actual repo dir instead of falling back to the workspace root. That landed in #12566 (v7.4.18), after this was filed on 7.4.17.
Closing current issue, will re-open if it re-appears.
aye i too get that exact behaviour