Skip to content

fix(agent-manager): scope multi-project sessions by project - #12867

Merged
marius-kilocode merged 3 commits into
mainfrom
investigate-multi-project-worktree-content-mismatc
Aug 4, 2026
Merged

fix(agent-manager): scope multi-project sessions by project#12867
marius-kilocode merged 3 commits into
mainfrom
investigate-multi-project-worktree-content-mismatc

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Multi-project Agent Manager shares one backend and provider across project roots, but event filtering and cached project identity could remain scoped to the previous project. A background worktree event could therefore reach the active transcript, while project switches could leave Git status and stats tied to the original workspace root.

Scope session events by the active project/worktree directory, refresh and race-guard the backend project identity during project activation, and resolve Git status from edited files to the nearest repository root. This keeps nested repositories usable when the workspace parent is not itself a Git repository.

Fixes #12832

Comment thread packages/kilo-vscode/src/KiloProvider.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The previous warning on refreshGitStatusFromPart is resolved: tool-part refreshes are now gated on state.status === "completed" and clamped to the active project scope (root + worktree directories, or the session workspace directory outside Agent Manager mode) via isCurrentProjectGitDirectory, so external tool paths can no longer flip gitStatus or retarget the stats poller. The new tests exercise the real implementation through handleEvent, including the outside-project rejection case.

Files Reviewed (2 files)
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts
Previous Review Summary (commit 127789a)

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

Previous review (commit 127789a)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/kilo-vscode/src/KiloProvider.ts 4777 refreshGitStatusFromPart re-resolves Git status from any tool file path, including files outside the current project — external edits/reads can flip gitStatus to repo: false (stopping the stats poller) or retarget the badge/poller to an unrelated repo. Consider clamping to the current project scope and/or gating on tool completion.

The core multi-project scoping looks solid: directory-authoritative event filtering in the SSE pre-filter and handleEvent, the race-guarded projectID refresh in handleLoadSessions/flushPendingSessionRefresh, and the revision-guarded refreshGitStatus are all consistent, and the new tests exercise the real implementation (including a real git init for the nested-repo case). Changeset is present and user-facing.

Fix these issues in Kilo Cloud

Files Reviewed (12 files)
  • .changeset/fix-multi-project-session-scope.md
  • packages/kilo-vscode/src/KiloProvider.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/GitOps.ts
  • packages/kilo-vscode/src/agent-manager/host.ts
  • packages/kilo-vscode/src/agent-manager/vscode-host.ts
  • packages/kilo-vscode/src/kilo-provider-utils.ts
  • packages/kilo-vscode/src/kilo-provider/git-status.ts
  • packages/kilo-vscode/tests/unit/git-ops.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-route-integration.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-session-refresh.test.ts

Reviewed by kimi-k3 · Input: 89.2K · Output: 6.5K · Cached: 288K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 24d1057 into main Aug 4, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the investigate-multi-project-worktree-content-mismatc branch August 4, 2026 16:23
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ject-worktree-content-mismatc

fix(agent-manager): scope multi-project sessions by project
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] Files-Changed / worktree UI hidden in multi-repo workspaces, git detection is scoped to workspace root

2 participants