Skip to content

feat: org chart sidebar section + pane with agent management - #115

Merged
aterrylu merged 1 commit into
mainfrom
terry/orgchart-v2
Apr 8, 2026
Merged

feat: org chart sidebar section + pane with agent management#115
aterrylu merged 1 commit into
mainfrom
terry/orgchart-v2

Conversation

@aterrylu

@aterrylu aterrylu commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Org Chart as sidebar section: Replaced the AGENTS/ORG CHART tab bar with clickable section headers. "ORG CHART" opens the card-based hierarchy panel as a pane on the right (same as clicking a session opens its terminal).
  • New pane type: Added "orgchart" to ActivePane union, renders in SessionMountLayer, shows in tab bar — integrates fully with the existing split-pane/tab system.
  • Stopped agent management: Toggle to show/hide stopped agents (eye icon in AGENTS header). Remove with confirmation in both sidebar (inline confirm) and org chart cards (overlay with trash icon).

Key design decisions

  • Org chart is a singleton pane (fixed ID "orgchart") — only one can exist, openOrgChart uses findLeafByPaneId to switch to existing tab instead of creating duplicates
  • Exited sessions stored separately from live sessions to avoid broken terminal WebSocket reconnect loops
  • removeSession throws on failure (not silent swallow) — callers keep confirmation UI open so user knows it failed
  • UI labels say "stopped" consistently (not "exited")

Files changed

File Change
store.ts ActivePane type, openOrgChart/removeSession/toggleShowExitedAgents actions, exitedSessions state
Sidebar.tsx Remove tab bar, add section headers, stopped agent toggle + remove
HierarchyPanel.tsx Remove panel header, add trash overlay + confirm on cards, include exited sessions in status map
SessionMountLayer.tsx Render HierarchyPanel in pane slot
TabBar.tsx Handle orgchart tab title
Codicon.tsx Add eye, eye-closed, trash icons

Test plan

  • make check passes (lint + types + 63 tests)
  • Click "ORG CHART" → opens hierarchy panel as pane on right
  • Click session → switches away; click "ORG CHART" → switches back
  • Tab bar shows "Org Chart" with close button
  • Eye icon toggles stopped agents in sidebar
  • Trash icon on stopped agent → "remove" / "cancel" confirmation
  • Org chart card hover → trash overlay → confirm → removes agent
  • Removing running agent kills first, then permanently deletes

🤖 Generated with Claude Code

- Replace AGENTS/ORG CHART tab bar with clickable section headers
- ORG CHART header opens card-based HierarchyPanel as a pane on the right
- Add "orgchart" as a new ActivePane type in the pane/layout system
- Org chart pane renders in SessionMountLayer, appears in TabBar
- Add show/hide toggle for stopped agents in sidebar (eye icon)
- Add permanent remove with confirmation for stopped agents (sidebar + org chart cards)
- Org chart cards show trash overlay on hover with kill+remove confirmation
- Include exited sessions in org chart status resolution
- Fix: prevent duplicate orgchart tabs via findLeafByPaneId guard
- Fix: removeSession throws on failure instead of silent swallow
- Fix: handleRemove has loading guard and keeps confirm open on failure
- Fix: fetchSessions compares exited session IDs, not just length
- Align terminology: "stopped" instead of "exited" in all UI labels

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aterrylu
aterrylu marked this pull request as ready for review April 8, 2026 09:32
@aterrylu
aterrylu merged commit 97cb0d5 into main Apr 8, 2026
1 check passed
@aterrylu
aterrylu deleted the terry/orgchart-v2 branch April 8, 2026 09:36
const agentStatus: AgentStatus = info?.agentStatus ?? "stopped";
const isRunning = info != null && info.session.status !== "stopped";
const isRunning =
info != null &&

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.

🟡 Warning

Problem: In AgentCard's handleRemove, the isRunning variable is captured at component render time. If killSession succeeds and the store's polling cycle updates session.status to 'exited' before removeSession completes, the component re-renders with isRunning = false. This can cause the confirmation overlay to visually disappear while removeSession is still in-flight — confusing UX.

Why it matters: The user may see the confirm overlay vanish or the agent appear as stopped mid-operation.

Suggested fix: Re-check session status inside handleRemove rather than relying on the render-time const:

const agentStatus: AgentStatus = info?.agentStatus ?? "stopped";
const isRunning = info != null && info.session.status !== "stopped";
const isRunning =
info != null &&

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.

Suggested fix: Capture running status at click time instead of render time:

if (!(e.currentTarget as HTMLElement).draggable)
e.preventDefault();
}}
draggable

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.

🟡 Silent error feedback in exited-agent removal

Problem: In Sidebar.tsx, when removeSession(s.id) fails, the catch block silently swallows the error — confirmRemoveId stays set (keeping dialog visible) but the user gets no error message. If the backend returns a non-OK status (e.g. 404 session already gone, 500 server error), the user sees no indication what went wrong.

Why it matters: The confirm dialog staying open is a decent signal something went wrong, but without a visible error message the user may click Remove repeatedly or assume the UI is broken.

Suggested fix:

onClick={async () => {
  try {
    await removeSession(s.id);
    setConfirmRemoveId(null);
  } catch {
    // Keep confirm visible + surface a transient error message
    // e.g. setErrorId(s.id) to show "Failed to remove agent" inline
  }
}}

Alternative (minimal): At minimum, log to console with the session ID so it's debuggable: console.error('[Sidebar] removeSession failed for', s.id).

@nox-0x nox-0x 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.

Overall solid implementation. The org chart as a pane, exited session separation, and singleton pane pattern are all well-designed. Two non-blocking UX issues flagged in comments: (1) isRunning captured at render time in handleRemove creating a potential mid-operation visual inconsistency, (2) silent error swallowing in Sidebar removeSession without user-visible feedback. Both are minor — fix before merge or track as follow-up.

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