feat: Implement phases 3-5 of compositional workflow architecture

Completes the implementation of test/review workflows with automatic resolution
and integrates them into the orchestrator.

**Phase 3: Test Workflow with Resolution**
- Created test_workflow.py with automatic test failure resolution
- Implements retry loop with max 4 attempts (configurable via MAX_TEST_RETRY_ATTEMPTS)
- Parses JSON test results and resolves failures one by one
- Uses existing test.md and resolve_failed_test.md commands
- Added run_tests() and resolve_test_failure() to workflow_operations.py

**Phase 4: Review Workflow with Resolution**
- Created review_workflow.py with automatic blocker issue resolution
- Implements retry loop with max 3 attempts (configurable via MAX_REVIEW_RETRY_ATTEMPTS)
- Categorizes issues by severity (blocker/tech_debt/skippable)
- Only blocks on blocker issues - tech_debt and skippable allowed to pass
- Created review_runner.md and resolve_failed_review.md commands
- Added run_review() and resolve_review_issue() to workflow_operations.py
- Supports screenshot capture for UI review (configurable via ENABLE_SCREENSHOT_CAPTURE)

**Phase 5: Compositional Integration**
- Updated workflow_orchestrator.py to integrate test and review phases
- Test phase runs between commit and PR creation (if ENABLE_TEST_PHASE=true)
- Review phase runs after tests (if ENABLE_REVIEW_PHASE=true)
- Both phases are optional and controlled by config flags
- Step history tracks test and review execution results
- Proper error handling and logging for all phases

**Supporting Changes**
- Updated agent_names.py to add REVIEWER constant
- Added configuration flags to config.py for test/review phases
- All new code follows structured logging patterns
- Maintains compatibility with existing workflow steps

**Files Changed**: 19 files, 3035+ lines
- New: test_workflow.py, review_workflow.py, review commands
- Modified: orchestrator, workflow_operations, agent_names, config
- Phases 1-2 files (worktree, state, port allocation) also staged

The implementation is complete and ready for testing. All phases now support
parallel execution via worktree isolation with deterministic port allocation.
This commit is contained in:
Rasmus Widing
2025-10-08 22:23:49 +03:00
parent 9a60d6ae89
commit 1c0020946b
19 changed files with 3046 additions and 6 deletions

View File

@@ -0,0 +1,46 @@
# Resolve Failed Review Issue
Fix a specific blocker issue identified during the review phase.
## Arguments
1. review_issue_json: JSON string containing the review issue to fix
## Instructions
1. **Parse Review Issue**
- Extract issue_title, issue_description, issue_severity, and affected_files from the JSON
- Ensure this is a "blocker" severity issue (tech_debt and skippable are not resolved here)
2. **Understand the Issue**
- Read the issue description carefully
- Review the affected files listed
- If a spec file was referenced in the original review, re-read relevant sections
3. **Create Fix Plan**
- Determine what changes are needed to resolve the issue
- Identify all files that need to be modified
- Plan minimal, targeted changes
4. **Implement the Fix**
- Make only the changes necessary to resolve this specific issue
- Ensure code quality and consistency
- Follow project conventions and patterns
- Do not make unrelated changes
5. **Verify the Fix**
- Re-run relevant tests if applicable
- Check that the issue is actually resolved
- Ensure no new issues were introduced
## Review Issue Input
$ARGUMENT_1
## Report
Provide a concise summary of:
- Root cause of the blocker issue
- Specific changes made to resolve it
- Files modified
- Confirmation that the issue is resolved

View File

@@ -0,0 +1,101 @@
# Review Implementation Against Specification
Compare the current implementation against the specification file and identify any issues that need to be addressed before creating a pull request.
## Variables
REVIEW_TIMEOUT: 10 minutes
## Arguments
1. spec_file_path: Path to the specification file (e.g., "PRPs/specs/my-feature.md")
2. work_order_id: The work order ID for context
## Instructions
1. **Read the Specification**
- Read the specification file at `$ARGUMENT_1`
- Understand all requirements, acceptance criteria, and deliverables
- Note any specific constraints or implementation details
2. **Analyze Current Implementation**
- Review the code changes made in the current branch
- Check if all files mentioned in the spec have been created/modified
- Verify implementation matches the spec requirements
3. **Capture Screenshots** (if applicable)
- If the feature includes UI components:
- Start the application if needed
- Take screenshots of key UI flows
- Save screenshots to `screenshots/wo-$ARGUMENT_2/` directory
- If no UI: skip this step
4. **Compare Implementation vs Specification**
- Identify any missing features or incomplete implementations
- Check for deviations from the spec
- Verify all acceptance criteria are met
- Look for potential bugs or issues
5. **Categorize Issues by Severity**
- **blocker**: Must be fixed before PR (breaks functionality, missing critical features)
- **tech_debt**: Should be fixed but can be addressed later
- **skippable**: Nice-to-have, documentation improvements, minor polish
6. **Generate Review Report**
- Return ONLY the JSON object as specified below
- Do not include any additional text, explanations, or markdown formatting
- List all issues found, even if none are blockers
## Report
Return ONLY a valid JSON object with the following structure:
```json
{
"review_passed": boolean,
"review_issues": [
{
"issue_title": "string",
"issue_description": "string",
"issue_severity": "blocker|tech_debt|skippable",
"affected_files": ["string"],
"screenshots": ["string"]
}
],
"screenshots": ["string"]
}
```
### Field Descriptions
- `review_passed`: true if no blocker issues found, false otherwise
- `review_issues`: Array of all issues found (blockers, tech_debt, skippable)
- `issue_severity`: Must be one of: "blocker", "tech_debt", "skippable"
- `affected_files`: List of file paths that need changes to fix this issue
- `screenshots`: List of screenshot file paths for this specific issue (if applicable)
- `screenshots` (root level): List of all screenshot paths taken during review
### Example Output
```json
{
"review_passed": false,
"review_issues": [
{
"issue_title": "Missing error handling in API endpoint",
"issue_description": "The /api/work-orders endpoint doesn't handle invalid repository URLs. The spec requires validation with clear error messages.",
"issue_severity": "blocker",
"affected_files": ["python/src/agent_work_orders/api/routes.py"],
"screenshots": []
},
{
"issue_title": "Incomplete test coverage",
"issue_description": "Only 60% test coverage achieved, spec requires >80%",
"issue_severity": "tech_debt",
"affected_files": ["python/tests/agent_work_orders/"],
"screenshots": []
}
],
"screenshots": []
}
```