Skip to content

Agents view: architect-aware group-by axis (VSCode)#1106

Merged
amrmelsayed merged 29 commits into
mainfrom
builder/pir-1104
Jun 28, 2026
Merged

Agents view: architect-aware group-by axis (VSCode)#1106
amrmelsayed merged 29 commits into
mainfrom
builder/pir-1104

Conversation

@amrmelsayed

@amrmelsayed amrmelsayed commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

PIR Review: Agents view — architect-aware grouping (VSCode)

Fixes #1104

Summary

Renames the VSCode sidebar Builders view to Agents and makes architect→builder ownership visible by adding architect as a third group-by axis alongside stage and area (builders are grouped by exactly one axis at a time). The owning architect roster is plumbed onto /api/overview so the conversational Codev: Add Architect action can route through main. Note: the implementation pivoted at the dev-approval gate from the issue's originally-proposed nested architect tier to a flat 3-way toggle — the reviewer found the flat axis cleaner (no duplication with Workspace > Architects, no single-architect collapse awkwardness, and childless architects vanish for free).

Files Changed

(git diff --stat against the merge-base; excludes the porch status.yaml/thread bookkeeping)

  • codev/plans/1104-vscode-merge-architects-builde.md (+267) — plan
  • codev/state/pir-1104_thread.md (+102) — builder thread
  • packages/types/src/api.ts (+12) — OverviewData.architects: ArchitectState[]
  • packages/codev/src/agent-farm/servers/tower-routes.ts (+/-72) — shared liveArchitects helper, /api/overview enrichment
  • packages/codev/src/agent-farm/servers/overview.ts (+/-6) — architects: [] default
  • packages/codev/src/agent-farm/__tests__/tower-routes.test.ts (+42) — overview-roster tests
  • packages/dashboard/__tests__/{useOverview.stability,useSSE.reconnect}.test.ts (+1 each) — mock architects: []
  • packages/vscode/package.json (+/-111) — view id rename, group-by commands + toolbar button, octopus icon, settings/labels
  • packages/vscode/icons/architect{,-light,-dark}.svg (new) — octopus glyph (monochrome light/dark pair)
  • packages/vscode/src/views/builder-grouping.ts (+/-48) — architectGrouping() strategy
  • packages/vscode/src/views/builders.ts (+/-35) — flat single-level grouping (nested tier removed)
  • packages/vscode/src/views/builder-tree-item.ts — drop ArchitectGroupTreeItem
  • packages/vscode/src/commands/add-architect.ts (new, +35) — conversational Add Architect helpers
  • packages/vscode/src/extension.ts (+/-90) — group-by cycle commands, Add Architect rewrite, view-id wiring
  • packages/vscode/README.md (+/-14) — Builders → Agents
  • vscode tests: builder-grouping, add-architect, extension-architect-commands, contributes-panel, menu-when-clauses

Commits

git log main..HEAD --oneline (squash-free; the development history shows the dev-gate pivot):

  • b7e738f2 Enrich /api/overview with the architect roster (shared collectArchitects)
  • 08346c61 Add adaptive architect tier to the Agents tree (later retired)
  • cc4bc4d4 Conversational Add Architect + rename Builders view to Agents
  • b5bfce2f Fix Agents view title flipping back to 'Builders' on data load
  • c8f3ad87 / c014bf3c Sweep user-facing 'Builders' labels to 'Agents' (settings + README)
  • ae035b61 Rename collectArchitects -> liveArchitects (live-session reader)
  • 1ec60502 Pivot to flat 3-way group-by toggle, retire nested tier
  • 8e7821e8 Name the active axis in the title (later reverted)
  • acaba08b Single cycling toolbar button (icon = current axis)
  • 189e0f7f Present-tense titles, render first, drop redundant direct commands
  • 9b4f88e3 Group-by button shows the NEXT axis (action), not current
  • 85cc8f21 Drop the bogus 'Unassigned' architect group

Test Results

  • pnpm build (core + codev + dashboard): ✓ pass
  • pnpm --filter @cluesmith/codev test: ✓ 3375 pass / 48 skipped
  • codev-vscode check-types ✓, lint ✓, test:unit ✓ 512 pass
  • codev-dashboard test: ✓ 322 pass / 1 skipped
  • Manual verification (human, at dev-approval gate): Agents view in a multi-architect workspace; the single group-by toolbar button cycling stage → area → architect with the icon reflecting the next axis; the octopus icon at row size on light + dark; group headers correctly showing stage names / area labels / architect names per axis.

Architecture Updates

COLD codev/resources/arch.md — added one bullet to the VS Code Extension design decisions ("Agents view + group-by axes (#1104)"): the view-id rename (codev.builderscodev.agents, user-facing only), the three group-by strategies, the architect axis semantics (null → main, childless absent), and the additive /api/overview architects field built by the shared liveArchitects helper (distinct from state.ts's persisted getArchitects). No HOT arch-critical.md change — this is feature/reference detail, not an always-inject system-shape invariant; module boundaries are unchanged (the extension stays a thin client; the Tower API gained one additive field).

Lessons Learned Updates

COLD codev/resources/lessons-learned.md (UI/UX) — two [From #1104] entries:

  1. VS Code toolbar buttons have no pressed/selected state (no toggled in the menu schema; icon is fixed to the command) — express one-of-N selection with a single button whose icon reflects state via show/hide commands, make it an action (show the next state), and let view content be the primary "what am I looking at" signal.
  2. Custom tree-row SVGs render at 16px — author/verify at that size (rasterize on light+dark), and ship a monochrome light/dark pair (theme-foreground colors), not a hardcoded brand color, since tree iconPath SVGs aren't theme-tinted.

No HOT lessons-critical.md change — both are VS-Code-specific recipes, not high-blast-radius cross-cutting rules.

Things to Look At During PR Review

  • The dev-gate pivot. The approved plan describes a nested architect tier; the shipped code is a flat 3-way grouping axis. Commit 1ec60502 is the pivot. The nested-tier code (ArchitectGroupTreeItem, partitionByArchitect, the adaptive architectCount gate) was fully removed, so review builders.ts / builder-grouping.ts against the flat model, not the plan.
  • liveArchitects vs getArchitects. tower-routes.ts's liveArchitects (live terminal-session set) is intentionally distinct from state.ts's getArchitects (persisted table). The /api/overview enrichment reuses the exact helper the dashboard-state path uses so the two payloads can't drift — confirm the extraction is byte-equivalent to the former inline loop.
  • /api/overview is the only remaining consumer of the roster enrichment (via Add Architect's resolveMainArchitect). The nested tier that originally also consumed it is gone; the enrichment is retained deliberately for Add Architect, not dead code.
  • No toggled (it isn't a real menu property). The group-by button is one of three show/hide cycle commands; verify the when-clauses cover the unset-context-key case (!codev.buildersGroupBy → stage).
  • Null-owner folds into main in architectGrouping — confirm that matches the affinity router's fallback and that there's no user-visible "Unassigned" group.

Consultation (CMAP iter-1)

Single advisory pass (PIR max_iterations: 1): codex = REQUEST_CHANGES, claude = COMMENT. Full verdicts in codev/projects/1104-*/1104-review-iter1-*.txt; dispositions in 1104-review-iter1-rebuttals.md.

How to Test Locally

  • View diff: VSCode sidebar → right-click builder pir-1104Review Diff
  • Run dev server: afx dev pir-1104 (or sidebar → Run Dev Server)
  • What to verify:
    • Agents view renders; the group-by button is the leftmost toolbar item, its icon = the next axis, clicking cycles stage → area → architect.
    • In architect mode, group headers are architect names; a builder whose owner isn't running still appears under main.
    • Single-architect workspace: architect mode shows one group (e.g. MAIN); no "Unassigned".
    • Codev: Add Architect with main running → request lands in main's terminal; with main absent → modal pointing at the CLI fallback.
    • Octopus icon legible at row size in both light and dark themes.

…reader, distinct from persisted getArchitects)
…), retire nested tier

- Replace the nested architect tier with an architectGrouping() strategy: builders
  group by exactly one axis at a time. Childless architects produce no group and
  vanish from the work view (full roster stays in Workspace > Architects).
- Three Agents title-bar buttons (Stage/Area/Architect) with toggled clauses so the
  active axis renders pressed. Octopus SVG (theme light/dark pair) is the Architect
  button icon.
- Remove ArchitectGroupTreeItem, partitionByArchitect/architectBadge, the adaptive
  architectCount gate, and the description badge.
…rrent axis)

VS Code menus have no 'toggled'/pressed state (verified against the schema), and a
toolbar action's icon is fixed to its command. So show the active grouping with one
button whose icon IS the current axis (milestone/tag/octopus), swapped via three
show/hide agentsCycleGroupFrom* commands; clicking advances to the next axis. The
direct groupBuildersBy* commands stay for palette/keybindings.
… redundant direct commands

- Titles use present tense 'Group by X' (was 'Grouped by X'), no '(click to change)'.
- Grouping button rendered first in the Agents toolbar (navigation@1; refresh/
  collapse/file-tree pushed to @2/@3/@4).
- Drop the redundant direct groupBuildersBy* commands (they duplicated the cycle
  commands' titles and were palette-only); the cycle button is the single grouping
  affordance.
…rent one

The button is an action ('click to group by X'), so each shows the icon + title of
the axis clicking will apply: grouped by architect → button reads 'Group by Stage'.
The current grouping is read from the tree (group headers).
Every builder is spawned with an owner (afx spawn defaults to 'main'), so there's
no such thing as an unassigned builder. A null spawnedByArchitect is only a
data-integrity edge (missing/legacy state.db row); fold it into the main group,
matching the affinity router's fallback. Removes UNASSIGNED_ARCHITECT.
… doc fixes

- Fix (codex REQUEST_CHANGES #5): handleOverview no-workspace branch now emits all
  required OverviewData collection fields (recentlyClosed/architects) empty, honoring
  the 'never undefined' contract; regression assertion added.
- Fix (claude COMMENT): README Agents description rewritten for the flat group-by axis
  (was describing the retired nested tier); buildersGroupBy setting description no longer
  references a nonexistent 'pressed' button state.
- Rebut: flat-axis/childless-absent/view-id-rename/no-Agents-+ are deliberate dev-gate
  decisions (see rebuttals doc).
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.

vscode: Agents view with a 3-way group-by axis (stage / area / architect) + conversational Add Architect

1 participant