Sm Github
The GitHub-issues state engine for the machine loop: a pure-JS SM (scrum-master) rule pack that reconciles issue/PR state every tick — re-fires dead dev/rework legs on red CI, dispatches review when a developed PR goes green, and merges approved PRs oldest-first (FIFO) one per tick. State lives in issue/PR labels; the engine is deterministic (no LLM).
Parameters
Configured via customParams in the agent JSON or the project .dmtools/config.js (project values win).
repository— targetowner/repothe rules reconcile.workflowFile— the runner workflow dispatched for legs (defaultai-teammate.yml).removeLabel/removeLabels— label(s) stripped from the issue after the rule fires (idempotency).localTeammate— run the target config’s action in-process instead of dispatching a workflow.branchPrefix— PR head-branch prefix linking PRs togh-<n>issues (defaultai/gh-).maxWorkflows— global dispatch cap per tick (default 1).dryRun— log the plan without acting.
Labels
The machine’s state lives in labels; three are owner-facing semantics worth knowing:
blocked— human hold: the item is invisible to EVERY rule (all legs) until a human removes the label.ai_planned— a parent issue whose sub-issues were created by theintakeagent (issuePlanning.plannedLabel). The ruleplan-advance(local actionadvance_plan,js/common/planAdvance.js) adds the dev label (issuePlanning.devLabel, defaultagent:dev) and optionally assignsissuePlanning.devAssigneeto the sub-issues whose recordedblockedByblockers are closed, in sub-issue order and at mostissuePlanning.maxParallel(default 1) at a time, and closes the parent when every sub-issue is closed.validation_failed— sticky guest park (owner 2026-09-27, live: fa#923 — a guest PR cycled arm→CI red→silent-update→re-arm every tick, holding the validate-armed limit-1 slot hostage). The silent-update action sets it on a GUEST PR whose current head has red checks; while it is set the PR is excluded from the validate-armed arm queue and NO validation CI is dispatched for it at all. It is removed only when the head’s last committer is NOTsm-silent-update— i.e. an author push; the SM’s own silent-update merges never clear it. Machine-authored PRs never carry the label (their heads are pushed by the machine; they re-enter validation on a new head as usual).
Merge-window cadence (gh-837)
The post-approval window is strictly serial by default: one ai_validating arm at a time (mutex + mutexAmong [pr_approved]), so each merge pays a BEHIND refresh (~10–15 min) plus a full validation CI (~30–40 min) — a ~45–60 min/merge ceiling (owner expectation: 1 merge / 30 min, floor 1/hour).
jobParams.validationConcurrency (default 1 — unchanged legacy behavior; .dmtools/config.js smValidationConcurrency overrides, clamped to 5) relaxes the arm mutex to N concurrent approved validations when the approved queue depth is at/above validationConcurrencyQueueWatermark (default 3). With the knob active the SM also patches query.mutexMax onto validate-armed + the revalidate recovery twins and raises the arm limit to the cap, so every free slot fills in one tick: the parallel validations conclude together and the mergeBot’s one-run batch (it merges every green + CLEAN approved head per run) lands them in a single window. L2 replay (js/unit-tests/test_mergeCadence.js, queue depth 6, validation 35 min): serial ~50 min/merge → parallel-2 ~25 min/merge.
Runner cost stays hard-capped at N × validationMinutesEstimate (default 35) validation-minutes per tick and is reported on the tick log (and the action result’s validationCost field). A red validation still parks exactly one head — fail-validation is per-PR and the parallel arms share no state (#832 semantics preserved); the dev lane (mutexAmong [pr_approved] scope) is untouched.
Naked-PR reconciliation sweep (gh-1097)
After every dispatch lane of the tick, the SM lists OPEN PRs with zero lifecycle labels whose linked issue (branch ai/gh-N, else a closing keyword in the body) is still in flow, and re-arms the PR-side label: issue agent:review / status:In Review → agent:review; agent:rework / status:In Rework → agent:rework. One audit comment per re-arm (hidden marker <!-- dmtools:naked-pr-rearm {...} -->). The marker records the PR head sha; a PR already re-armed on the same head is skipped (no re-arm loop when a lane consumes the label), a new head re-opens it. Only the first page of open PRs is swept. Labels only — the sweep never dispatches; the next tick’s lanes pick the PR up. Excluded: blocked / needs-human / validation_failed on the PR or issue, and human-authored PRs (not machine author, not an ai/ branch). Opt out with jobParams.nakedPrSweep: false; honours dryRun. Logic: js/common/nakedPrReconcile.js.
Human doc: agents/docs/agents/sm_github.md
Attributes
| Attribute | Value |
|---|---|
| Job | JSRunner |
| Config | sm_github.json |
| ContextId | — |
| outputType | — |
| skipAIProcessing | false |
Prompt snapshot
Full prompt / instruction set: agents/snapshots/sm_github.md
Actions
LLM step
- outputType:
none - Prompt snapshot:
agents/snapshots/sm_github.md
Generated by js/agentDocGenerator.js