kilocode icon indicating copy to clipboard operation
kilocode copied to clipboard

[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

Open ehudc opened this issue 3 months ago • 1 comments

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.

Image

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:

On a tab switch, the session-load path resolves a directory and refreshes git status against it:

getWorkspaceDirectory() falls back to the workspace root when the session isn't cleanly routed to a project:

refreshGitStatus() then runs hasGit(root) and posts the result:

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#L4782 refreshGitStatusFromPart + #L4803 isCurrentProjectGitDirectory — resolves the directory from the edited file's path.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):

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:

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

  1. 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
  1. 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.
  2. Observe the chip, click it to open the Changes panel and check Branch/Git and Session modes
  3. 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

ehudc avatar Aug 11 '26 16:08 ehudc

@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.

ehudc avatar Aug 11 '26 16:08 ehudc