Skip to content

[PG-3] Command Implementations - #10

Merged
PolyphonyRequiem merged 9 commits into
mainfrom
feature/2583-pg-3
May 1, 2026
Merged

[PG-3] Command Implementations#10
PolyphonyRequiem merged 9 commits into
mainfrom
feature/2583-pg-3

Conversation

@PolyphonyRequiem

@PolyphonyRequiem PolyphonyRequiem commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the conductor SDLC implementation orchestration layer: four workflow YAMLs and eight PowerShell scripts that drive the PG-level task loop, PR lifecycle, and scope close-out.

Workflows Added

  • implement-pg.yaml — Single PG lifecycle: branch creation → task loop (coder → reducer → reviewer) → dependency gate → issue review → PR submission → platform PR sub-workflow → scope close-out
  • ** wig-sdlc-v2-implement.yaml** — Implementation orchestration entry point: preflight, work tree load, and parallel PG dispatch via \ or_each\
  • github-pr.yaml — GitHub PR lifecycle sub-workflow: Opus 1M reviewer, Sonnet fixer loop (max 10 iterations per P7), and merger agent
  • �do-pr.yaml — ADO PR lifecycle stub: structured error + human gate for manual PR management

Scripts Added

\scripts/:

  • \dependency-check.ps1\ — checks whether PG dependencies are all merged; outputs \status, \�locked,
    eady_count, \ otal_count\
  • \dependency-check.Tests.ps1\ — Pester tests for dependency-check.ps1

\ ests/:

  • \lint-ado-pr.ps1\ / \lint-ado-pr.Tests.ps1\ — CI lint for ado-pr.yaml interface contract
  • \lint-github-pr.ps1\ / \lint-github-pr.Tests.ps1\ — CI lint for github-pr.yaml interface contract
  • \lint-implement-pg.ps1\ / \lint-implement-pg.Tests.ps1\ — CI lint for implement-pg.yaml structural requirements

Work Items

  • AB#2749
  • AB#2750
  • AB#2751
  • AB#2752
  • AB#2754
  • AB#2755
  • AB#2758
  • AB#2759

Test Coverage

  • 53 Pester tests, all passing
  • Interface contract validation for ado-pr.yaml and github-pr.yaml
  • Structural requirement lint for implement-pg.yaml (15 checks including agent models, route targets, gate options)
  • dependency-check.ps1 unit tests with blocked/not-blocked/partial scenarios

Validation

  • \Invoke-Pester -Path tests/\ — 53/53 passed (65/66 total; 1 pre-existing failure in lint-apex-routing unrelated to this PG)

Daniel Green and others added 9 commits April 30, 2026 15:28
…gger AB#2750

- Create implement-pg.yaml with full PG lifecycle:
  pg_router → branch_manager → task_router → coder → reducer_code →
  task_reviewer → task_completer loop, dependency_check with human gate
  (wait/override/reassign), issue-level review, user acceptance gate,
  platform-routed PR lifecycle (github-pr/ado-pr), and scope_closer
- Create dependency-check.ps1 script checking ADO predecessor links
- Add 8 Pester tests for dependency-check.ps1 covering:
  no predecessors, all complete, blocked, error handling, output shape
- conductor validate passes with 17 agents, 2 human gates

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…anual PR management AB#2752

Create workflows/ado-pr.yaml as a platform-specific PR lifecycle stub for
Azure DevOps. Implements the same interface contract as github-pr.yaml
(inputs: pr_number, branch_name, target_branch, review_policy; outputs:
merged, pr_url) enabling platform selection via process-config.yaml.

- ado_pr_error script node emits structured ADO_PR_NOT_IMPLEMENTED error
- ado_pr_manual_gate human gate offers Merged/Abort options for manual PR mgmt
- Add lint-ado-pr.ps1 validating interface contract, error code, and gate
- Add lint-ado-pr.Tests.ps1 with 8 Pester tests (contract, edge cases)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…x 10), and merger agent AB#2751

- pr_reviewer: Opus 1M agent for thorough code review via gh api
- review_counter: Script node tracking fix iterations (max 10 per P7)
- pr_fixer: Sonnet agent for targeted code fixes from review feedback
- pr_fix_exhausted_gate: Human gate when loop exhausts (P7: fail honestly)
- review_counter_reset: Counter reset when human chooses to continue
- pr_merger: Sonnet agent for squash merge via gh pr merge
- Interface contract matches ado-pr.yaml (pr_number, branch_name,
  target_branch, review_policy -> merged, pr_url)
- Added lint-github-pr.ps1 and lint-github-pr.Tests.ps1 (10 tests)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tree, and pg_dispatcher for_each AB#2749

Scaffold the implementation orchestration sub-workflow referenced by
twig-sdlc-v2-full.yaml. The workflow contains 7 agents:

