Skip to content

feat(core): Phase G — hierarchical subgraphs, role catalog, TaskNodeKind#511

Merged
mmogr merged 1 commit into
epic/orchestratorfrom
feat/orchestrator-phase-g
May 23, 2026
Merged

feat(core): Phase G — hierarchical subgraphs, role catalog, TaskNodeKind#511
mmogr merged 1 commit into
epic/orchestratorfrom
feat/orchestrator-phase-g

Conversation

@mmogr
Copy link
Copy Markdown
Owner

@mmogr mmogr commented May 23, 2026

Summary

Implements Phase G of the v2 orchestrator architecture (closes #508): hierarchical task decomposition via TaskNodeKind::Team { subgraph }, a built-in role catalog, and team lifecycle SSE events.


Changes

gglib-core — domain types

role_catalog.rs (new)

  • RoleId newtype (pub struct RoleId(pub String)) with new(), as_str(), Display, Serialize/Deserialize
  • RoleSpec — display name, system prompt fragment, default tool allowlist, suggested temperature, requires_approval flag
  • RoleCatalogHashMap<RoleId, RoleSpec> with Default impl populating 7 built-in specialist roles: researcher, red-team, fact-checker, writer, editor, critic, synthesizer

task_graph.rs

  • New TaskNodeKind enum: Leaf (default) | Team { subgraph: Box<TaskGraph> } — serde snake_case, #[serde(default)] on the field for backward compat
  • MAX_NODES / MAX_DEPTH docs clarified as per-subgraph limits
  • MAX_TOTAL_NODES = 32 soft aggregate budget (not enforced yet — Phase H)
  • TaskNode.role: Option<RoleId> — specialist role assignment
  • validate_acyclic() recurses into Team subgraphs
  • TaskGraph::total_node_count() — recursive aggregate count

events.rs

  • TeamStarted { team_id, role: Option<RoleId> } — emitted before team subgraph begins
  • TeamSynthesized { team_id, compacted_output } — emitted when team subgraph completes

mod.rs

  • pub mod role_catalog added
  • Re-exports: RoleCatalog, RoleId, RoleSpec, TaskNodeKind, MAX_TOTAL_NODES

Caller updates

  • gglib-agent/orchestrator/director.rsTaskNode construction gains kind: TaskNodeKind::Leaf, role: None
  • gglib-agent/orchestrator/executor.rsmake_node() test helper updated
  • gglib-proxy/src/orchestrator_proxy.rs — new event variants added to exhaustive match
  • gglib-cli/src/handlers/orchestrate.rsrender_event() handles TeamStarted/TeamSynthesized
  • gglib-proxy/tests/integration_virtual_models.rstest_graph() helper updated

Test fixtures

  • tests/fixtures/orchestrator/phase_f_baseline.json — Phase F regression fixture (flat graph without kind/role fields; verifies backward-compat deserialization)

Tests

  • 25 unit tests pass (cargo test -p gglib-core)
  • All doc-tests pass (cargo test --doc -p gglib-core)
  • cargo clippy --all-targets -- -D warnings — clean
  • ./scripts/check_boundaries.sh — all PASS

Issue

Closes #508

…ted/TeamSynthesized events

- Add RoleId newtype + RoleSpec + RoleCatalog with 7 built-in specialist roles
  (researcher, red-team, fact-checker, writer, editor, critic, synthesizer)
- Add TaskNodeKind enum (Leaf | Team { subgraph }) with serde + Box for recursion
- Add role: Option<RoleId> field to TaskNode
- Add MAX_TOTAL_NODES = 32 (soft aggregate budget)
- Extend validate_acyclic() to recurse into Team subgraphs
- Add TaskGraph::total_node_count() for aggregate node counting
- Add TeamStarted / TeamSynthesized variants to OrchestratorEvent
- Update mod.rs to re-export all new public items
- Fix TaskNode construction in director.rs, executor.rs, proxy test
- Handle new event variants in orchestrator_proxy.rs and CLI render_event
- Add phase_f_baseline.json fixture for backward-compat deserialization test
- All unit tests + doc-tests pass; clippy clean; boundaries pass
@mmogr mmogr added epic:orchestrator phase:g area:backend type: feature New functionality or enhancement priority: high Important for next release size: l 1-3 days component: core gglib-core domain logic arch: domain Core domain model changes status: ready Ready to work on labels May 23, 2026
@mmogr mmogr self-assigned this May 23, 2026
@mmogr mmogr linked an issue May 23, 2026 that may be closed by this pull request
7 tasks
@mmogr mmogr merged commit cfc2f48 into epic/orchestrator May 23, 2026
@mmogr mmogr deleted the feat/orchestrator-phase-g branch May 23, 2026 03:10
@mmogr mmogr mentioned this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch: domain Core domain model changes area:backend component: core gglib-core domain logic epic:orchestrator phase:g priority: high Important for next release size: l 1-3 days status: ready Ready to work on type: feature New functionality or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Phase G] Domain Foundation: Subgraphs + Role Catalog

1 participant