Skip to content

fix(vscode): preserve changes in multi-repo sessions - #13088

Merged
johnnyeric merged 1 commit into
mainfrom
johnnyeric/fix-show-changes-multirepo
Aug 12, 2026
Merged

fix(vscode): preserve changes in multi-repo sessions#13088
johnnyeric merged 1 commit into
mainfrom
johnnyeric/fix-show-changes-multirepo

Conversation

@johnnyeric

@johnnyeric johnnyeric commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Issue

Fixes #13070

Context

In a workspace opened at a non-Git parent containing multiple Git repositories, the extension forgot the repository associated with a session. A tab switch refreshed Git status against the non-Git parent, hiding the Changes chip, while Git-backed Changes sources queried that same parent and displayed no files.

Implementation

Track a stable Git root for each session from completed file-mutating tools and restore it from edit history when a session reloads. Reuse that root for focus refreshes and pass it from the invoking sidebar, editor tab, or Agent Manager provider to the shared Changes panel.

The Changes panel uses the resolved repository for Branch, Staged, and Unstaged sources and for opening files. Session and Turn sources remain backed by server snapshots; the extension does not synthesize session attribution from unrelated working-tree changes when a session was created at a non-Git parent.

Screenshots / Video

Screenshot 2026-08-12 at 16 13 37

Before

Screenshot 2026-08-12 at 16 11 06

After

Screenshot 2026-08-12 at 16 13 21

How to Test

Manual/local verification

  • Human: reproduced the empty Branch view in the installed extension, then verified the development extension showed app_alpha/README.md and retained the Changes indicator.
  • Agent: reproduced the backend routing behavior with a live non-Git parent containing two Git subrepositories.
  • Agent: ran the full VS Code unit suite, focused regression tests, extension compile, typechecks, lint, bundle, Knip, and repository guards.

Reviewer test steps

  1. Create a non-Git parent containing independent Git repositories app_alpha and app_beta, then open the parent as the VS Code workspace.
  2. Start a Kilo session and have it edit app_alpha/README.md with a file-mutating tool.
  3. Open Changes in Branch mode and confirm it shows the edit from app_alpha but no unrelated files from app_beta.
  4. Create a second Kilo session, switch back to the edited session, and confirm the Changes indicator remains visible.
  5. Reopen Changes in Branch mode and confirm the edited file is still present.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

@johnnyeric
johnnyeric marked this pull request as ready for review August 12, 2026 14:48
@johnnyeric
johnnyeric force-pushed the johnnyeric/fix-show-changes-multirepo branch from 1fbcc14 to b5b192d Compare August 12, 2026 14:49
@johnnyeric
johnnyeric marked this pull request as draft August 12, 2026 14:50
@johnnyeric
johnnyeric marked this pull request as ready for review August 12, 2026 14:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5b192dca4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/kilo-vscode/src/extension.ts Outdated
Comment thread packages/kilo-vscode/src/diff/sources/catalog.ts Outdated
Comment thread packages/kilo-vscode/src/diff/sources/catalog.ts Outdated
Comment thread packages/kilo-vscode/src/diff/sources/catalog.ts Outdated
Comment thread packages/kilo-vscode/src/review-utils.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/src/KiloProvider.ts 4843 Session Git recovery fetches the entire session history (limit: 0) on first load for non-Git workspaces; consider paging or deferring until Changes is opened
Files Reviewed (13 files)
  • .changeset/multirepo-changes.md
  • packages/kilo-vscode/src/KiloProvider.ts - 1 issue
  • packages/kilo-vscode/src/diff/DiffViewerProvider.ts
  • packages/kilo-vscode/src/extension.ts
  • packages/kilo-vscode/src/kilo-provider/session-edits.ts
  • packages/kilo-vscode/src/review-utils.ts
  • packages/kilo-vscode/tests/unit/diff-viewer-provider.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-route-integration.test.ts
  • packages/kilo-vscode/tests/unit/review-utils.test.ts
  • packages/kilo-vscode/tests/unit/session-edits.test.ts
  • packages/kilo-vscode/tests/unit/source-controller.test.ts

Note: this review follows a rebase/squash of the branch. All four previous findings are resolved: the Git fallback in diff/sources/catalog.ts was removed entirely (that file is no longer in the diff), and review-utils.ts no longer hardcodes the session:/turn: source-id prefixes. The new design — per-session stable Git roots discovered from completed mutating tool parts, revision-guarded refreshes that don't clobber background sessions, and per-invoking-provider diff context — is sound. Session state is pruned on delete, no leaked listeners or processes, and openRelativeFile retains the path-containment check via resolveInside. Tests exercise real Git repositories.

Fix these issues in Kilo Cloud

Previous Review Summary (commit b5b192d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit b5b192d)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/diff/sources/catalog.ts 173 Relative tool paths resolve against the Git root instead of the session backend directory, silently dropping files from the fallback diff

SUGGESTION

File Line Issue
packages/kilo-vscode/src/diff/sources/catalog.ts 192 Fallback re-fetches session messages from the backend on every 2.5s poll tick
packages/kilo-vscode/src/diff/sources/catalog.ts 145 files cache accumulates per session/turn and is only cleared on extension deactivation
packages/kilo-vscode/src/review-utils.ts 48 Hardcoded "session:" / "turn:" prefixes duplicate catalog constants
Files Reviewed (15 files)
  • .changeset/multirepo-changes.md
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/diff/DiffViewerProvider.ts
  • packages/kilo-vscode/src/diff/sources/catalog.ts - 3 issues
  • packages/kilo-vscode/src/diff/types.ts
  • packages/kilo-vscode/src/extension.ts
  • packages/kilo-vscode/src/kilo-provider/session-edits.ts
  • packages/kilo-vscode/src/review-utils.ts - 1 issue
  • packages/kilo-vscode/tests/unit/diff-source-catalog.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-route-integration.test.ts
  • packages/kilo-vscode/tests/unit/review-utils.test.ts
  • packages/kilo-vscode/tests/unit/session-edits.test.ts
  • packages/kilo-vscode/tests/unit/source-controller.test.ts

The core design is sound: per-session stable Git roots, revision-guarded status refreshes that no longer clobber the UI for background sessions, snapshot-first sources with a file-filtered Git fallback only for non-Git-backed sessions, and real-git integration tests. Session state (sessionGitDirectories, sessionGitRecoveries) is properly pruned on session delete, and the fallback lazily creates its worktree source. No security issues found; the new openRelativeFile retains the path-containment check against the resolved root.

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 297.5K · Output: 16.3K · Cached: 1.1M

Review guidance: REVIEW.md from base branch main

@johnnyeric
johnnyeric force-pushed the johnnyeric/fix-show-changes-multirepo branch from b5b192d to 50c11ae Compare August 12, 2026 15:24
Comment thread packages/kilo-vscode/src/KiloProvider.ts
@johnnyeric
johnnyeric merged commit 9f4ab3a into main Aug 12, 2026
24 checks passed
@johnnyeric
johnnyeric deleted the johnnyeric/fix-show-changes-multirepo branch August 12, 2026 16:27
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[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

2 participants