spawn/.github/workflows/refactor.yml
A 7ace2695e6
feat: Run issue-fix cycles concurrently with refactor cycles (#145)
Issue triggers now spawn lightweight 2-agent runs (15-min timeout) in
isolated worktrees, while refactor cycles continue independently with
the full 6-agent team (30-min timeout). Duplicate issue runs are
rejected with 409.

- trigger-server.ts: pass SPAWN_ISSUE/SPAWN_REASON env vars to script,
  add issue dedup (409), include issue in health/trigger responses
- refactor.sh: dual-mode (issue vs refactor) with isolated worktrees,
  mode-specific prompts and timeouts, scoped cleanup
- start-refactor.sh: set MAX_CONCURRENT=3 (gitignored, local only)
- refactor.yml: handle 409 alongside existing 429

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 22:15:19 -08:00

36 lines
1.1 KiB
YAML

name: Trigger Refactor
on:
schedule:
- cron: '*/30 * * * *'
issues:
types: [opened, reopened]
workflow_dispatch:
concurrency:
group: refactor-sprite-trigger
cancel-in-progress: false
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger refactor sprite
env:
SPRITE_URL: ${{ secrets.REFACTOR_SPRITE_URL }}
TRIGGER_SECRET: ${{ secrets.REFACTOR_TRIGGER_SECRET }}
run: |
HTTP_CODE=$(curl -s -o /tmp/response.json -w '%{http_code}' -X POST \
"${SPRITE_URL}/trigger?reason=${{ github.event_name }}&issue=${{ github.event.issue.number || '' }}" \
-H "Authorization: Bearer ${TRIGGER_SECRET}")
cat /tmp/response.json
if [ "$HTTP_CODE" = "429" ]; then
echo "Cycle already running, skipping"
elif [ "$HTTP_CODE" = "409" ]; then
echo "Run for this issue already in progress, skipping"
elif [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
echo "Triggered successfully"
else
echo "Failed with HTTP $HTTP_CODE"
exit 1
fi