🎼 Finalize conductor-score for production release #2
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: 🎼 Conductor Health Check | |
| on: | |
| schedule: | |
| # Run every 30 minutes during work hours (9 AM - 6 PM UTC) | |
| - cron: '*/30 9-18 * * 1-5' | |
| workflow_dispatch: | |
| push: | |
| branches: [ main, master ] | |
| paths: | |
| - '.conductor/**' | |
| - 'examples/**' | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| health-check: | |
| name: System Health Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install pyyaml | |
| - name: Validate configuration | |
| run: | | |
| python .conductor/scripts/validate-config.py | |
| - name: Check system dependencies | |
| run: | | |
| python .conductor/scripts/dependency-check.py | |
| - name: Run health check | |
| run: | | |
| python .conductor/scripts/health-check.py | |
| - name: Update system status | |
| run: | | |
| python .conductor/scripts/update-status.py | |
| - name: Generate status summary | |
| run: | | |
| python .conductor/scripts/generate-summary.py > $GITHUB_STEP_SUMMARY | |
| - name: Clean up stale work | |
| run: | | |
| python .conductor/scripts/cleanup-stale.py | |
| - name: Archive completed tasks | |
| run: | | |
| python .conductor/scripts/archive-completed.py --max-age 7 | |
| - name: Check for critical issues | |
| id: critical_check | |
| run: | | |
| # Check if there are any critical system issues | |
| CRITICAL_ISSUES=0 | |
| # Check for high number of stale agents | |
| STALE_COUNT=$(python .conductor/scripts/health-check.py --json | jq -r '.stale_agents // 0' 2>/dev/null || echo "0") | |
| if [ "$STALE_COUNT" -gt 5 ]; then | |
| echo "⚠️ High stale agent count: $STALE_COUNT" | |
| CRITICAL_ISSUES=1 | |
| fi | |
| # Check system health score | |
| HEALTH_SCORE=$(python .conductor/scripts/update-status.py --json | jq -r '.health_score // 0' 2>/dev/null || echo "0") | |
| if (( $(echo "$HEALTH_SCORE < 0.5" | bc -l) )); then | |
| echo "⚠️ Low health score: $HEALTH_SCORE" | |
| CRITICAL_ISSUES=1 | |
| fi | |
| echo "critical_issues=$CRITICAL_ISSUES" >> $GITHUB_OUTPUT | |
| - name: Create issue for critical problems | |
| if: steps.critical_check.outputs.critical_issues == '1' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const title = '🚨 Conductor System Health Alert'; | |
| const body = ` | |
| ## 🎼 System Health Alert | |
| The automated health check has detected critical issues with the Conductor-Score system. | |
| ### Issues Detected | |
| - High number of stale agents | |
| - Low system health score | |
| - Potential system performance degradation | |
| ### Recommended Actions | |
| 1. Review stale agent cleanup: \`python .conductor/scripts/cleanup-stale.py\` | |
| 2. Check system status: \`python .conductor/scripts/update-status.py\` | |
| 3. Validate configuration: \`python .conductor/scripts/validate-config.py\` | |
| 4. Review recent activity logs | |
| ### System Status | |
| Generated by: ${context.workflow} #${context.runNumber} | |
| Timestamp: ${new Date().toISOString()} | |
| _This issue was created automatically by the health monitoring system._ | |
| `; | |
| // Check if similar issue already exists | |
| const existingIssues = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| labels: 'conductor:alert', | |
| state: 'open' | |
| }); | |
| if (existingIssues.data.length === 0) { | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| body: body, | |
| labels: ['conductor:alert', 'priority:high'] | |
| }); | |
| } | |
| process-new-tasks: | |
| name: Process New GitHub Issues | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install pyyaml | |
| - name: Install GitHub CLI | |
| run: | | |
| gh auth status || echo "GitHub CLI not authenticated" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Process conductor:task issues | |
| run: | | |
| # Get all open issues with conductor:task label | |
| gh issue list --label "conductor:task" --state open --json number,title | \ | |
| jq -r '.[] | .number' | \ | |
| while read issue_number; do | |
| echo "Processing issue #$issue_number" | |
| python .conductor/scripts/issue-to-task.py --issue-number "$issue_number" || true | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| workspace-maintenance: | |
| name: Workspace Maintenance | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install pyyaml | |
| - name: Clean up old worktrees | |
| run: | | |
| python .conductor/scripts/cleanup-worktrees.py --max-age 24 | |
| - name: Archive old completed work | |
| run: | | |
| python .conductor/scripts/archive-completed.py --max-age 30 | |
| - name: Update system metrics | |
| run: | | |
| python .conductor/scripts/update-status.py | |
| - name: Generate maintenance summary | |
| run: | | |
| echo "## 🧹 Workspace Maintenance Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- Cleaned up stale worktrees" >> $GITHUB_STEP_SUMMARY | |
| echo "- Archived completed tasks older than 30 days" >> $GITHUB_STEP_SUMMARY | |
| echo "- Updated system status metrics" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "_Maintenance completed at $(date)_" >> $GITHUB_STEP_SUMMARY |