gendesign/.forgejo/workflows/stale-claims.yml
lekss361 e4dc866e20 fixup(claude): address review-bot blockers on PR #610
🔴 Critical (3):

1. cleanup-stale-claims.sh: export CUTOFF + STALE_HOURS
   Без `export` Python heredoc child process получал "0" вместо реального
   cutoff → cron всегда видел все issues как fresh → ничего не освобождал.
   Plus added abort при CUTOFF=0 в Python heredoc для defense-in-depth.

2. cleanup-stale-claims.sh: datetime.UTC → datetime.timezone.utc
   datetime.UTC требует Python 3.11+. Forgejo runner ubuntu-latest имеет 3.10.
   datetime.timezone.utc works в 3.8+.

3. cleanup-stale-claims.sh: invert label order — DELETE wip FIRST, потом
   POST ready. Если step 2 (add ready) fails — issue в neutral state без
   status/*, менее опасно чем оба status/ready+status/wip одновременно.

🟠 + 🟡 + 🟢 (5):

4. Added pagination loop (defensive cap 10 pages × 50 = 500 issues), но
   реализована через temp file + Python parsing (не bash JSON concat).

5. Removed dead code: iso_to_epoch() shell helper не использовался.

6. _autonomous_pickup.md: fix broken `Out-Null | if (-not $?)` pattern.
   GetEnvironmentVariable НЕ throws при missing — возвращает $null. $? у
   Get* всегда $true. Заменено на прямую проверку результата.

7. stale-claims.yml: добавлен concurrency group чтобы overlapping runs
   не stomp'ились (хотя 5-min timeout делает overlap unlikely, defensive).

8. Documented updated_at != heartbeat assumption в header script'а.

Не сделано (low/optional):

- Setup script tokens в memory (UX trade-off — не critical)
- Token suffix в console output (минор info leak в shell history)

Refs: PR #610 review by review-bot (sha=297eb29, verdict=changes)
2026-05-28 00:33:27 +03:00

39 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Cleanup stale claims for autonomous multi-agent workflow.
#
# Запускается каждые 30 минут (cron). Освобождает issues застрявшие в
# `status/wip` дольше 4 часов. См. `scripts/cleanup-stale-claims.sh`.
#
# Secrets:
# FORGEJO_BOT_QA_TOKEN — bot-qa PAT (write:issue scope нужен).
# Можно использовать любой bot-PAT с write:issue, но bot-qa имеет минимум прав.
name: cleanup-stale-claims
on:
schedule:
# Каждые 30 минут UTC
- cron: '*/30 * * * *'
workflow_dispatch: {} # manual run возможен через UI
concurrency:
group: stale-claims
cancel-in-progress: false
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run cleanup script
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_BOT_QA_TOKEN }}
FORGEJO_URL: https://git.gendsgn.ru
FORGEJO_REPO: lekss361/gendesign
STALE_HOURS: 4
run: |
chmod +x scripts/cleanup-stale-claims.sh
./scripts/cleanup-stale-claims.sh