Skip to content

Add member categorization#238

Open
MLastAirBender wants to merge 6 commits into
Apra-Labs:mainfrom
MLastAirBender:feature/categorization
Open

Add member categorization#238
MLastAirBender wants to merge 6 commits into
Apra-Labs:mainfrom
MLastAirBender:feature/categorization

Conversation

@MLastAirBender
Copy link
Copy Markdown

1. Core Data Model Updates

  • src/types.ts: Expanded the Agent interface to include an optional category string field. This allows every fleet member to be
    assigned to a logical group (e.g., "production", "testing", "gpu-nodes").
  • Merge Integrity: Successfully integrated the new category field alongside the recently added unattended execution mode from
    the upstream repository, ensuring no loss of functionality from either feature.

2. Member Management Enhancements

  • register_member: Added a new category parameter to the registration schema. Members can now be categorized at the moment they
    are added to the fleet.
  • update_member: Added support for modifying or clearing the category field for existing members.
  • list_members: Updated the listing tool to display the category for each member, improving the administrative overview of the
    fleet.

3. Smart Status Rendering (check_status)

  • Categorized Grouping: The fleet_status output now groups members by their category. This makes large fleets much easier to
    navigate by separating different types of workers.
  • Status Chips: Redesigned the "compact" status line to show category-based groups with emoji status chips (e.g., [cloud]: 🟢
    worker-1(idle)).
  • Upstream Integration: Merged the categorization logic with the new "Update Notice" system. The status output now
    simultaneously shows your custom groups and alerts you if a new version of apra-fleet is available.

4. Infrastructure & Sync

  • Upstream Sync: Synchronized the codebase with over 90 files from the main repository, including new providers, security
    hardening, and performance improvements.
  • Statusline Updates: Enhanced src/services/statusline.ts to be more robust when handling state changes across different member
    types.

Technical Impact: These changes improve the scalability of the fleet CLI by allowing users to organize and monitor large numbers
of members through logical grouping, without breaking compatibility with new upstream security and automation features.

@kumaakh
Copy link
Copy Markdown
Contributor

kumaakh commented May 5, 2026

Code Review — fleet-rev

Overall

The PR adds an optional category field to fleet members and uses it to group output in fleet_status, list_members, and the statusline. Approach is sound — a few issues worth addressing.


Correctness

1. Whitespace-only category silently stored (update-member.ts:123)

updates.category = input.category || undefined;

" " is truthy so it gets stored as-is, but the display side trims it → shows as (uncategorized) while the DB value is non-empty whitespace. Fix: trim before the falsy check:

updates.category = input.category.trim() || undefined;

2. Fragile index-based join in check-status.ts:219

const rowsWithCategory = rows.map((r, i) => ({ ...r, category: agents[i].category ?? null }));

Relies on rows and agents being the same length and order. Any future filtering on rows would silently miscategorize members. Attach category when the row is first built, not retroactively by index.

3. Multi-line statusline — new code joins category groups with \n. If Claude Code's status bar reads only the first line, all categories after the first are invisible. Needs verification.


Edge Cases

4. Category ordering is insertion-order (no sort). Users might expect alphabetical. Consider sorting Map keys, or at minimum putting (uncategorized) last.


Security

No issues. category is bounded (.max(64)), optional, display-only.


Tests

None added. Missing at minimum: whitespace-clearing behaviour on update, grouped output format in list_members/fleet_status, and category presence in JSON output.


Code Quality

5. Duplicated group-by-category logic across statusline.ts, check-status.ts, and list-members.ts. Extract a shared helper:

function groupByCategory<T>(items: T[], getCategory: (item: T) => string): Map<string, T[]>

6. Unrelated package-lock.json changes"peer": true added to several packages (express, hono, zod, vite, etc.). Looks like an npm version difference, not intentional. Should be explained or reverted.


Summary

Priority Item
Fix Trim whitespace on category before storage
Fix Verify multi-line statusline renders in Claude Code status bar
Should have Add unit tests (update, list, status)
Nice to have Extract shared groupByCategory helper
Cleanup Explain or revert unrelated package-lock.json peer changes

MLastAirBender and others added 5 commits May 5, 2026 11:17
Resolves conflict in check-status.ts: kept category grouping from feature
branch and log= display from main. Category also attached to AgentStatusRow
at build time (not retroactively by index) as part of conflict resolution.
…e restore

- Add groupByCategory<T> helper to agent-helpers.ts; refactor check-status,
  list-members, and statusline to use it (eliminates duplicated group-and-sort logic)
- Add 13 tests: whitespace-clear on update, category grouping in fleet_status
  and list_members (compact + JSON), uncategorized placement, whitespace handling
- Restore package.json and package-lock.json from main (reverts unrelated
  version downgrade and peer:true additions introduced by merge base mismatch)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keep both lastLlmActivityAt (stall detector, re-added in main) and
category (this PR) in the Agent interface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kumaakh added a commit that referenced this pull request May 29, 2026
* docs: revise roadmap -- promote SSE/dashboard/docker to near-term, A2A to medium-term, remove Codex/Copilot, fix encoding

* docs: remove Cursor/Windsurf integration guide from roadmap

* docs: improve session log export roadmap item

* docs: fold cost dashboard into web dashboard item

* docs: add memory plane integration to near-term, move expanded targets to medium-term

* docs: demote member groups/tags to bottom of medium-term

* docs: adjust timeframes, promote Fleet-as-a-Service and multi-fleet-federation to top of long-term

* docs: revise roadmap based on discussions analysis -- add playbooks, PM lifecycle, extension layer, discussion links, fix misrepresentations

* docs: remove result aggregation, link member groups/tags to PR #238

* docs: move member groups/tags to near-term (PR already open)

* docs: link open PRs and issues into roadmap, add multiple providers and Slack notifications

* docs: add DeepWiki codebase wiki link to README and FAQ

* chore: remove docs/site folder

---------

Co-authored-by: Bot <bot@apra-fleet.dev>
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.

3 participants