Skip to content

Merge pull request #26 from ryanmac/fix-conductor-task-listing #42

Merge pull request #26 from ryanmac/fix-conductor-task-listing

Merge pull request #26 from ryanmac/fix-conductor-task-listing #42

Workflow file for this run

# 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/**'
issues:
types: [opened, edited, labeled, unlabeled, assigned, unassigned, closed, reopened]
issue_comment:
types: [created]
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: Setup GitHub CLI
run: |
echo "$GITHUB_TOKEN" | gh auth login --with-token || true
gh auth status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure required labels exist
run: |
# Create labels if they don't exist
labels=(
"conductor:task|0e8a16|Tasks for AI agents"
"conductor:status|1d76db|System status tracking"
"conductor:in-progress|fbca04|Task being worked on"
"conductor:blocked|d93f0b|Task is blocked"
"conductor:archived|c5def5|Completed and archived"
"conductor:alert|e11d21|System health alert"
"conductor:init|7057ff|Initialization task for discovery"
"effort:small|76d7c4|Small effort task"
"effort:medium|f39c12|Medium effort task"
"effort:large|e74c3c|Large effort task"
"priority:low|c5def5|Low priority"
"priority:medium|fbca04|Medium priority"
"priority:high|e11d21|High priority"
"priority:critical|b60205|Critical priority - urgent"
"skill:frontend|7057ff|Frontend development"
"skill:backend|008672|Backend development"
"skill:devops|0052cc|DevOps and infrastructure"
"skill:ml|ff6b6b|Machine learning"
)
for label_info in "${labels[@]}"; do
# Split on pipe characters
IFS='|' read -r name color description <<< "$label_info"
gh label list | grep -q "^${name}" || \
gh label create "${name}" --color "${color}" --description "${description}" || true
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate configuration
run: |
python .conductor/scripts/validate-config.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check system dependencies
run: |
python .conductor/scripts/dependency-check.py
env:
CONDUCTOR_GITHUB_TOKEN: ${{ secrets.CONDUCTOR_GITHUB_TOKEN }}
- name: Run health check
run: |
python .conductor/scripts/health-check.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update system status
run: |
python .conductor/scripts/update-status.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate status summary
run: |
python .conductor/scripts/generate-summary.py > $GITHUB_STEP_SUMMARY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up stale work
run: |
python .conductor/scripts/cleanup-stale.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive completed tasks
run: |
python .conductor/scripts/archive-completed.py --max-age 7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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=$(GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} 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=$(GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} 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 Code Conductor 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 == 'issues' || 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: Setup GitHub CLI
run: |
echo "$GITHUB_TOKEN" | gh auth login --with-token || true
gh auth status
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update system metrics
run: |
python .conductor/scripts/update-status.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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