Skip to content

fix(agent-manager): propagate base branch override to active diff source - #12696

Merged
marius-kilocode merged 2 commits into
mainfrom
tabby-modem
Jul 30, 2026
Merged

fix(agent-manager): propagate base branch override to active diff source#12696
marius-kilocode merged 2 commits into
mainfrom
tabby-modem

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

The base branch picker added in #12681 updates its own state and the branch list, but the diff itself keeps comparing against the old base. WorktreeDiffController.setBase() stored the override and called SourceController.reactivate(), which rebuilds the active source against the PanelContext captured by the last activate(). Nothing re-resolved the base from the override map and pushed it via setContext(), so the new base only took effect after switching scope or session, or reopening the panel.

setBase() now routes through the same activation path used when a diff context is opened, so the base is re-resolved with the override applied and pushed to the source before it rebuilds. Poll vs one-shot fetch mode is preserved, and an override set for a context that is not currently active is stored and picked up the next time that context's diff is requested. The webview message handler also logs activation failures instead of leaving an unhandled rejection.

Comment thread packages/kilo-vscode/src/agent-manager/worktree-diff-controller.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The previously flagged isPolling issue is resolved: the controller now records the intended watch mode in a poll field set at the top of activate() (and cleared in stop()), and setBase() re-activates with that recorded intent instead of controller.isPolling. This preserves live watching when a base change lands while the initial fetch is still in flight. The new test exercises exactly that window by gating the first fetch() and then asserting start() early-returns without a rebuild, which only holds if polling really resumed. SourceController's epoch guard still prevents the superseded activation from installing a stale interval.

Files Reviewed (2 files)
  • packages/kilo-vscode/src/agent-manager/worktree-diff-controller.ts
  • packages/kilo-vscode/tests/unit/worktree-diff-controller.test.ts
Previous Review Summary (commit a2b22d0)

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

Previous review (commit a2b22d0)

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/agent-manager/worktree-diff-controller.ts 204 this.controller.isPolling is false during a polling activation's initial fetch (polling starts only after runFetch resolves), so a base change in that window re-activates with poll: false and silently drops live diff watching until the scope/session changes. The new test also runs in exactly that window, so it doesn't cover poll-mode preservation.
Files Reviewed (4 files)
  • packages/kilo-vscode/src/agent-manager/worktree-diff-controller.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/tests/unit/worktree-diff-controller.test.ts
  • .changeset/agent-manager-diff-base-override.md

The core fix is sound: routing setBase() through activate() re-resolves the base and pushes it via setContext() before the source rebuilds, which reactivate() alone could not do. Storing an override for an inactive context and letting the next activation pick it up is correct, and the provider's .catch removes the previous unhandled rejection. Reviewed for correctness, races in the diff source lifecycle, and resource leaks — the re-activation path disposes the previous source and clears its interval, so no leak was found.

Fix these issues in Kilo Cloud


Reviewed by claude-opus-5 · Input: 26 · Output: 7.3K · Cached: 640.1K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit fcbb0cc into main Jul 30, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the tabby-modem branch July 30, 2026 13:50
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(agent-manager): propagate base branch override to active diff source
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.

2 participants