[VS Code] Show Changes chip disappears on tab switch in multi-repo workspaces, also no changes seen in the "Changes view" tab for the current session
Description
Summary
In a multi-repo workspace whose root folder is not itself a git repo (a parent directory containing several git sub-repos — e.g. a workspace opened at / or ~/workspace), the "Open the changes view" chip disappears when you switch session tabs, and when the chip is visible, clicking it shows no changes in any mode (Branch/Git and Session both empty) even though files were edited.
The chip is only ever correct in the brief moment right after a tool edit. Every other trigger — initial load, session focus, tab switch — recomputes git status against the non-git workspace root instead of the project the session is actually working in, gets repo: false, and hides the chip. The diff panel's Session/Branch sources have the same root-scoping problem, so they return empty.
This is an unfixed remainder of #12832.
PR #12867 fixed the post-edit path only; the tab-switch/focus path and the diff-panel sources were never re-scoped. Confirmed present in v7.4.21 (current release) and byte-identical on main.
Steps to reproduce listed below
Root cause investigation assisted by LLM
The chip's visibility is driven by the last gitStatus.repo value the webview received:
- Webview:
server.tsx#L45-L48—gitInstalledis set tom.repoon eachgitStatusmessage. - Chip gate:
ChatView.tsx#L200/#L208/#L210— "Show Changes" is gated onserver.gitInstalled().
On a tab switch, the session-load path resolves a directory and refreshes git status against it:
KiloProvider.ts#L1976—const dir = this.getWorkspaceDirectory(sessionID)KiloProvider.ts#L1904-L1906—refreshSessionDetails(...)→refreshGitStatus(dir)
getWorkspaceDirectory() falls back to the workspace root when the session isn't cleanly routed to a project:
KiloProvider.ts#L4716-L4735— falls through toresolveWorkspaceDirectory({ ..., workspaceDirectory: this.getRootDirectory() }).
refreshGitStatus() then runs hasGit(root) and posts the result:
KiloProvider.ts#L4813-L4832—const repo = await hasGit(client, directory)→postMessage({ type: "gitStatus", repo: found }).
When the root is a non-git parent, hasGit returns false, gitInstalled becomes false, and the chip hides.
The only path that scopes correctly is the post-edit one added by #12867, and it fires only on a completed tool edit:
- Dispatch:
KiloProvider.ts#L4397—message.part.updated→refreshGitStatusFromPart KiloProvider.ts#L4782refreshGitStatusFromPart+#L4803isCurrentProjectGitDirectory— resolves the directory from the edited file'spath.dirname()and refreshes against that project.
So an edit temporarily sets repo: true (scoped to the sub-repo), and the next tab switch/focus overwrites it with repo: false (scoped to the root).
The diff panel has the same root-scoping problem — the Session source queries the diff against the resolved directory (the root):
catalog.ts#L39-L41—client.session.diff({ sessionID, directory })catalog.ts#L116-L119— session source built withctx.dir ?? ctx.workspaceRoot
Against the non-git root, session.diff returns [] and there's no branch to diff, so all modes are empty.
Instrumented trace, if attempting reproduction via temporary repro steps below (temporary console.error at the call sites above)
Editing app_alpha/README.md, then switching tabs:
11:57:42 refreshGitStatus dir=~/kilo-multirepo-test hasGit repo=false post repo=false (load → chip hidden)
11:59:20 refreshGitStatus dir=~/kilo-multirepo-test hasGit repo=false post repo=false (session focus)
11:59:32 refreshGitStatus dir=~/kilo-multirepo-test/app_alpha hasGit repo=true post repo=true (EDIT → chip APPEARS)
11:59:49 refreshGitStatus dir=~/kilo-multirepo-test hasGit repo=false post repo=false (TAB SWITCH → chip DISAPPEARS)
getWorkspaceDirectory: fallback resolved=~/kilo-multirepo-test root=~/kilo-multirepo-test
refreshGitStatusFromPart: resolved directory=~/kilo-multirepo-test/app_alpha
isCurrentProjectGitDirectory directory=…/app_alpha roots=[~/kilo-multirepo-test] result=true
Diff panel while open on the same session (Session mode):
checkSnapshotsEnabled directory=~/kilo-multirepo-test result=true
sessionFetch called directory=~/kilo-multirepo-test
sessionFetch result directory=~/kilo-multirepo-test count=0 data=[]
Suggested fix
Extend the project-scoping that refreshGitStatusFromPart / isCurrentProjectGitDirectory already do to the shared paths, so a session resolves to its own project directory rather than falling back to the non-git workspace root:
refreshSessionDetails→refreshGitStatus(...)(the tab-switch/focus path,KiloProvider.ts#L1904-L1906), and- the
DiffSourceCatalogsession/branch fetches (catalog.ts#L116-L119),
should target the session's resolved project directory (via the route service, as the edit path does) instead of getRootDirectory() when the workspace root is not itself a git repo.
Related
- Continuation of #12832; PR #12867 fixed only the post-edit refresh path.
Plugins
No response
Kilo version
7.4.21
Steps to reproduce
- Create a non-git parent folder containing two git sub-repos (must have no git ancestor — do not nest iinside another repo):
ROOT="$HOME/kilo-multirepo-test"
rm -rf "$ROOT"; mkdir -p "$ROOT" # parent stays NON-git
for app in app_alpha app_beta; do
mkdir -p "$ROOT/$app"
printf '# %s\n' "$app" > "$ROOT/$app/README.md"
git -C "$ROOT/$app" init -q
git -C "$ROOT/$app" add -A
git -C "$ROOT/$app" -c user.email=x@x -c user.name=x commit -qm init
done
- Open that parent folder as the VS Code workspace root. Start a Kilo session and have it edit a file in one sub-repo, e.g.
app_alpha/README.md. → the "Modified — N files" chip appears. - Observe the chip, click it to open the Changes panel and check Branch/Git and Session modes
- Open a second session tab (
+), then switch back to the first tab. See the UI above the chat window disappear.
Expected
- The chip persists across tab switches for a session whose edits are in a real git repo under the workspace.
- Clicking it shows the edit (
app_alpha/README.md) under Session (and/or Branch) mode.
Actual
- On the tab switch the chip flickers and disappears.
- When the chip is open, every mode is empty ("no changes" in Branch, Session, and default) despite the edit being on disk.
Screenshot and/or share link
No response
Operating System
macOS 26.6
Terminal
No response
@marius-kilocode FYI, this is a discovery continuation of https://github.com/Kilo-Org/kilocode/issues/12832 following the release of 7.4.21 which included your earlier PR https://github.com/Kilo-Org/kilocode/pull/12867 fixing the post-edit refresh path.