fix: docs: per-agent AGENTS.md files still describe cron triggers (#547)
This commit is contained in:
parent
84ab6ef0a8
commit
6a6d2d0774
7 changed files with 96 additions and 64 deletions
|
|
@ -4,17 +4,36 @@
|
|||
**Role**: Implement issues autonomously — write code, push branches, address
|
||||
CI failures and review feedback.
|
||||
|
||||
**Trigger**: `dev-poll.sh` runs every 10 min via cron. Sources `lib/guard.sh` and
|
||||
calls `check_active dev` first — skips if `$FACTORY_ROOT/state/.dev-active` is
|
||||
absent. Then performs a direct-merge scan (approved + CI green PRs — including
|
||||
chore/gardener PRs without issue numbers), then checks the agent lock and scans
|
||||
for ready issues using a two-tier priority queue: (1) `priority`+`backlog` issues
|
||||
first (FIFO within tier), then (2) plain `backlog` issues (FIFO). Orphaned
|
||||
in-progress issues are also picked up. The direct-merge scan runs before the lock
|
||||
check so approved PRs get merged even while a dev-agent session is active.
|
||||
**Trigger**: `dev-poll.sh` is invoked by the polling loop in `docker/agents/entrypoint.sh`
|
||||
every 5 minutes (iteration math at line 171-175). Sources `lib/guard.sh` and calls
|
||||
`check_active dev` first — skips if `$FACTORY_ROOT/state/.dev-active` is absent. Then
|
||||
performs a direct-merge scan (approved + CI green PRs — including chore/gardener PRs
|
||||
without issue numbers), then checks the agent lock and scans for ready issues using a
|
||||
two-tier priority queue: (1) `priority`+`backlog` issues first (FIFO within tier), then
|
||||
(2) plain `backlog` issues (FIFO). Orphaned in-progress issues are also picked up. The
|
||||
direct-merge scan runs before the lock check so approved PRs get merged even while a
|
||||
dev-agent session is active.
|
||||
|
||||
**Key files**:
|
||||
- `dev/dev-poll.sh` — Cron scheduler: finds next ready issue, handles merge/rebase of approved PRs, tracks CI fix attempts. `BOT_USER` is resolved once at startup via the Forge `/user` API and cached for all assignee checks. Formula guard skips issues labeled `formula`, `prediction/dismissed`, or `prediction/unreviewed`. **Race prevention**: checks issue assignee before claiming — skips if assigned to a different bot user. **Stale branch abandonment**: closes PRs and deletes branches that are behind `$PRIMARY_BRANCH` (restarts poll cycle for a fresh start). **Stale in-progress recovery**: on each poll cycle, scans for issues labeled `in-progress`. If the issue has a `vision` label, sets `BLOCKED_BY_INPROGRESS=true` and skips further stale checks (vision issues are managed by the architect). If the issue is assigned to `$BOT_USER` (this agent), checks for pending review feedback first — if an open PR has `REQUEST_CHANGES`, spawns the dev-agent to address it before setting `BLOCKED_BY_INPROGRESS=true`; otherwise just sets blocked. If assigned to another agent, logs and falls through (does not block). If no assignee, no open PR, and no agent lock file — removes `in-progress`, adds `blocked` with a human-triage comment. **Per-agent open-PR gate**: before starting new work, filters open waiting PRs to only those assigned to this agent (`$BOT_USER`). Other agents' PRs do not block this agent's pipeline (#358, #369). **Pre-lock merge scan own-PRs only**: the direct-merge scan only merges PRs whose linked issue is assigned to this agent — skips PRs owned by other bot users (#374).
|
||||
- `dev/dev-poll.sh` — Polling loop participant: finds next ready issue, handles merge/rebase
|
||||
of approved PRs, tracks CI fix attempts. Invoked by `docker/agents/entrypoint.sh` every 5
|
||||
minutes. `BOT_USER` is resolved once at startup via the Forge `/user` API and cached for
|
||||
all assignee checks. Formula guard skips issues labeled `formula`, `prediction/dismissed`,
|
||||
or `prediction/unreviewed`. **Race prevention**: checks issue assignee before claiming —
|
||||
skips if assigned to a different bot user. **Stale branch abandonment**: closes PRs and
|
||||
deletes branches that are behind `$PRIMARY_BRANCH` (restarts poll cycle for a fresh start).
|
||||
**Stale in-progress recovery**: on each poll cycle, scans for issues labeled `in-progress`.
|
||||
If the issue has a `vision` label, sets `BLOCKED_BY_INPROGRESS=true` and skips further
|
||||
stale checks (vision issues are managed by the architect). If the issue is assigned to
|
||||
`$BOT_USER` (this agent), checks for pending review feedback first — if an open PR has
|
||||
`REQUEST_CHANGES`, spawns the dev-agent to address it before setting `BLOCKED_BY_INPROGRESS=true`;
|
||||
otherwise just sets blocked. If assigned to another agent, logs and falls through (does not
|
||||
block). If no assignee, no open PR, and no agent lock file — removes `in-progress`, adds
|
||||
`blocked` with a human-triage comment. **Per-agent open-PR gate**: before starting new work,
|
||||
filters open waiting PRs to only those assigned to this agent (`$BOT_USER`). Other agents'
|
||||
PRs do not block this agent's pipeline (#358, #369). **Pre-lock merge scan own-PRs only**:
|
||||
the direct-merge scan only merges PRs whose linked issue is assigned to this agent — skips
|
||||
PRs owned by other bot users (#374).
|
||||
- `dev/dev-agent.sh` — Orchestrator: claims issue, creates worktree + tmux session with interactive `claude`, monitors phase file, injects CI results and review feedback, merges on approval
|
||||
- `dev/phase-test.sh` — Integration test for the phase protocol
|
||||
|
||||
|
|
@ -32,9 +51,9 @@ check so approved PRs get merged even while a dev-agent session is active.
|
|||
|
||||
**Crash recovery**: on `PHASE:crashed` or non-zero exit, the worktree is **preserved** (not destroyed) for debugging. Location logged. Supervisor housekeeping removes stale crashed worktrees older than 24h.
|
||||
|
||||
**Lifecycle**: dev-poll.sh (`check_active dev`) → dev-agent.sh → tmux session → phase file
|
||||
drives CI/review loop → merge + `mirror_push()` → close issue. On respawn after
|
||||
`PHASE:escalate`, the stale phase file is cleared first so the session starts
|
||||
clean; the reinject prompt tells Claude not to re-escalate for the same reason.
|
||||
On respawn for any active PR, the prompt explicitly tells Claude the PR already
|
||||
exists and not to create a new one via API.
|
||||
**Lifecycle**: dev-poll.sh (invoked by polling loop, `check_active dev`) → dev-agent.sh →
|
||||
tmux session → phase file drives CI/review loop → merge + `mirror_push()` → close issue.
|
||||
On respawn after `PHASE:escalate`, the stale phase file is cleared first so the session
|
||||
starts clean; the reinject prompt tells Claude not to re-escalate for the same reason.
|
||||
On respawn for any active PR, the prompt explicitly tells Claude the PR already exists
|
||||
and not to create a new one via API.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue