fix: gardener migration — run-gardener.toml via direct cron, remove legacy scripts (#490)

Rewrite gardener-run.sh as direct cron runner (matching supervisor/planner/
predictor pattern): lock guard, memory check, worktree, tmux session with
Claude sonnet + formulas/run-gardener.toml, phase monitoring, cleanup.

- Delete gardener-poll.sh and gardener-agent.sh (superseded)
- Extract consume_escalation_reply() to lib/formula-session.sh (shared
  by gardener and supervisor, eliminates duplicate blocks)
- Update AGENTS.md, gardener/AGENTS.md, lib/AGENTS.md, CI smoke test,
  and cross-references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-21 13:09:17 +00:00
parent 685ca1034a
commit b630c6fcc1
11 changed files with 125 additions and 581 deletions

View file

@ -2,7 +2,7 @@
# formula-session.sh — Shared helpers for formula-driven cron agents
#
# Provides reusable functions for the common cron-wrapper + tmux-session
# pattern used by planner-run.sh and gardener-agent.sh.
# pattern used by planner-run.sh, predictor-run.sh, gardener-run.sh, and supervisor-run.sh.
#
# Functions:
# acquire_cron_lock LOCK_FILE — PID lock with stale cleanup
@ -81,6 +81,25 @@ $(cat "$ctx_path")
done
}
# ── Escalation reply consumption ─────────────────────────────────────────
# consume_escalation_reply AGENT_NAME
# Atomically consumes /tmp/{agent}-escalation-reply if it exists.
# Sets ESCALATION_REPLY to the file contents (empty string if no reply).
consume_escalation_reply() {
local agent="$1"
local reply_file="/tmp/${agent}-escalation-reply"
ESCALATION_REPLY=""
if [ -s "$reply_file" ]; then
local tmp_file="${reply_file}.consumed.$$"
if mv "$reply_file" "$tmp_file" 2>/dev/null; then
ESCALATION_REPLY=$(cat "$tmp_file")
rm -f "$tmp_file"
log "Consumed escalation reply: $(echo "$ESCALATION_REPLY" | head -1)"
fi
fi
}
# ── Session management ───────────────────────────────────────────────────
# start_formula_session SESSION WORKDIR PHASE_FILE