Files
PaperClipAI/ui/src/components
b93527b632 fix(ui): sort the Reports to manager picker alphabetically (#23689)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Each agent can report to a manager agent. The user selects the
manager in the "Reports to" picker.
> - The picker shows candidate managers in directory order. This order
is not alphabetical.
> - When a company has many agents, the user cannot easily find a
specific agent in the list.
> - This pull request sorts the picker rows alphabetically by agent
name.
> - The benefit is that the user finds a manager faster, and the order
agrees with the sidebar.

## Linked Issues or Issue Description

**Is your feature request related to a problem?**
The "Reports to" picker on the agent profile lists agents in an
unpredictable order (for example: "Mac Coder", "Bug Bot", "Nibbler",
"CTO"). It is hard to find one agent in a long list.

**Describe the solution you'd like**
Sort the picker rows alphabetically by agent name. Ignore letter case.
Put "Agent 2" before "Agent 10".

**Describe alternatives you've considered**
Sorting the agent list in each caller. This change sorts inside the
shared `ReportsToPicker` component instead, so the agent profile and the
agent configuration form both get the same order.

## What Changed

- Added `reportsToPickerRows` to
`ui/src/components/ReportsToPicker.tsx`. It removes terminated and
excluded agents, then sorts the rows by name with `localeCompare`
(`sensitivity: "base"`, `numeric: true`).
- `ReportsToPicker` uses this function for its rows. "No manager" stays
at the top.
- The picker indexes `disabledAgentIds` in a `Set`. Before, it scanned
the array once per row.
- Added `ui/src/components/ReportsToPicker.test.ts` with unit tests for
the order and the filter.

## Verification

- `cd ui && npx vitest run src/components/ReportsToPicker.test.ts`: 2
tests pass.
- Red check: the same tests fail on the previous code.
- `npx tsc --noEmit -p ui/tsconfig.json` shows no errors in the changed
files.
- 1,000-agent test bounds the sort work with a throwing name-read
counter (per `rules/ui-render-cost.mdc`).
- Manual: ran the branch on a local dev server with 13 agents. The
"Reports to" picker showed: Agent 2, Agent 10, Bug Bot (Deprecated), CEO
Agent, CTO, Dickens, Engineer Agent, Fry (Codex), Mac Coder, nibbler,
Reviewie, Slow Query (GLM), Test Gardener (GLM).

## Risks

- Low risk. The change is UI-only and changes only the row order. Filter
and selection behavior do not change.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude
Code with tool use (shell, file edit) and image input.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 20:52:44 -08:00
..