2026-03-23 18:05:26 +00:00
|
|
|
<!-- last-reviewed: a2016db5c35ee3429ebaa212192983a03c4e4cb8 -->
|
2026-03-21 12:44:23 +00:00
|
|
|
# Dev Agent
|
|
|
|
|
|
|
|
|
|
**Role**: Implement issues autonomously — write code, push branches, address
|
|
|
|
|
CI failures and review feedback.
|
|
|
|
|
|
2026-03-22 12:07:31 +00:00
|
|
|
**Trigger**: `dev-poll.sh` runs every 10 min via cron. It performs a direct-merge
|
|
|
|
|
scan first (approved + CI green PRs — including chore/gardener PRs without issue
|
2026-03-23 00:11:06 +00:00
|
|
|
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.
|
2026-03-22 12:07:31 +00:00
|
|
|
The direct-merge scan runs before the lock check so approved PRs get merged even
|
|
|
|
|
while a dev-agent session is active on another issue.
|
2026-03-21 12:44:23 +00:00
|
|
|
|
|
|
|
|
**Key files**:
|
|
|
|
|
- `dev/dev-poll.sh` — Cron scheduler: finds next ready issue, handles merge/rebase of approved PRs, tracks CI fix attempts
|
|
|
|
|
- `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
|
2026-03-23 00:11:06 +00:00
|
|
|
- `dev/phase-handler.sh` — Phase callback functions: `post_refusal_comment()`, `_on_phase_change()`, `build_phase_protocol_prompt()`. `do_merge()` detects already-merged PRs on HTTP 405 (race with dev-poll's pre-lock scan) and returns success instead of escalating
|
2026-03-21 12:44:23 +00:00
|
|
|
- `dev/phase-test.sh` — Integration test for the phase protocol
|
|
|
|
|
|
|
|
|
|
**Environment variables consumed** (via `lib/env.sh` + project TOML):
|
fix: Replace Codeberg dependency with local Forgejo instance (#611)
- Add setup_forge() to bin/disinto: provisions Forgejo via Docker,
creates admin + bot users (dev-bot, review-bot), generates API
tokens, creates repo, and pushes code — all automated
- Rename env vars: CODEBERG_TOKEN→FORGE_TOKEN, REVIEW_BOT_TOKEN→
FORGE_REVIEW_TOKEN, CODEBERG_REPO→FORGE_REPO, CODEBERG_API→
FORGE_API, CODEBERG_WEB→FORGE_WEB, CODEBERG_BOT_USERNAMES→
FORGE_BOT_USERNAMES (with backwards-compat fallbacks)
- Rename API helpers: codeberg_api()→forge_api(), codeberg_api_all()
→forge_api_all() (with compat aliases)
- Add forge_url field to project TOML; load-project.sh derives
FORGE_API/FORGE_WEB from forge_url + repo
- Update parse_repo_slug() to accept any host URL, not just codeberg
- Forgejo data stored under ~/.disinto/forgejo/ (not in factory repo)
- Update all 58 files: agent scripts, formulas, docs, site HTML
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:57:12 +00:00
|
|
|
- `FORGE_TOKEN` — Dev-agent token (push, PR creation, merge) — use the dedicated bot account
|
|
|
|
|
- `FORGE_REPO`, `FORGE_API` — Target repository
|
2026-03-21 12:44:23 +00:00
|
|
|
- `PROJECT_NAME`, `PROJECT_REPO_ROOT` — Local checkout path
|
|
|
|
|
- `PRIMARY_BRANCH` — Branch to merge into (e.g. `main`, `master`)
|
|
|
|
|
- `WOODPECKER_REPO_ID` — CI pipeline lookups
|
|
|
|
|
- `CLAUDE_TIMEOUT` — Max seconds for a Claude session (default 7200)
|
|
|
|
|
- `MATRIX_TOKEN`, `MATRIX_ROOM_ID`, `MATRIX_HOMESERVER` — Notifications (optional)
|
|
|
|
|
|
|
|
|
|
**Lifecycle**: dev-poll.sh → dev-agent.sh → create Matrix thread + export
|
|
|
|
|
`MATRIX_THREAD_ID` (streams Claude output to thread via Stop hook) → tmux
|
|
|
|
|
`dev-{project}-{issue}` → phase file drives CI/review loop → merge → close issue.
|