- preflight_lite: lightweight 3-check validation (reuses preflight-lite.ps1)
- preflight_lite_gate: human gate with retry/abort on preflight failure
- load_work_tree: loads hierarchy and PG structure via load-work-tree.ps1
- pg_dispatcher: transforms pending PGs into structured array for dispatch
- pg_execution_group: for_each dispatching implement-pg.yaml per PG
  (max_concurrent=3, failure_mode=fail_fast)
- pg_summary_gate: human gate for partial PG failures with retry re-entry

Re-entry safe (P3): retry routes back to load_work_tree which re-discovers
state, skipping already-completed PGs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nment AB#2759

- Document that gate only fires for items with actual predecessor links
- Add P3 re-entry semantics: dependency_check auto-clears resolved blocks
- Enrich gate prompt with re-entry guidance blockquote for users
- Align option descriptions with type-agnostic-sdlc plan document:
  Wait (blockers may resolve), Override (user accepts risk),
  Reassign (track externally)
- Tighten invariants: blocking_items is non-empty precondition
- Reference P6 (genuine decision) and P13 (Jinja2 Markdown) in comments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…del AB#2755

- Fix issue_reviewer model from Sonnet to Opus 1M (claude-opus-4-1m)
  per task spec requiring cross-cutting review with large context
- Add lint-implement-pg.ps1 validating structural requirements:
  workflow name, entry point, inputs, outputs, task loop agents,
  issue review agents, PR sub-workflows, dependency gate, scope closer
- Add lint-implement-pg.Tests.ps1 with 17 Pester tests covering
  production YAML validation and negative cases for each rule

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ps1 output AB#2758

- Add blocked (bool) field alongside existing status (string) for direct
  boolean consumption by callers
- Add ready_count and total_count fields tracking predecessor completion
- Use [ordered] hashtables for deterministic JSON field ordering
- Expand test suite from 8 to 18 tests covering: multiple blocked
  predecessors, Closed as terminal state, id-field fallback, unfetchable
  predecessor treated as blocking, output shape validation for new fields

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-implement.yaml AB#2754

- Add feature_branch as required input (was missing from contract)
- Update pg_dispatcher to use workflow.input.feature_branch instead of
  git rev-parse detection, ensuring consistent branch targeting
- Wrap output templates with Jinja2 is-defined guards for paths where
  load_work_tree or pg_execution_group may not execute
- conductor validate passes; no type-name literals

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add platform input to twig-sdlc-v2-implement.yaml and propagate to
  implement-pg via for_each input_mapping (was silently dropped)
- Guard implement-pg merged output with Jinja2 is-defined check so
  early-exit paths (dependency_gate Reassign, pg_router all_complete)
  return false instead of undefined reference error
- Add conditional routing from pr_lifecycle_github and pr_lifecycle_ado
  to scope_closer only when merged == true; route to \ on abort so
  ADO items are not incorrectly transitioned to Done after a cancelled PR

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PolyphonyRequiem
PolyphonyRequiem merged commit 26d385c into main May 1, 2026
@PolyphonyRequiem
PolyphonyRequiem deleted the feature/2583-pg-3 branch May 1, 2026 00:26
PolyphonyRequiem added a commit that referenced this pull request May 8, 2026
Bug #10 — second of three structural fixes from the iter-7/iter-8
audit chain. `worktree-manager.ps1 -Operation spawn` was already
directory-idempotent (no-op when the worktree path exists) but not
branch-idempotent: when a prior aborted run left the
`sdlc/apex/{id}` branch behind without the worktree directory,
`git worktree add -b` failed with "branch already exists" and
blocked every subsequent run until the operator manually deleted
the branch.

This is the smallest behavioural fix (option (a) from the issue):

When the worktree directory is absent and the local branch
exists, the script now:

1. Probes `git worktree list --porcelain` to determine whether the
   branch is already checked out by another worktree.
2. If yes → fails fast with new error_code `branch_in_use`. Two
   worktrees on the same branch would corrupt git state and the
   error message points at the live worktree path.
3. If no → attaches the worktree to the existing branch via
   `git worktree add` (no `-b`). Resume semantics: any in-flight
   commits on the branch are preserved.

The fresh-branch path (no local branch yet) is unchanged —
regression-guarded by a new test.

New error_codes (additive — existing routes still catch via M4):
- `branch_in_use`         (defensive: branch checked out elsewhere)
- `worktree_attach_failed` (existing-branch reuse path failure)

Tests: 4 new xUnit cases against a temp-git-repo fixture
(`TempGitRepo` IDisposable scaffold). Covers the reuse path, the
defensive guard, and the fresh-branch regression. Full suite
2839/2839 passes (was 2836; +3 from this PR). E2e Pester for
apex-driver still 56/56. Lint type-agnostic + psscriptroot clean.
`conductor validate apex-driver@polyphony` exits 0.

