Repository navigation
Per-phase agent assignment in run plans (prd-role-foundations Phase 4) - #106
Merged
suprie merged 3 commits intoOct 8, 2026
Merged
Conversation
RunPhase gains assigned_agent_id/assigned_agent_name (serde-default optional, pre-assignment plans load unchanged); create_run_plan takes a sparse PhaseAgentAssignment payload validated against the roster with the name captured at queue time; the plan-tonight wizard adds a per-phase agent picker. The executor's next_queued_batch splits the combined turn at staffing changes, spawns each batch through resolve_agent_config_by_id (default agent when unassigned, parks the batch when the roster entry is missing), and runs pre-flight interviews with the phase's agent. The run report carries assigned_agent_name into a new morning-report Agent column. Deterministic two-phase dev/QA demo in role_assignment_tests.rs proves per-role charter injection and report attribution. Rubric: PASS — 3/3 criteria
suprie
marked this pull request as ready for review
October 8, 2026 08:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per-phase agent assignment end to end (
prd-role-foundationsPhase 4): run-plan phases can be staffed with a specific roster agent at queue time, the run-queue executor spawns each staffing batch with that agent's resolved config and charter, and the morning report attributes each phase to its role. Unassigned phases keep running on the default agent, so pre-assignment plans load and execute unchanged.What changed
runplan.rs—RunPhase.assigned_agent_id/assigned_agent_name(serde-default optional; pre-assignmentrun-plan.yamlfiles load unchanged), newPhaseAgentAssignmentpayload struct,PhaseReportEntry.assigned_agent_namefilled inRunReport::from_plancommands/run_queue.rs—create_run_planvalidates the sparse assignments payload against the roster and captures the roster name at queue time;next_queued_batchsplits the combined turn at staffing changes;execute_runresolves assigned batches viaresolve_agent_config_by_id(parks the batch when the roster entry is missing, blocks dependents), spawns throughstart_fresh_and_record_streaming_in_root_with_config; pre-flight interviews run with the phase's agentrun_executor.rs—build_run_planstaffs phases from assignments (+2 tests)role_assignment_tests.rs(new) — deterministic two-phase dev/QA demo: staffing split, per-role charter argv capture via the fake-binary harness, report attributionDev/QA; unassigned-phase and unknown-agent casesPlanTonightWizard.tsx— per-phase "runs with" agent picker; sparse assignment payload intocreateRunPlan; consent summary shows the agentMorningReportTab.tsx— new Agent column (assigned_agent_name ?? "default")types/index.ts,lib/tauri.ts— typed IPC surface for assignments.loopdeck/decisions/loops updatedPRD
docs/epics/role-based-orchestration/prd-role-foundations.md
Decisions
Test plan
cd src-tauri && cargo testcd src-tauri && cargo clippy -- -D warningsnpm test(npm run test:frontend)npx tsc --noEmitVerify Verdict
PRD Verification — prd-role-foundations.md
Verdict: PASS
role-foundations/phase-assignment-modelAdd assigned-agent fields to RunPhase and the create_run_plan selection surfacesrc-tauri/src/runplan.rs:156,162—pub assigned_agent_id: Option<String>/pub assigned_agent_name: Option<String>(serde-default optional, pre-assignment plans load unchanged);src-tauri/src/runplan.rs:169—pub struct PhaseAgentAssignment;src-tauri/src/commands/run_queue.rs:437,466-490—create_run_plantakesassignments, resolves each against the roster (find_agent_config), rejects unknown ids, captures the roster name;src/components/detail/PlanTonightWizard.tsx:123,191-194,219— per-phaseagentByPhasepicker, sparseassignmentsFromSelection()intocreateRunPlan;src/types/index.ts+src/lib/tauri.ts— typed IPC surfacerole-foundations/phase-assignment-execMake the run-queue executor spawn each phase with its assigned agent instead of the default configsrc-tauri/src/commands/run_queue.rs:1178-1198—next_queued_batchreturns the maximal prefix sharing oneassigned_agent_id(staffing change splits the combined turn);run_queue.rs:1277-1304—execute_runresolvesresolve_agent_config_by_idfor assigned batches, default config when unassigned, spawns viastart_fresh_and_record_streaming_in_root_with_config;run_queue.rs:1624— missing roster entry parks the batch (assigned agent "…" is not on the roster) and blocks dependents instead of failing silently;run_queue.rs:1397-1409— interviews run with the lead phase's agentrole-foundations/role-demoRun an end-to-end two-phase plan where a dev-role agent builds and a QA-role agent verifies, with per-role attribution in the run reportsrc-tauri/src/role_assignment_tests.rs:79—two_phase_role_demo_attributes_each_phase_to_its_role: queues a dev/QA-staffed plan, asserts the staffing split (Some(vec![0])), spawns each batch throughresolve_agent_config_by_id+spawn_fresh_with_configwith the fake-binary harness capturing argv, asserts each child saw only its own persona, and readsRunReport::from_planattributionSome("Dev")/Some("QA"); report field atsrc-tauri/src/runplan.rs:267,306; surfaced insrc/components/detail/MorningReportTab.tsx:153(Agent column). Deterministic harness per the run's pre-answered clarification — ran ascargo test --lib(669 passed, 0 failed)Non-goals audit
Roll-up: PASS — 0 FAIL, 0 PARTIAL, 3 PASS.
Run metadata
role-foundations/phase-assignment-model— "Add assigned-agent fields to RunPhase and the create_run_plan selection surface" (role-based-orchestration / prd-role-foundations / Phase 4)role-foundations/phase-assignment-exec— "Make the run-queue executor spawn each phase with its assigned agent instead of the default config" (role-based-orchestration / prd-role-foundations / Phase 4)role-foundations/role-demo— "Run an end-to-end two-phase plan where a dev-role agent builds and a QA-role agent verifies, with per-role attribution in the run report" (role-based-orchestration / prd-role-foundations / Phase 4)