Skip to content

feat(agent-manager): update worktrees from their saved base - #13735

Merged
marius-kilocode merged 3 commits into
mainfrom
feat-agent-manager-update-from-base
Sep 3, 2026
Merged

feat(agent-manager): update worktrees from their saved base#13735
marius-kilocode merged 3 commits into
mainfrom
feat-agent-manager-update-from-base

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Updating a managed worktree currently requires writing a Git instruction by hand. Using main, the current project default, or the worktree branch's own upstream can select the wrong base after branches or project settings change.

Why This Change Was Made

Add one agent-task shortcut using the worktree's saved base metadata. /update-from-base, the worktree context menu, and the Command Palette send the same request to the owning project and worktree session. Existing busy-session handling and tool approvals remain in place.

This is not a native Git merge button. There is no new dialog, toolbar icon, setting, background poller, or Apply-conflict integration.

User Impact

  • Offer the slash action only in managed worktree chats, not Local or the sidebar.
  • Use the recorded remote, or ask the agent to inspect the saved base branch's upstream. Require a choice for local-only or unresolved sources.
  • Fetch the exact remote base before merging; stop on failed fetch/ref resolution, detached HEAD, existing merge/rebase, or blocking uncommitted changes.
  • Instruct the agent not to stash, discard, stage, or commit pre-existing edits, and not to push or apply the worktree into its base. Ask when conflict intent is unclear.
  • Preserve existing chat drafts. Include a short usage note and release note.

Evidence

150 focused tests passed. After resolving the conflict with current main, the full VS Code unit suite passed: 4,687 passed, 1 skipped, 0 failed. Extension compilation (types, lint, build), knip, change-marker and Markdown guards passed. Documentation type checking passed; documentation lint reported only existing warnings in unchanged files.

Isolated VS Code tests exercised actual fetches and merges in disposable repositories with a scripted local provider and normal one-shot Git approvals:

  • Saved main while Local had an unrelated branch and the project default was release.
  • Saved release with no recorded remote, resolved through that base's upstream.
  • A different branch checked out inside the worktree, updating that current branch without switching back.

The remote revisions were merged rather than stale local base refs. Local's branch and draft remained unchanged, and no stash was created. Final UI checks confirmed the slash action is hidden in Local and visible in worktrees. Test instances and fixtures were cleaned up.

The scripted provider validates routing and Git execution, not a live model's conflict-resolution judgment. Safeguards remain agent instructions rather than native Git enforcement.

Update from base slash action in a managed worktree

Update from base in the worktree right-click menu

@kilo-code-bot

kilo-code-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/kilo-vscode/src/agent-manager/base-update.ts
  • packages/kilo-vscode/tests/unit/base-update.test.ts
Previous Review Summary (commit e45acd8)

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

Previous review (commit e45acd8)

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/base-update.ts 49 Competing-session check treats unmanaged status IDs (including child/subagent sessions) as other worktree sessions, so Update from base can throw instead of queuing on the managed busy session
Files Reviewed (40 files)
  • packages/kilo-vscode/src/agent-manager/base-update.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/project/state-gate.ts
  • packages/kilo-vscode/src/agent-manager/types.ts
  • packages/kilo-vscode/src/extension.ts
  • packages/kilo-vscode/tests/unit/base-update.test.ts
  • packages/kilo-vscode/tests/unit/use-slash-command.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/update-from-base.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectSidebarBody.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/SidebarBody.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/WorktreeItem.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx
  • packages/kilo-vscode/webview-ui/src/types/messages/agent-manager.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts
  • packages/kilo-vscode/package.json
  • packages/kilo-docs/pages/automate/agent-manager.md
  • .changeset/agent-manager-update-from-base.md
  • packages/kilo-vscode/webview-ui/agent-manager/i18n/*.ts (21 locale files)

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 95.5K · Output: 5.8K · Cached: 198.4K

Review guidance: REVIEW.md from base branch main

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