Skip to content

fix(agent-manager): open terminal when switching worktrees - #12689

Merged
marius-kilocode merged 2 commits into
mainfrom
buttercup-gerbera
Jul 30, 2026
Merged

fix(agent-manager): open terminal when switching worktrees#12689
marius-kilocode merged 2 commits into
mainfrom
buttercup-gerbera

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

An open Agent Manager terminal panel currently becomes an empty state when switching to a worktree that has not created a terminal yet, forcing an extra click before the panel is useful again.

Keep the panel active across worktree switches and ensure the selected context has a side terminal. Existing terminals are reused, and the existing pending-create guard prevents duplicate terminals during rapid switching.

@marius-kilocode
marius-kilocode enabled auto-merge (squash) July 30, 2026 11:50
Comment thread packages/kilo-vscode/webview-ui/agent-manager/terminal/side.ts Outdated
Comment thread packages/kilo-vscode/webview-ui/agent-manager/terminal/side.ts Outdated
Comment thread packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
@kilo-code-bot

kilo-code-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/terminal/side.ts 114 !previous combined with { defer: true } swallows the first context switch — Solid's on doesn't record prevInput on the deferred run, so the first worktree switch after mount still shows the empty terminal state

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/terminal/side.ts 115 Auto-create leaves a live PTY/websocket in every context the user passes through; side terminals are never reclaimed on context switch
packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx 1873 Effect flushes synchronously inside selectWorktree, and showSideTerminal() also clears history/review — races the per-context review restore and closes the history view
Files Reviewed (4 files)
  • .changeset/quiet-terminals-switch.md - 0 issues
  • packages/kilo-vscode/tests/unit/agent-manager-terminal-side.test.ts - 0 issues (noted in the side.ts:114 comment: the test pins the current previous === undefined behavior)
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/side.ts - 2 issues

Fix these issues in Kilo Cloud


Reviewed by claude-opus-5 · Input: 54 · Output: 19.7K · Cached: 1.9M

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode disabled auto-merge July 30, 2026 12:03
# Conflicts:
#	packages/kilo-vscode/webview-ui/agent-manager/terminal/side.ts
@marius-kilocode
marius-kilocode enabled auto-merge (squash) July 30, 2026 12:17

@bagatao-anaconda bagatao-anaconda left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 🚀

@marius-kilocode
marius-kilocode merged commit 1cd81a9 into main Jul 30, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the buttercup-gerbera branch July 30, 2026 13:03
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.

2 participants