Skip to content

fix(agent-manager): preserve terminal-only tabs when switching contexts - #13715

Merged
marius-kilocode merged 1 commit into
mainfrom
fix-terminal-session-reuse
Sep 3, 2026
Merged

marius-kilocode merged 1 commit into
mainfrom
fix-terminal-session-reuse

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Returning to a project with only a Local terminal tab added an unwanted New Session tab. Local and worktree contexts could also show a blank chat instead of their existing terminal when remembered tab state was missing or stale.

Why This Change Was Made

Terminal-only contexts already have usable content. Project restoration now checks the project-scoped central terminal tabs before creating a Local draft. Context selection restores a live terminal when no session or draft is available, while preserving remembered terminal, session, and review selection behavior. Side terminals and terminals from other projects are excluded from the fallback.

User Impact

Switching between Local, worktrees, and projects keeps terminal-only contexts usable without extra session tabs. Terminal focus and typed input are retained. Empty Local contexts still receive their initial draft.

Evidence

Reproduced the extra Local draft in an isolated VS Code self-test before the fix. After rebuilding and reloading, verified Local and worktree terminal-only restoration, missing-memory fallback, cross-project return, and keyboard navigation. Each return retained one terminal tab, input focus, and unsubmitted marker text.

Before, returning from another project adds a New Session tab beside the terminal:

Before the fix, a terminal-only Local context gains an unwanted New Session tab

After, the same return keeps only the terminal with its input intact:

After the fix, the Local terminal remains the only tab and retains typed input

The GitHub authentication notification is from the disposable test workspace and does not affect the terminal flow. No prompts were submitted to a model.

Validation:

  • bun run compile, including extension/webview typechecks and lint.
  • bun run test:unit: 4,661 passed, 1 skipped, 0 failed.
  • Focused selection, terminal-state, and project-restore tests: 56 passed.
  • bun run typecheck, bun run lint, bun run knip, and bun run check-kilocode-change.
  • Formatting and whitespace checks passed.
  • Read-only local review found no issues.

@kilo-code-bot

kilo-code-bot Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • .changeset/terminal-only-tab-restore.md
  • packages/kilo-vscode/tests/unit/agent-manager-selection-actions.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/project/local-tabs.ts
  • packages/kilo-vscode/webview-ui/agent-manager/selection-actions.ts

Reviewed by grok-4.6 · Input: 166.4K · Output: 13.7K · Cached: 607.9K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 7199942 into main Sep 3, 2026
25 checks passed
@marius-kilocode
marius-kilocode deleted the fix-terminal-session-reuse branch September 3, 2026 00:44
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