Phase 1: webhook handler + systemd unit + flock in dev-task

This commit is contained in:
danny8632
2026-05-12 07:06:58 +00:00
parent a296b87065
commit b3ab9639af
3 changed files with 153 additions and 0 deletions

View File

@@ -18,6 +18,15 @@ REPO="${1:-}"
ISSUE="${2:-}"
[[ -z "$REPO" || -z "$ISSUE" ]] && { echo "usage: $0 <owner>/<repo> <issue-id>" >&2; exit 64; }
# Serialize: only one dev-task active at a time (Max-plan rate-limit pool).
# Wait up to 60s for the lock; if still held, exit 75 so the webhook retries.
LOCK_FILE="${LOCK_FILE:-/var/agent/dev-task.lock}"
exec 200>"$LOCK_FILE"
if ! flock -w 60 200; then
echo "[dev-task] another dev-task is running; backing off" >&2
exit 75
fi
MAX_WALLCLOCK="${MAX_WALLCLOCK:-30m}"
MODEL_DEFAULT="${MODEL:-sonnet}"
BASE_BRANCH="${BASE_BRANCH:-main}"