AR-2 — BreakdownRulesSection for architect-specific Routing fields #1202

Closed
opened 2026-05-15 12:40:50 +00:00 by architect · 1 comment
Collaborator

Why

Architect owns four fields no other type has:

  • example_prompts: string[] — quick-start chips in the chat UI
  • label_rules: Array<{ pattern, exclude_pattern?, label }>/breakdown auto-labeller
  • assignee_rules: Array<{ when_label, assign_to }>/breakdown auto-assigner
  • default_assignee: string/breakdown fallback

Once #1201 lands, every other section in TypeEditorDrawer works for architect. The Routing section is the only odd one — its worker fields (routes_labels, reviews_authors, reviews_labels) are meaningless for a non-dispatchable type. Replace the body for architect with an editor for the four architect-specific fields above.

Goal

  • New BreakdownRulesSection component mounted in place of RoutingSection when editing architect.
  • All four fields editable, with autosave flowing through PUT /config/agents like every other section.

Acceptance criteria

  • New component apps/web/src/features/agents/sections/breakdown-rules-section.tsx. Exported from sections/index.ts.
  • Wired into SectionPane::sectionBody("Routing"): when typeName === "architect", render BreakdownRulesSection instead of RoutingSection.
  • Fields:
    • Example prompts<ChipInput> over config.example_prompts. Free-text chips, no suggestions, placeholder "Add a prompt…". Commit on Enter / comma.
    • Label rules — table with rows { pattern, exclude_pattern, label }. Pattern + Exclude are regex inputs with inline validation (try { new RegExp(value) } catch). Invalid → red border + caption "Invalid regex", row does not commit. Label is a single-chip input with repoLabels suggestions. [Add rule] appends an empty row; each row has a delete affordance.
    • Assignee rules — table with rows { when_label, assign_to }. when_label autocompletes from repoLabels; assign_to autocompletes from agentUsers. [Add rule] + per-row delete.
    • Default assignee — single-line autocomplete from agentUsers. Placeholder (default: dev).
  • All mutations flow through onChange({ ...config, <field>: nextValue }) to land in typesDraft → autosave → PUT /config/agents.
  • No role or dispatchable chips in the body — those fields are just normal enum/checkbox values post-#1199, edited (if at all) via Identity or via a generic Routing checkbox elsewhere.

Tests

  • New apps/web/src/features/agents/sections/breakdown-rules-section.test.tsx:
    • Editing example_prompts — type a prompt, press Enter, commit; remove a chip; assert the onChange payload.
    • Editing label_rules — add a rule, edit each column, assert the onChange payload. Invalid regex on pattern shows error caption and does not commit.
    • Editing assignee_rules — autocomplete from agentUsers, assert the onChange payload.
    • Editing default_assignee — autocomplete from agentUsers.
  • Roster integration test: open the architect drawer, expand Routing, edit a label rule, observe the autosave-debounced PUT /config/agents payload contains the new label_rules.
  • Worker regression: editing dev's Routing section still mounts the existing RoutingSection with routes_labels etc.

Out of scope

  • A /breakdown dry-run preview against existing repo labels (filed separately if useful).
  • Server-side schema validation of regex patterns (already covered by agents-config-schema.ts).

References

  • apps/server/src/shared/config/agents-default-config.ts::architect — factory shape of the four fields.
  • apps/server/src/shared/config/agents-config-schema.ts — existing zod schema.
  • apps/web/src/components/chip-input.tsx — reuse for chip / autocomplete inputs.
  • apps/web/src/features/agents/sections/routing-section.tsx — sibling component; branch lives next to it in section-pane.tsx.

Depends on

#1201 — without it, this surface isn't reachable from the operator's normal flow.

Tracker

#1203

## Why Architect owns four fields no other type has: - `example_prompts: string[]` — quick-start chips in the chat UI - `label_rules: Array<{ pattern, exclude_pattern?, label }>` — `/breakdown` auto-labeller - `assignee_rules: Array<{ when_label, assign_to }>` — `/breakdown` auto-assigner - `default_assignee: string` — `/breakdown` fallback Once #1201 lands, every other section in `TypeEditorDrawer` works for architect. The Routing section is the only odd one — its worker fields (`routes_labels`, `reviews_authors`, `reviews_labels`) are meaningless for a non-dispatchable type. Replace the body for architect with an editor for the four architect-specific fields above. ## Goal - New `BreakdownRulesSection` component mounted in place of `RoutingSection` when editing architect. - All four fields editable, with autosave flowing through `PUT /config/agents` like every other section. ## Acceptance criteria - [ ] New component `apps/web/src/features/agents/sections/breakdown-rules-section.tsx`. Exported from `sections/index.ts`. - [ ] Wired into `SectionPane::sectionBody("Routing")`: when `typeName === "architect"`, render `BreakdownRulesSection` instead of `RoutingSection`. - [ ] Fields: - **Example prompts** — `<ChipInput>` over `config.example_prompts`. Free-text chips, no suggestions, placeholder `"Add a prompt…"`. Commit on Enter / comma. - **Label rules** — table with rows `{ pattern, exclude_pattern, label }`. Pattern + Exclude are regex inputs with inline validation (`try { new RegExp(value) } catch`). Invalid → red border + caption "Invalid regex", row does not commit. Label is a single-chip input with `repoLabels` suggestions. `[Add rule]` appends an empty row; each row has a delete affordance. - **Assignee rules** — table with rows `{ when_label, assign_to }`. `when_label` autocompletes from `repoLabels`; `assign_to` autocompletes from `agentUsers`. `[Add rule]` + per-row delete. - **Default assignee** — single-line autocomplete from `agentUsers`. Placeholder `(default: dev)`. - [ ] All mutations flow through `onChange({ ...config, <field>: nextValue })` to land in `typesDraft` → autosave → `PUT /config/agents`. - [ ] No `role` or `dispatchable` chips in the body — those fields are just normal enum/checkbox values post-#1199, edited (if at all) via Identity or via a generic Routing checkbox elsewhere. ## Tests - [ ] New `apps/web/src/features/agents/sections/breakdown-rules-section.test.tsx`: - Editing `example_prompts` — type a prompt, press Enter, commit; remove a chip; assert the `onChange` payload. - Editing `label_rules` — add a rule, edit each column, assert the `onChange` payload. Invalid regex on `pattern` shows error caption and does not commit. - Editing `assignee_rules` — autocomplete from `agentUsers`, assert the `onChange` payload. - Editing `default_assignee` — autocomplete from `agentUsers`. - [ ] Roster integration test: open the architect drawer, expand Routing, edit a label rule, observe the autosave-debounced `PUT /config/agents` payload contains the new `label_rules`. - [ ] Worker regression: editing `dev`'s Routing section still mounts the existing `RoutingSection` with `routes_labels` etc. ## Out of scope - A `/breakdown` dry-run preview against existing repo labels (filed separately if useful). - Server-side schema validation of regex patterns (already covered by `agents-config-schema.ts`). ## References - `apps/server/src/shared/config/agents-default-config.ts::architect` — factory shape of the four fields. - `apps/server/src/shared/config/agents-config-schema.ts` — existing zod schema. - `apps/web/src/components/chip-input.tsx` — reuse for chip / autocomplete inputs. - `apps/web/src/features/agents/sections/routing-section.tsx` — sibling component; branch lives next to it in `section-pane.tsx`. ## Depends on #1201 — without it, this surface isn't reachable from the operator's normal flow. ## Tracker #1203
Collaborator

🦵 @charles kicked the queue — re-running implement on @code-lead.

🦵 @charles kicked the queue — re-running implement on @code-lead.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
charles/agent-hooks#1202
No description provided.