feat(agents): swarm lib + Operator + Issue Opener roles #25

Merged
navigator merged 1 commit from feature/swarm-lib-operator-opener into main 2026-05-24 14:47:02 -03:00
Owner

Summary

First wave of the autonomous swarm scaffolding per ADR-017 (PR #24). Lands the shared library + two of the four roles. Resolver Dispatcher (PR #26) and PR Approver + installer (PR #27) follow.

What's in it

Shared library (infra/ops/agents/lib/):

  • circuit.sh — 3-state circuit breaker (closed/half-open/open), trip 5×30min, manual reset, Telegram alarm on trip
  • forgejo.sh — REST helpers: GET/POST/PATCH/DELETE + issue/label/comment/PR/commit-status; idempotent fj_label_add
  • telegram.shnotify_low/normal/high wrappers prefixing [swarm:<role>]
  • role-common.shRUN_ID, log dirs, run_claude (full stream-json with session_id capture), role_lock (flock), role_drain_inbox for /role bridge routing
  • sandbox-claude.shsystemd-run --user --scope envelope with cgroup caps; scan_escalation post-mortem parser

Roles:

  • operator.sh — oneshot every 10 min; releases stale resolvers, pings on PRs waiting >2h, escalates blocked-human/blocked-ci to Telegram once, auto-kicks auto-merge.sh for green PRs
  • issue-opener.sh — oneshot 12:00 + 18:00 UTC; reads PLAN.md §6-15 + 18, throttles at 12 open swarm issues, asks claude for up to 3 NEW (strict JSON), files with area:* + agent:queued

Prompts in roles/prompts/*.md (separable from shell wrapper).

Units in infra/ops/agents/units/ — standard EnvironmentFile=%h/.config/settings.env.

Validation

  • bash -n green on all .sh
  • systemd-analyze --user verify green on all .service / .timer
  • Scripts have +x bit
  • End-to-end test gated by Stage 4 cold start (after PR #27 + ADR-017 acceptance)

Notes

This PR does NOT activate the swarm — units are installed but never enabled in this commit. Cold start happens after PR #27 lands install-swarm.sh and Marcos approves ADR-017.

## Summary First wave of the autonomous swarm scaffolding per **ADR-017** (PR #24). Lands the shared library + two of the four roles. Resolver Dispatcher (PR #26) and PR Approver + installer (PR #27) follow. ## What's in it **Shared library** (`infra/ops/agents/lib/`): - `circuit.sh` — 3-state circuit breaker (closed/half-open/open), trip 5×30min, manual reset, Telegram alarm on trip - `forgejo.sh` — REST helpers: GET/POST/PATCH/DELETE + issue/label/comment/PR/commit-status; idempotent `fj_label_add` - `telegram.sh` — `notify_low/normal/high` wrappers prefixing `[swarm:<role>]` - `role-common.sh` — `RUN_ID`, log dirs, `run_claude` (full stream-json with session_id capture), `role_lock` (flock), `role_drain_inbox` for `/role` bridge routing - `sandbox-claude.sh` — `systemd-run --user --scope` envelope with cgroup caps; `scan_escalation` post-mortem parser **Roles**: - `operator.sh` — oneshot every 10 min; releases stale resolvers, pings on PRs waiting >2h, escalates blocked-human/blocked-ci to Telegram once, auto-kicks `auto-merge.sh` for green PRs - `issue-opener.sh` — oneshot 12:00 + 18:00 UTC; reads `PLAN.md` §6-15 + 18, throttles at 12 open swarm issues, asks claude for up to 3 NEW (strict JSON), files with `area:*` + `agent:queued` **Prompts** in `roles/prompts/*.md` (separable from shell wrapper). **Units** in `infra/ops/agents/units/` — standard `EnvironmentFile=%h/.config/settings.env`. ## Validation - [x] `bash -n` green on all `.sh` - [x] `systemd-analyze --user verify` green on all `.service` / `.timer` - [x] Scripts have `+x` bit - [ ] End-to-end test gated by Stage 4 cold start (after PR #27 + ADR-017 acceptance) ## Notes This PR does NOT activate the swarm — units are installed but never enabled in this commit. Cold start happens after PR #27 lands `install-swarm.sh` and Marcos approves ADR-017.
feat(agents): swarm lib + Operator + Issue Opener roles
All checks were successful
build / scalafmt-check (pull_request) Successful in 3s
build / sbt-compile (pull_request) Successful in 4s
build / shell-lint (pull_request) Successful in 9s
build / scalafmt-check (push) Successful in 3s
build / sbt-compile (push) Successful in 3s
build / shell-lint (push) Successful in 49s
fec788d7be
First wave of the autonomous swarm scaffolding (per ADR-017). Lands the
shared library + two of the four roles. Resolver Dispatcher (PR #26) and
PR Approver + installer (PR #27) follow.

Shared library (infra/ops/agents/lib/):
- circuit.sh    common 3-state circuit breaker (closed/half-open/open),
                trip 5x30min, manual reset, Telegram alarm on trip
- forgejo.sh    REST helpers: get/post/patch/delete + issues/labels/
                comments/PRs/commit-status; idempotent label add
- telegram.sh   notify_low/normal/high wrappers prefixing [swarm:<role>]
- role-common.sh per-role bootstrap: RUN_ID, log dirs, run_claude (full
                stream-json with session_id capture), role_lock (flock),
                role_drain_inbox for /role bridge routing
- sandbox-claude.sh systemd-run --user --scope envelope with cgroup caps;
                scan_escalation post-mortem parser for off-limits paths

Roles:
- operator.sh        oneshot, triggered every 10 min by .timer; releases
                     stale resolvers (>30 min no heartbeat), pings on PRs
                     waiting >2h, escalates blocked-human/blocked-ci once
                     to Telegram, auto-kicks merge for green PRs
- issue-opener.sh    oneshot, twice daily (12:00 + 18:00 UTC); reads
                     PLAN.md sections 6-15 + 18, throttles at 12 open
                     swarm issues, asks claude to propose up to 3 NEW
                     issues (strict JSON), files with area:* + agent:queued

Prompts (roles/prompts/) carry the per-role claude instructions in plain
Markdown so they can be reviewed independently of the shell that loads them.

Units (infra/ops/agents/units/): standard EnvironmentFile=%h/.config/
settings.env, Documentation= links to script + ADR-017.

Test:
- bash -n green on all .sh files
- systemd-analyze --user verify green on all .service / .timer
- chmod +x applied to all scripts so the units find them executable
fluidpop-bot left a comment
Collaborator

CI green (head fec788d7be), auto-approving

CI green (head fec788d7be66fa152665cd20258c44de7b671ec5), auto-approving
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Fluid/fluidpop-v1!25
No description provided.