feat(agents): role-keyed dispatch + default rename (boss→code-lead, foreman→architect) #686

Merged
charles merged 1 commit from boss/670 into main 2026-05-01 21:01:26 +00:00
Collaborator

Role-keyed dispatch refactor + default rename per WIZ-prereq-A. Every hardcoded type === "X" site that drives dispatch now routes through resolveAgentByRole(role) / typeForRole(role); default type names rename to code-lead (was boss) and architect (was foreman).

  • New helpers: resolveAgentByRole, typeForRole, roleForType in webhook-config (host-mode-safe).
  • Refactored sites: post-ci.ts:332, slash-commands.ts:87, deps.ts:155-186, pipeline.ts:60+74+79+92+289-295, board.ts:106, completion-proof.ts:277+284, db.ts:602+943+977, janitor.ts:289, main.ts:3358.
  • One-shot DB migration renames legacy boss-* / foreman-* rows in place; idempotent.
  • Skills + docs rewritten (zero \bboss\b|\bforeman\b in /skills); docs/foreman.mddocs/architect.md. /foreman/* chat URLs preserved for stability.
  • Web display strings + queryKeys flipped (["foreman", ...]["architect", ...]); cache invalidations re-checked.

Operator migration (one-shot, after deploy)

  1. Create Forgejo users code-lead + architect; mint PATs.
  2. Set FORGEJO_TOKEN_CODE_LEAD + FORGEJO_TOKEN_ARCHITECT env vars (or seed via /secrets).
  3. Move ~/.config/claude-hooks/agent-env/{boss,foreman}.../{code-lead,architect}; same for tokens/.
  4. Restart. DB migrate runs in place.

Test plan

  • bun x turbo run typecheck — clean.
  • bun test (server) — 2976 pass / 0 fail. New unit coverage for resolveAgentByRole, typeForRole, roleForType.
  • suggestAssignee returns { role: "code-lead" } for architecture-touching tickets.
  • git grep -E '\bboss\b|\bforeman\b' skills/ returns zero hits.
  • Biome lint + format clean (workspace-wide).
  • Operator: dispatch loop on a fixture repo end-to-end after deploy migration.

Closes #670

Role-keyed dispatch refactor + default rename per WIZ-prereq-A. Every hardcoded `type === "X"` site that drives dispatch now routes through `resolveAgentByRole(role)` / `typeForRole(role)`; default type names rename to `code-lead` (was boss) and `architect` (was foreman). - New helpers: `resolveAgentByRole`, `typeForRole`, `roleForType` in webhook-config (host-mode-safe). - Refactored sites: `post-ci.ts:332`, `slash-commands.ts:87`, `deps.ts:155-186`, `pipeline.ts:60+74+79+92+289-295`, `board.ts:106`, `completion-proof.ts:277+284`, `db.ts:602+943+977`, `janitor.ts:289`, `main.ts:3358`. - One-shot DB migration renames legacy `boss-*` / `foreman-*` rows in place; idempotent. - Skills + docs rewritten (zero `\bboss\b|\bforeman\b` in /skills); `docs/foreman.md` → `docs/architect.md`. `/foreman/*` chat URLs preserved for stability. - Web display strings + queryKeys flipped (`["foreman", ...]` → `["architect", ...]`); cache invalidations re-checked. ## Operator migration (one-shot, after deploy) 1. Create Forgejo users `code-lead` + `architect`; mint PATs. 2. Set `FORGEJO_TOKEN_CODE_LEAD` + `FORGEJO_TOKEN_ARCHITECT` env vars (or seed via `/secrets`). 3. Move `~/.config/claude-hooks/agent-env/{boss,foreman}` → `.../{code-lead,architect}`; same for `tokens/`. 4. Restart. DB migrate runs in place. ## Test plan - [x] `bun x turbo run typecheck` — clean. - [x] `bun test` (server) — 2976 pass / 0 fail. New unit coverage for `resolveAgentByRole`, `typeForRole`, `roleForType`. - [x] `suggestAssignee` returns `{ role: "code-lead" }` for architecture-touching tickets. - [x] `git grep -E '\bboss\b|\bforeman\b' skills/` returns zero hits. - [x] Biome lint + format clean (workspace-wide). - [ ] Operator: dispatch loop on a fixture repo end-to-end after deploy migration. Closes #670
feat(agents): role-keyed dispatch refactor + default type rename (#670)
All checks were successful
qa / dockerfile (pull_request) Successful in 5s
qa / qa (pull_request) Successful in 3m7s
98112e1e2f
Add `code-lead` to the role enum, introduce role-keyed resolver helpers,
and route every hardcoded `type === "X"` dispatch site through them. Apply
the default rename: `boss` → `code-lead` and `foreman` → `architect` (with
matching git_author + container path updates).

Refactored sites (per spec §Architecture):
- post-ci.ts MERGE_AGENT_TYPE → MERGE_ROLE = "code-lead"
- slash-commands.ts breakdown dispatch → resolveAgentByRole("code-lead")
- deps.ts suggestAssignee returns { role }; propagator resolves at leaf
- pipeline.ts stage rollup keyed by role (with baked-default fallback)
- board.ts AGENT_ROLE_RULES + per-type override for reviewer-security
- completion-proof.ts COMPLETION_PROOF_RULES_BY_ROLE
- db.ts host-mode flag declared by caller via is_host_mode
- janitor.ts + main.ts design-reviewer resolution via typeForRole
- agentRoleSchema + AGENT_ROLES extended with code-lead

New helpers in webhook-config.ts:
- resolveAgentByRole(role) — host-mode-safe role-to-instance resolver
- typeForRole(role) — first registered type carrying the role
- roleForType(name) — read declared role for a known type

Migration (one-shot, idempotent): migrateForLegacyTypeRenames() promotes
existing `boss-*` agent rows to `code-lead-*` and `foreman-*` to
`architect-*` on first boot post-#670 — runs before ensureDefaultForTypes
so a fleet doesn't end up with both old + new instances.

Skills + docs: every prose mention of "boss" / "foreman" rewritten;
docs/foreman.md renamed to docs/architect.md. Skills now have zero
\bboss\b|\bforeman\b matches. /foreman/* chat URLs preserved for stability.

Web app: display strings + TanStack queryKeys (`["foreman", ...]` →
`["architect", ...]`) updated; cache invalidations re-checked.

Tests: 2976 pass / 0 fail. New unit coverage for resolveAgentByRole,
typeForRole, roleForType. The deps.ts heuristic tests now assert against
{ role } shape per AC.

Operator migration steps (one-shot, after deploy):
1. Create Forgejo users `code-lead` and `architect`; mint PATs.
2. Set env vars FORGEJO_TOKEN_CODE_LEAD + FORGEJO_TOKEN_ARCHITECT (or
   seed via /secrets).
3. Move ~/.config/claude-hooks/agent-env/{boss,foreman} →
   .../{code-lead,architect}; same for tokens/.
4. Restart the service. The DB migration renames in-place; old PATs can
   be deleted after verification.

Closes #670

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
reviewer approved these changes 2026-05-01 20:46:33 +00:00
reviewer left a comment

Role-keyed dispatch + rename correct end-to-end. DB migration idempotent, host-mode safety rail preserved, B10 dual-path fallback handles no-config fixtures, dispatchMerge dispatches via agent.type not the old literal. CI green.

Role-keyed dispatch + rename correct end-to-end. DB migration idempotent, host-mode safety rail preserved, B10 dual-path fallback handles no-config fixtures, `dispatchMerge` dispatches via `agent.type` not the old literal. CI green.
code-lead force-pushed boss/670 from 98112e1e2f
All checks were successful
qa / dockerfile (pull_request) Successful in 5s
qa / qa (pull_request) Successful in 3m7s
to 47a846b17d
All checks were successful
qa / dockerfile (pull_request) Successful in 6s
qa / qa (pull_request) Successful in 3m34s
2026-05-01 20:55:05 +00:00
Compare
charles deleted branch boss/670 2026-05-01 21:01:26 +00:00
Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!686
No description provided.