Skip to content

feat: board-driven automation daemon (drag a card, launch the work) - #350

Closed
Hadrien-Cornier wants to merge 1 commit into
kunchenguid:mainfrom
Hadrien-Cornier:fm/board-daemon
Closed

Hadrien-Cornier wants to merge 1 commit into
kunchenguid:mainfrom
Hadrien-Cornier:fm/board-daemon

Conversation

@Hadrien-Cornier

Copy link
Copy Markdown

What this does

Turns the "Hadrien FirstMate" Azure Board into the control surface that launches fleet work: the captain drags a card between columns and the right agent starts automatically.

A local bash daemon polls the board (no webhook, so there is no public tunnel to maintain) and acts on real column transitions:

Transition into... Action
Ready to plan spawn a planning scout
In Progress (from Planned/Proposed) spawn an implementation ship crew
everything else observed, logged, no spawn

Each spawned agent reads the work item from Azure itself, does the work through the normal firstmate machinery, and moves the card to its next column (Planned, then PR). Normal watcher/afk supervision covers the spawned crew.

CPU-safety design (a hard requirement)

  • Poll every FM_BOARD_POLL_SECS (default 120s), then sleep - no busy-wait.
  • Exactly one WIQL query + one chunked batch detail fetch per cycle, each a short-lived curl parsed by a single python3 pass.
  • The process re-nices itself to +19 (renice), and lowers IO priority with ionice -c 3 on Linux (absent on macOS, skipped).
  • Portable singleton lock (the watcher's own lock primitive); a duplicate self-evicts.
  • Measured idle: 0.0% CPU, ~2.7 MB RSS.

Guardrails

  • No mass-spawn: first sight of any card seeds its column marker without spawning, so start/restart/new-card never spawns; only a later move triggers work.
  • Dedupe: one agent per card+stage (live meta + state/.board-spawned-<id>-<stage> marker).
  • Concurrency cap FM_BOARD_MAX_INFLIGHT (default 4) and hourly runaway cap FM_BOARD_MAX_PER_HOUR (default 12); excess is queued, not dropped.
  • Repo resolution never guesses: a card's repo: tag or lane maps to a fleet project via config/board-lane-map; unresolvable cards are logged and left for retry.
  • Every decision logged to state/.board-daemon.log; each spawn records to data/backlog.md and comments on the card.

Arm / kill

bin/fm-board-arm.sh            # start (detached) or verify; one honest status line
bin/fm-board-arm.sh --restart  # home-scoped restart (never a broad pkill)
touch state/.board-daemon.off  # kill switch: idle instantly

The daemon is not wired into session start or bootstrap - it runs only when explicitly armed. FM_BOARD_AUTOSPAWN=0 gives observe-only.

What I verified

  • Behavior test tests/fm-board-daemon.test.sh (7 cases): stage classifier, repo resolution, seed-without-spawn on first sight, one-transition-one-spawn + dedupe, kill switch, concurrency cap queueing, unresolved flag-and-leave. All pass.
  • Live read path against the real board: 56 cards parsed with correct columns/lanes.
  • --seed against the live board: seeded all 56 cards, spawned nothing (the critical no-mass-spawn guarantee).
  • Arm/singleton/beacon: started/healthy, single process, beacon advances each cycle, niceness 19, idle 0.0% CPU, --restart home-scoped, kill switch idles.
  • shellcheck bin/*.sh bin/backends/*.sh tests/*.sh clean.

Shipped disabled: nothing runs until the captain arms it. Review, then bin/fm-board-arm.sh (optionally FM_BOARD_AUTOSPAWN=0 first to observe).

Files: bin/fm-board-daemon.sh, bin/fm-board-arm.sh, bin/fm-board-lib.sh, docs/board-automation/ (README + plan/impl brief templates), .agents/skills/board-automation/, docs/examples/board-lane-map, tests/fm-board-daemon.test.sh.

Poll the Hadrien FirstMate Azure board and auto-launch the right agent on a
card transition: into Ready to plan spawns a planning scout, into In Progress
spawns an implementation ship crew. Poll loop (not webhook) so there is no
public tunnel to maintain.

CPU-safe by design: nice +19 (ionice on Linux), one WIQL query plus one chunked
batch fetch per cycle then sleep, portable singleton lock. Guardrails: seed
markers without spawning on first sight (no mass-spawn on start/restart),
one-agent-per-card+stage dedupe, concurrency and hourly runaway caps, repo
resolution that flags-and-leaves rather than guessing, kill switch, and a full
decision log.

Ships fm-board-daemon.sh, fm-board-arm.sh, fm-board-lib.sh, the plan/impl brief
templates, an agent-only board-automation skill, docs, and a behavior test.
@Hadrien-Cornier

Copy link
Copy Markdown
Author

Superseded: reopening on the canonical Azure repo ai-firstmate (dev.azure.com/talroo/Product/_git/ai-firstmate), which powers firstmate locally + for the company.

@giau50

giau50 commented Oct 23, 2026

Copy link
Copy Markdown

Test comment (will be deleted).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants