Skip to content

feat(agent-manager): align and persist collapsible headers - #12844

Merged
marius-kilocode merged 5 commits into
mainfrom
toggle-multi-project-header-collapse-persistence
Aug 4, 2026
Merged

feat(agent-manager): align and persist collapsible headers#12844
marius-kilocode merged 5 commits into
mainfrom
toggle-multi-project-header-collapse-persistence

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

The Agent Manager used separate header layouts for projects, user-defined sections, and sessions. Their chevrons and labels could land in different columns, and project expansion state was not consistently restored across reopen and reload.

This change introduces a shared SidebarSectionHeader component with a fixed leading control column and reusable label, count, and action slots. Project expansion state is persisted for both catalog projects and the pinned project, then restored when project contexts initialize. Existing selection, trust, rename, context-menu, and action behavior is preserved.

Before:
Agent Manager headers before alignment

After:
Agent Manager headers aligned

Comment thread packages/kilo-vscode/webview-ui/agent-manager/SectionHeader.tsx
Comment thread packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx
Comment thread packages/kilo-vscode/webview-ui/agent-manager/SidebarSectionHeader.tsx Outdated
Comment thread packages/kilo-vscode/src/agent-manager/project/messages.ts Outdated
Comment thread packages/kilo-vscode/src/agent-manager/project/contexts.ts Outdated
Comment thread packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
Comment thread packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
Comment thread packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
Comment thread packages/kilo-vscode/webview-ui/agent-manager/agent-manager.css
@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx
Previous Review Summaries (3 snapshots, latest commit 43a222d)

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

Previous review (commit 43a222d)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1

Incremental review of 43a222d0 (1 commit since cf4a8f2f): the SidebarSearchOpen story reverts to the raw am-section-header markup, restoring the DOM structure the existing visual-regression baseline was generated against. The SidebarSectionHeader import removal is clean and no new issues were found in the changed file. The previous suggestion below was re-verified against current HEAD and remains unresolved.

Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx 98 Clicking a missing project's header still fires onExpand; since the snapshot now masks expanded for missing projects, every click invisibly persists expanded=true and initializes a context for a nonexistent directory
Files Reviewed (2 files)
  • packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx (incremental diff)
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx - 1 issue (carry-forward, re-verified)

Fix these issues in Kilo Cloud

Previous review (commit cf4a8f2)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1

All 9 findings from the previous review are resolved in cf4a8f2f: rename commit-on-blur is restored with a re-entrancy guard, missing projects can no longer be selected via header click, the header wrapper's role="button" was replaced with a real chevron <button>, setExpanded uses a fresh post-await context, isExpanded() is now a pure read-through, initExpanded has a rejection handler, panel close disposes the per-project pollers, missing projects no longer render a perpetual spinner, and .am-section-header regained its flex layout with the story updated to match. One new minor finding below.

Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx 98 Clicking a missing project's header still fires onExpand; since the snapshot now masks expanded for missing projects, every click invisibly persists expanded=true and initializes a context for a nonexistent directory
Files Reviewed (11 files)
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/sidebar-search-open-chromium-linux.png (LFS baseline)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/project/contexts.ts
  • packages/kilo-vscode/src/agent-manager/project/messages.ts
  • packages/kilo-vscode/tests/unit/agent-project-contexts.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/SectionHeader.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/SidebarSectionHeader.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/UnassignedSessionsSection.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/agent-manager.css
  • packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx

Fix these issues in Kilo Cloud

Previous review (commit 5f95cdc)

Status: 9 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 8
SUGGESTION 1

The shared SidebarSectionHeader refactor and expansion persistence are well structured, and the registry format/cache handling is careful. The main concerns: the section rename input lost its commit-on-blur, missing projects can now be activated via header click, the new role="button" wrapper hides nested controls from assistive tech, a pre-await context is used after the registry write, isExpanded() gained a state-poisoning side effect, and the new auto-restore loop amplifies an unhandled-rejection path and a per-project poller leak after panel close.

Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/SectionHeader.tsx 86 Rename input lost onBlur={commit} — clicking away leaves the section stuck in rename mode
packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx 99 Missing-but-trusted projects can now be selected/activated via header click
packages/kilo-vscode/webview-ui/agent-manager/SidebarSectionHeader.tsx 27 role="button" + aria-label wrapper hides nested interactive controls from assistive tech
packages/kilo-vscode/src/agent-manager/project/messages.ts 200 deps.expand(ctx) uses a context captured before the registry-write await (stale-context race)
packages/kilo-vscode/src/agent-manager/project/contexts.ts 144 isExpanded() side effect can cache false for the pinned project before active() applies its true fallback
packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts 1581 initExpanded promise has no rejection handler; new loop fires it automatically on every panel open
packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts 1576 Auto-restored projects' pollers are never stopped when the panel closes (background git polling leak)
packages/kilo-vscode/webview-ui/agent-manager/agent-manager.css 246 .am-section-header lost flex layout; SidebarSearchOpen story still uses it raw and the regenerated baseline baked in the degraded layout

SUGGESTION

File Line Issue
packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts 1578 Persisted-expanded but now-missing projects render a perpetual spinner until clicked
Files Reviewed (16 files)
  • .changeset/persist-project-accordion.md
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/sidebar-search-open-chromium-linux.png (LFS baseline)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts - 3 issues
  • packages/kilo-vscode/src/agent-manager/project/contexts.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/project/messages.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/project/registry.ts
  • packages/kilo-vscode/tests/unit/agent-manager-arch.test.ts
  • packages/kilo-vscode/tests/unit/agent-project-contexts.test.ts
  • packages/kilo-vscode/tests/unit/agent-project-messages.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectSidebarBody.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/SectionHeader.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/SidebarBody.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/SidebarSectionHeader.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/UnassignedSessionsSection.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/agent-manager.css - 1 issue

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 18.2K · Output: 10K · Cached: 223.1K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode force-pushed the toggle-multi-project-header-collapse-persistence branch from 5f95cdc to cf4a8f2 Compare August 4, 2026 09:35
Comment thread packages/kilo-vscode/webview-ui/agent-manager/ProjectsSection.tsx
}
const expanded = !project().expanded
props.onExpand(project().id, expanded)
if (!project().active && project().trusted && !project().missing) props.onSelect(project().id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With this wiring, it seems that an expanded inactive project gets collapsed when being selected. Worth checking.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

image Thats actually the point of the PR. Selection itself on project level does't fully make sense. Therefore a click on the project header in multi project mode will expand the project.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Previously it only expanded when clicking on the little icon.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it, thanks for the explanation

@marius-kilocode
marius-kilocode merged commit 5117a9f into main Aug 4, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the toggle-multi-project-header-collapse-persistence branch August 4, 2026 12:53
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…header-collapse-persistence

feat(agent-manager): align and persist collapsible headers
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