No YAML changes — script behaviour change only.

Closes #177.

Co-authored-by: Daniel Green <dangreen@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PolyphonyRequiem added a commit that referenced this pull request May 9, 2026
Wraps wave_dispatch_loop in an outer until-stable loop that re-runs
`polyphony worklist build` and re-dispatches per iteration, so
multi-facet items (e.g. plannable+implementable) traverse plan -> impl
in a single apex-driver invocation.

Outer loop:
  - Re-builds worklist after each wave (observers see post-merge state)
  - Tracks items_satisfied_count via apex-wave-dispatch.yaml output
  - Exit conditions (priority order):
    * All items item_satisfied -> apex_complete
    * Zero new dispatches AND not all satisfied -> apex_blocked
    * Hit max_dispatch_iterations cap (default 10) -> apex_iteration_cap
  - Updates close-out gate to emit truthful summary

Wave aggregation:
  - apex-wave-dispatch.yaml gains items_satisfied_count summed from
    dispatch_items.outputs[*].item_satisfied | bool
  - Hook: aggregate_renegotiation step

Tests:
  - 2-facet item walks plan -> impl in one apex-driver run
  - 3-facet item walks plan -> action -> impl
  - Iteration cap fires on synthetic renegotiation loop
  - Stability exit fires on genuinely-blocked items
  - All 14 workflow YAMLs bumped to v2.2.0 (workflow.version +
    metadata.min_polyphony_version aligned, lint-version-drift PASS)
  - tests/e2e-apex-driver.Tests.ps1 min_polyphony_version assertions
    updated to 2.2.0
  - verb-signature-contracts.Tests.ps1 updated for the new
    declare_root -> outer_loop_init -> build_worklist chain

Closes the closed-loop SDLC engine: state next-ready -> lifecycle router
-> corridors -> wave aggregation -> outer loop. Last code/YAML PR before
PR #10 (manual dogfood on apex 3043).

Co-authored-by: Daniel Green <dangreen@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PolyphonyRequiem added a commit that referenced this pull request May 20, 2026
…494)

First pass of the workflow-comments cleanup sweep. Targets two narrow,
verifiable categories of staleness — duplicate-paste and "deferred /
shipped in this PR" framing that no longer reflects what is on main.

implement-merge-group.yaml:

  1. Header lines 1-10 contained a 5-line copy-paste duplicate of the
     opening summary. Removed lines 6-10.

  2. Item 4 of "Transitional notes (TODO follow-up PRs)" claimed the
     ADO leg uses a human-gate stub pending the ADO MG verbs. Verified
     stale: PR #427 (ADO support across polyphony, commit f9d4aef)
     wired the real pr open-mg-ado and pr merge-mg-ado verbs into
     this same workflow at lines ~2191/2209/2253. Removed item 4.

  3. Item 3 (lock + manifest delegation to apex) is the permanent
     contract that lets parallel-MG execution work — not transitional
     scaffolding. Promoted it out of "Transitional notes" into a
     "Permanent design contract" section so future readers don't try
     to "complete" it.

  Items 1-2 (PG-N legacy tag dependency in branch next-impl / route /
  close-scope) are kept — verified still valid against
  src/Polyphony/Commands/BranchCommands.NextImpl.cs (operator-facing
  --pg-name / --pg-number flags still required) and BranchCommands.cs
  (close-scope verb still in place).

actionable.yaml:

  Header read as if the workflow YAML itself were a Phase 6 PR scaffold
  — "this PR", "Wiring landed in this PR (Phase 6 PR #5)", "PR #5 will
  wire in facet-profile context...". From main, "this PR" is ambiguous
  and the forward references are a snapshot of an in-flight stack.

  Reframed the header as a "History" log + a current-state description:
    - Phase 6 PR #4 (#136) scaffolded the executor router.
    - Phase 6 PR #5 (#142) wired facet-profile composition.
    - Phase 6 PR #7 (#139) added the evidence floor check.
    - Phase 6 PR #8 (deferred): full evidence_reviewer rubric.

  Verified each shipped commit via git log on the actionable.yaml path.
  PR #8 is the only one still pending; the placeholder reviewer rubric
  + TODO(p6-pr8) marker at �vidence_reviewer are unchanged.

  Workflow description: updated to drop the "Phase 6 PR #5 wires"
  framing in favour of the present-tense state.

Verification:
  - All 12 .conductor/registry/tests/lint-*.ps1 PASS
    (lint-actionable.ps1 explicitly checks "deferred-wiring TODOs
    present, shipped TODOs removed" — its rule #11/#11b for PR #5/#7
    "TODO MUST be absent" still holds; its rule #10 for PR #8 deferred
    marker still holds because we kept the in-line TODO(p6-pr8))
  - 513/513 .conductor/registry/tests Pester cases PASS

Co-authored-by: Daniel Green <dangreen@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant