mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-08 18:39:50 +00:00
Two high-impact, zero-risk changes to get daily agent team spend under $50:
1. Reduce cron frequency:
- Security: */30 → every 4 hours (48→6 cycles/day, 87% reduction)
- Refactor: */15 → every 2 hours (96→12 cycles/day, 87% reduction)
Most cycles find nothing to do (no new PRs/issues). Issue-triggered runs
(on labeled issues) still fire instantly via the `issues` event type,
so response time to real work is unchanged. The trigger-server already
returns 409 when a cycle is in-progress, so high cron frequency was just
idle-polling cost.
2. Downgrade team-lead model from Opus to Sonnet:
- Security: --model sonnet for review_all and scan modes (triage was
already using gemini-3-flash-preview)
- Refactor: --model sonnet
The team lead's job is coordination — spawn teammates, monitor them,
shut down. This is routing, not reasoning. Sonnet handles it fine and
its output tokens are ~5x cheaper than Opus. Teammates (spawned by the
lead) use their own model flags and are unaffected.
Combined effect: ~90% fewer cycles × ~80% cheaper per cycle on the team
lead = estimated 95%+ cost reduction on team-lead tokens alone.
Follow-up PR will trim prompt sizes (Phase 2) and consolidate security
teammates (Phase 3) per the plan, but this Phase 1 closes most of the gap.
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
48 lines
1.7 KiB
YAML
48 lines
1.7 KiB
YAML
name: Trigger Refactor
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 */2 * * *'
|
|
issues:
|
|
types: [opened, reopened, labeled]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
trigger:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
# Only trigger on issues with safe-to-work AND (bug, cli, enhancement, or maintenance) labels, or schedule/manual
|
|
if: >-
|
|
github.event_name != 'issues' ||
|
|
(contains(github.event.issue.labels.*.name, 'safe-to-work') &&
|
|
(contains(github.event.issue.labels.*.name, 'bug') ||
|
|
contains(github.event.issue.labels.*.name, 'cli') ||
|
|
contains(github.event.issue.labels.*.name, 'enhancement') ||
|
|
contains(github.event.issue.labels.*.name, 'maintenance')))
|
|
steps:
|
|
- name: Trigger refactor cycle
|
|
env:
|
|
SPRITE_URL: ${{ secrets.REFACTOR_SPRITE_URL }}
|
|
TRIGGER_SECRET: ${{ secrets.REFACTOR_TRIGGER_SECRET }}
|
|
run: |
|
|
HTTP_CODE=$(curl -sS --connect-timeout 15 --max-time 30 \
|
|
-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}")
|
|
BODY=$(cat /tmp/response.json 2>/dev/null || echo '{}')
|
|
echo "$BODY"
|
|
case "$HTTP_CODE" in
|
|
2*)
|
|
echo "::notice::Trigger accepted (HTTP $HTTP_CODE)"
|
|
;;
|
|
409)
|
|
echo "::notice::Run already in progress — this is expected (HTTP 409)"
|
|
;;
|
|
429)
|
|
echo "::warning::Server at capacity (HTTP 429)"
|
|
;;
|
|
*)
|
|
echo "::error::Trigger failed (HTTP $HTTP_CODE)"
|
|
exit 1
|
|
;;
|
|
esac
|