spark-supervisor
Process supervisor and health monitor for sovereign daemons
Brought by drakestapleton
spark-supervisor / .github / workflows / sovereign-reviewer.yml
| 1 | name: Sovereign Gatekeeper & Automated Reviewer |
| 2 | |
| 3 | "on": |
| 4 | pull_request_target: |
| 5 | types: [opened, synchronize] |
| 6 | issues: |
| 7 | types: [opened] |
| 8 | issue_comment: |
| 9 | types: [created] |
| 10 | |
| 11 | permissions: |
| 12 | pull-requests: write |
| 13 | issues: write |
| 14 | contents: read |
| 15 | |
| 16 | jobs: |
| 17 | pr-reviewer: |
| 18 | if: github.event_name == 'pull_request_target' |
| 19 | runs-on: ubuntu-latest |
| 20 | steps: |
| 21 | - name: Checkout Repository |
| 22 | uses: actions/checkout@v4 |
| 23 | |
| 24 | - name: Checkout Sovereign Inquisitor Core |
| 25 | uses: actions/checkout@v4 |
| 26 | with: |
| 27 | repository: aien-dev/aien-sovereign-core |
| 28 | path: sovereign-core |
| 29 | |
| 30 | - name: Checkout Sibling Protocols Dependency |
| 31 | uses: actions/checkout@v4 |
| 32 | with: |
| 33 | repository: aien-dev/aien-protocols |
| 34 | path: aien-protocols |
| 35 | |
| 36 | - name: Build Sovereign Inquisitor |
| 37 | run: cargo build --release --manifest-path sovereign-core/Cargo.toml -p spark-inquisitor |
| 38 | |
| 39 | |
| 40 | - name: Fetch PR Diff |
| 41 | env: |
| 42 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 44 | run: | |
| 45 | gh pr diff "$PR_NUMBER" > pr.diff |
| 46 | |
| 47 | - name: Execute Sovereign Code Review |
| 48 | id: review |
| 49 | continue-on-error: true |
| 50 | env: |
| 51 | PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
| 52 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 53 | PR_TITLE: ${{ github.event.pull_request.title }} |
| 54 | run: | |
| 55 | ./sovereign-core/target/release/spark-inquisitor review \ |
| 56 | --author "$PR_AUTHOR" \ |
| 57 | --pr "$PR_NUMBER" \ |
| 58 | --title "$PR_TITLE" \ |
| 59 | --diff pr.diff \ |
| 60 | --output comment.md \ |
| 61 | --output-labels labels.txt |
| 62 | |
| 63 | - name: Post PR Review Comment |
| 64 | if: always() && steps.review.conclusion != 'skipped' |
| 65 | env: |
| 66 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 68 | run: | |
| 69 | if [ -f comment.md ]; then |
| 70 | gh pr comment "$PR_NUMBER" --body-file comment.md |
| 71 | fi |
| 72 | |
| 73 | - name: Apply Review Labels |
| 74 | if: always() && steps.review.conclusion != 'skipped' |
| 75 | env: |
| 76 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 78 | run: | |
| 79 | if [ -f labels.txt ]; then |
| 80 | LABELS=$(cat labels.txt) |
| 81 | if [ -n "$LABELS" ]; then |
| 82 | gh pr edit "$PR_NUMBER" --add-label "$LABELS" || true |
| 83 | fi |
| 84 | fi |
| 85 | |
| 86 | - name: Verify Audit Invariants |
| 87 | env: |
| 88 | REVIEW_OUTCOME: ${{ steps.review.outcome }} |
| 89 | run: | |
| 90 | if [ "$REVIEW_OUTCOME" != "success" ]; then |
| 91 | echo "Constitutional diff audit detected violations. See PR comment for details." |
| 92 | exit 1 |
| 93 | fi |
| 94 | |
| 95 | issue-triage: |
| 96 | if: github.event_name == 'issues' && github.event.action == 'opened' |
| 97 | runs-on: ubuntu-latest |
| 98 | steps: |
| 99 | - name: Checkout Sovereign Inquisitor Core |
| 100 | uses: actions/checkout@v4 |
| 101 | with: |
| 102 | repository: aien-dev/aien-sovereign-core |
| 103 | |
| 104 | - name: Checkout Sibling Protocols Dependency |
| 105 | uses: actions/checkout@v4 |
| 106 | with: |
| 107 | repository: aien-dev/aien-protocols |
| 108 | path: aien-protocols |
| 109 | |
| 110 | - name: Setup Sibling Dependencies |
| 111 | run: | |
| 112 | mkdir -p ../aien-protocols |
| 113 | cp -r aien-protocols/* ../aien-protocols/ |
| 114 | |
| 115 | - name: Build Sovereign Inquisitor |
| 116 | run: cargo build --release -p spark-inquisitor |
| 117 | |
| 118 | - name: Extract Issue Payload Safely |
| 119 | run: | |
| 120 | jq -r '.issue.body // ""' "$GITHUB_EVENT_PATH" > issue_body.txt |
| 121 | |
| 122 | - name: Execute Sovereign Issue Triage |
| 123 | env: |
| 124 | ISSUE_AUTHOR: ${{ github.event.issue.user.login }} |
| 125 | ISSUE_NUMBER: ${{ github.event.issue.number }} |
| 126 | ISSUE_TITLE: ${{ github.event.issue.title }} |
| 127 | run: | |
| 128 | ./target/release/spark-inquisitor triage-issue \ |
| 129 | --author "$ISSUE_AUTHOR" \ |
| 130 | --issue "$ISSUE_NUMBER" \ |
| 131 | --title "$ISSUE_TITLE" \ |
| 132 | --body issue_body.txt \ |
| 133 | --output-comment issue_reply.md \ |
| 134 | --output-labels issue_labels.txt |
| 135 | |
| 136 | - name: Post Issue Triage Comment |
| 137 | env: |
| 138 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 139 | ISSUE_NUMBER: ${{ github.event.issue.number }} |
| 140 | run: | |
| 141 | if [ -f issue_reply.md ]; then |
| 142 | gh issue comment "$ISSUE_NUMBER" --body-file issue_reply.md |
| 143 | fi |
| 144 | |
| 145 | - name: Apply Issue Labels |
| 146 | env: |
| 147 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 148 | ISSUE_NUMBER: ${{ github.event.issue.number }} |
| 149 | run: | |
| 150 | if [ -f issue_labels.txt ]; then |
| 151 | LABELS=$(cat issue_labels.txt) |
| 152 | if [ -n "$LABELS" ]; then |
| 153 | gh issue edit "$ISSUE_NUMBER" --add-label "$LABELS" || true |
| 154 | fi |
| 155 | fi |
| 156 | |
| 157 | comment-evaluator: |
| 158 | if: github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.issue.pull_request != null && github.event.comment.user.login != 'github-actions[bot]' && github.event.comment.user.login != 'aien-dev' |
| 159 | runs-on: ubuntu-latest |
| 160 | steps: |
| 161 | - name: Checkout Sovereign Inquisitor Core |
| 162 | uses: actions/checkout@v4 |
| 163 | with: |
| 164 | repository: aien-dev/aien-sovereign-core |
| 165 | |
| 166 | - name: Checkout Sibling Protocols Dependency |
| 167 | uses: actions/checkout@v4 |
| 168 | with: |
| 169 | repository: aien-dev/aien-protocols |
| 170 | path: aien-protocols |
| 171 | |
| 172 | - name: Setup Sibling Dependencies |
| 173 | run: | |
| 174 | mkdir -p ../aien-protocols |
| 175 | cp -r aien-protocols/* ../aien-protocols/ |
| 176 | |
| 177 | - name: Build Sovereign Inquisitor |
| 178 | run: cargo build --release -p spark-inquisitor |
| 179 | |
| 180 | - name: Extract Comment Payload Safely |
| 181 | run: | |
| 182 | jq -r '.comment.body // ""' "$GITHUB_EVENT_PATH" > comment_body.txt |
| 183 | |
| 184 | - name: Evaluate Contributor Testimony |
| 185 | id: eval |
| 186 | continue-on-error: true |
| 187 | env: |
| 188 | COMMENT_AUTHOR: ${{ github.event.comment.user.login }} |
| 189 | run: | |
| 190 | ./target/release/spark-inquisitor evaluate \ |
| 191 | --testimony comment_body.txt \ |
| 192 | --author "$COMMENT_AUTHOR" \ |
| 193 | --output-comment verdict.md \ |
| 194 | --output-labels verdict_labels.txt |
| 195 | |
| 196 | - name: Post Verdict Comment |
| 197 | if: always() && steps.eval.conclusion != 'skipped' |
| 198 | env: |
| 199 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 200 | ISSUE_NUMBER: ${{ github.event.issue.number }} |
| 201 | run: | |
| 202 | if [ -f verdict.md ]; then |
| 203 | gh pr comment "$ISSUE_NUMBER" --body-file verdict.md |
| 204 | fi |
| 205 | |
| 206 | - name: Update PR Labels |
| 207 | if: always() && steps.eval.conclusion != 'skipped' |
| 208 | env: |
| 209 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 210 | ISSUE_NUMBER: ${{ github.event.issue.number }} |
| 211 | run: | |
| 212 | if [ -f verdict_labels.txt ]; then |
| 213 | LABELS=$(cat verdict_labels.txt) |
| 214 | if [ -n "$LABELS" ]; then |
| 215 | gh pr edit "$ISSUE_NUMBER" --add-label "$LABELS" || true |
| 216 | fi |
| 217 | fi |