Skip to content

🤖 feat: sub-agent sidebar hierarchy (connector lines + completed expansion)#2836

Merged
jaaydenh merged 14 commits intomainfrom
agent-ui-5pxx
Mar 9, 2026
Merged

🤖 feat: sub-agent sidebar hierarchy (connector lines + completed expansion)#2836
jaaydenh merged 14 commits intomainfrom
agent-ui-5pxx

Conversation

@jaaydenh
Copy link
Copy Markdown
Contributor

@jaaydenh jaaydenh commented Mar 7, 2026

Summary

Redesigns the sidebar to visualize sub-agent parent/child hierarchy with connector lines, renames the row component from WorkspaceListItem to AgentListItem, retains completed sub-agents in config for optional sidebar expansion, and adds comprehensive test/story coverage.

Background

The sidebar row component was named WorkspaceListItem despite representing agent tasks. Sub-agent relationships were invisible — completed sub-agents were auto-deleted, and there were no visual connectors showing hierarchy. This PR addresses all three gaps:

  1. Rename: aligns component naming with the agent-centric UI model
  2. Connector lines: makes parent/child relationships visually clear
  3. Completed sub-agent expansion: lets users review task lineage without cluttering the default view

Implementation

Rename (WorkspaceListItemAgentListItem)

  • git mv preserves file history; all exports/types/imports updated (9+ files)
  • Pure mechanical rename with zero logic changes

Connector metadata utilities

  • New AgentRowRenderMeta type with connectorPosition ("single" / "middle" / "last"), rowKind, and completed-child visibility info
  • filterVisibleAgentRows() hides reported children unless parent is expanded
  • computeAgentRowRenderMeta() computes per-row connector shapes from sibling positions
  • 6 unit tests covering all connector/visibility scenarios

Backend: retain reported sub-agents

  • cleanupReportedLeafTask no longer removes workspace metadata from config (runtime/worktree cleanup still happens)
  • getWorkspaceSidebarKey now includes taskStatus so status transitions trigger sidebar re-renders

Connector line rendering

  • New SubAgentListItem.tsx wraps rows with positioned connector geometry (vertical trunk + horizontal elbow)
  • AgentListItem dispatches to SubAgentListItem for sub-agent rows, passes render metadata
  • Parent rows with hidden completed children show a chevron expand/collapse control

ProjectSidebar integration

  • Uses filterVisibleAgentRows() + computeAgentRowRenderMeta() in the render pipeline
  • Per-parent expansion state persisted via usePersistedState("expandedCompletedSubAgents")

Validation

  • make static-check passes (lint, fmt, typecheck, docs link check)
  • New UI integration test (tests/ui/workspaces/subagents.test.ts) verifies completed children hidden by default, shown on expand, hidden on collapse
  • taskService.test.ts updated — 71 tests pass with new retention behavior
  • workspaceFiltering.test.ts — 6 new metadata tests pass
  • 7 new Storybook stories cover all connector states (middle/last/single, selected, with status text, parent collapsed/expanded)

Risks

  • Retained reported sub-agents accumulate: mitigated by hiding them behind per-parent expand control; follow-up can add explicit cleanup action if needed
  • Connector visual alignment: covered by Storybook stories for single-line and two-line row variants at each connector position

Generated with mux • Model: anthropic:claude-opus-4-6 • Thinking: xhigh • Cost: $21.58

jaaydenh added 7 commits March 7, 2026 08:59
Add a UI integration test covering completed child sub-agent visibility in the sidebar.

The test seeds a parent workspace with active and reported child workspaces and verifies:
- reported children are hidden by default
- parent expansion reveals reported children
- collapsing hides reported children again
@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 7, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de5100cda5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/taskService.ts Outdated
Comment thread src/node/services/taskService.ts Outdated
@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 7, 2026

@codex review

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 7, 2026

@codex review

Addressed both P1 and P2 feedback:

  • P1: Reported task runtimes (worktree/branch) are no longer deleted — they stay intact since these tasks remain visible and selectable in the sidebar.
  • P2: Restored the ancestor walk-up logic so parent tasks are correctly re-evaluated after their children become reported.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 7, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65d7ae1d35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 8, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65d7ae1d35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 8, 2026

@codex review

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 8, 2026

@codex review

Addressed the age-tier issues and resolved the related review threads. Please take another look.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 8, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d783b70c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
@jaaydenh jaaydenh self-assigned this Mar 9, 2026
@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Mar 9, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh jaaydenh added this pull request to the merge queue Mar 9, 2026
Merged via the queue into main with commit 0f49410 Mar 9, 2026
23 checks passed
@jaaydenh jaaydenh deleted the agent-ui-5pxx branch March 9, 2026 06:51
ammario pushed a commit that referenced this pull request Mar 10, 2026
Summary
- restore automatic cleanup for completed sub-agent workspaces instead
of retaining them in the sidebar indefinitely
- keep the patch-artifact safety gate so exec-style sub-agents still
finish artifact generation before deletion
- preserve the interrupted+reportedAt self-heal so stale completed rows
can still be recognized and pruned

Background
PR #2836 intentionally kept completed sub-agents around for optional
sidebar expansion. That was an undue UX consideration in practice: once
a sub-agent had finished, or had already produced a completed report
before later showing as `interrupted`, it could stick around forever
unless the user manually deleted it. Sub-agents used to disappear when
they were no longer in use, and this restores that behavior.

Implementation
- restore structural-leaf cleanup in
`TaskService.cleanupReportedLeafTask()` so completed descendants are
deleted again
- require ancestors to have no remaining child task nodes before they
can be auto-deleted, which avoids orphaning siblings while still
allowing cleanup to cascade upward once the last child is gone
- keep the restart/patch-artifact recheck path so exec and exec-derived
tasks still generate their patch artifacts before cleanup resumes
- update task-service regressions to cover immediate cleanup,
cleanup-after-patch, upward cascade, and interrupted+reportedAt deletion

Validation
- `bun test src/node/services/taskService.test.ts`
- `make static-check`

Risks
- Users lose the ability to browse completed sub-agent lineage from the
sidebar once cleanup runs. That is the intended tradeoff here: the prior
retention behavior regressed the default UX by leaving stale sub-agents
around indefinitely.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` •
Cost: `$1.05`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=1.05 -->
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.

1 participant