Skip to content

fix(vscode): keep background subagent cards collapsed and cap reasoning - #14104

Merged
marius-kilocode merged 2 commits into
mainfrom
remove-reasoning-body-animation-async-agents
Sep 14, 2026
Merged

fix(vscode): keep background subagent cards collapsed and cap reasoning#14104
marius-kilocode merged 2 commits into
mainfrom
remove-reasoning-body-animation-async-agents

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Background subagent task cards opened while the task was starting and briefly showed Starting..., then collapsed once the task finished. That open-then-close cycle flickered the transcript. Reasoning blocks inside a background agent transcript also re-expanded and collapsed while the agent streamed.

Why This Change Was Made

  • TaskToolExpanded derived auto-open from taskRunning(status), which is true during pending while the tool arguments, including background, are still streaming. The card therefore opened before it could know the task was asynchronous, and BasicTool seeds its open state only once.
  • The card's open state is now controlled and settles after the input arrives. It auto-opens only when the status is running and the task is not a background task. Background cards stay collapsed and never render the Starting... item. A stored preference, a search forceOpen, or a manual toggle still wins over the automatic state.
  • Foreground agents still need the display-driven collapse, so reasoningCapped renders reasoning in a background agent transcript as the existing 120px capped preview that starts open and never auto-expands.

User Impact

  • Background task cards stay as a single collapsed header (description plus status) and no longer flicker; they can be expanded manually once the task is done.
  • Background agent reasoning shows a compact preview instead of animating open and closed. Click to collapse it to the header, or expand the full body.
  • Foreground task cards, their Starting... status, and reasoning behavior are unchanged.

Evidence

  • bun run typecheck (host and webview): 0 errors.
  • bun run lint: 0 errors.
  • bun run bundle: 0 errors.
  • bun test in packages/kilo-vscode: 5529 pass, 0 fail, including new backgroundChildren unit tests.
  • VS Code self-test of the live background-task flow was not run because it requires a paid model request.

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

kilo-code-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/kilo-vscode/src/SubAgentViewerProvider.ts

Incremental review of 4902593e (fix: refresh subagent viewer reasoning cap on panel reuse). The previously reported suggestion (reused panels ignored the new background argument) is resolved: openPanel now tracks the flag in a backgrounds map and re-posts viewSubAgentSession when it changes, which the webview handles by updating subAgentCapped. The new map is cleaned up on panel dispose and provider dispose, so it does not retain entries.

Previous Review Summary (commit 3c040da)

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

Previous review (commit 3c040da)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

SUGGESTION

File Line Issue
packages/kilo-vscode/src/SubAgentViewerProvider.ts 24 Reused panels ignore the new background argument, so subAgentCapped can stay stale when the same subagent is opened again with a different background state.
Files Reviewed (18 files)
  • .changeset/background-subagent-reasoning-preview.md - ok
  • packages/kilo-ui/src/components/message-part.tsx - ok
  • packages/kilo-vscode/src/KiloProvider.ts - ok
  • packages/kilo-vscode/src/SubAgentViewerProvider.ts - 1 suggestion
  • packages/kilo-vscode/src/extension.ts - ok
  • packages/kilo-vscode/tests/unit/background-agents.test.ts - ok
  • packages/kilo-vscode/webview-ui/agent-manager/SubagentPanel.tsx - ok
  • packages/kilo-vscode/webview-ui/src/App.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/AssistantMessage.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/BackgroundAgents.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/TaskToolExpanded.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/TranscriptRow.tsx - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/background-agents.ts - ok
  • packages/kilo-vscode/webview-ui/src/components/chat/open-subagent.ts - ok
  • packages/kilo-vscode/webview-ui/src/types/messages/extension-messages.ts - ok
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts - ok

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 4d0cbc7 into main Sep 14, 2026
34 checks passed
@marius-kilocode
marius-kilocode deleted the remove-reasoning-body-animation-async-agents branch September 14, 2026 08:10
ausard pushed a commit to ausard/kilocode that referenced this pull request Sep 14, 2026
Add a regression test for the background subagent card auto-open rule
introduced in Kilo-Org#14104. A pending or running background task must not open
on its own, and the streamed input flag wins over later metadata.

Extract the two decision helpers into task-tool-state so the rule is
unit-testable without rendering the card.
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