@the-vibe-company/armada 0.2.65 → 0.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/armada.js +113 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,7 +224,7 @@ armada answer --note ABC-12 "PR #12 is DIRTY: resolve conflicts and hand back th
|
|
|
224
224
|
If Conductor does not confirm an answer or note, Armada keeps its original message id and masked text. The command exits 1; nothing is posted on Linear and the question stays open. Keep `armada watch` running: it retries with delays of 1, 2, 5, 10 and 20 minutes (six tries total). Rerunning the same command reuses the kept delivery. A successful newer answer retires the older one; a replaced or released worker is never sent the old answer. Unconfirmed merge notices use the same path and skip workers that handed back. A permanent refusal or exhausted tries creates one `delivery-failed` inbox item; inspect the session and record your decision with `armada answer <item> "<why>"`. Status, inbox and the stop hook keep pending deliveries visible. A confirmed send is never repeated if recording fails. Herdr deliveries have no message id: inspect before retrying. Never send a kept message by hand too. Deploy the API and migration before the CLI.
|
|
225
225
|
|
|
226
226
|
|
|
227
|
-
- Hand-backs already in the merge queue show their position or drain step as in progress in the inbox, watch and dashboard. They need no new coordinator action. A worker reporting another phase clears its previous hand-back; its next `ready-to-merge` report wakes the watch again. A "main moved" notice or heads-up with no requested action needs no worker report: keep `ready-to-merge` when the PR is `CLEAN` or `BEHIND`. Integrate main only if GitHub says `DIRTY`, resolve conflicts, rerun checks, push and hand back the new green head; the coordinator's merge updates and retests a merely behind branch. Coordinators send handed-back workers a note only when they need an action (a conflict or requested change). Confirmed merges clear that PR's queue refusals and owner merge requests, with cleared ids in the result line. The next inbox read also clears notices for PRs merged elsewhere, using the stored GitHub reading.
|
|
227
|
+
- Hand-backs already in the merge queue show their position or drain step as in progress in the inbox, watch and dashboard. They need no new coordinator action. A worker reporting another phase clears its previous hand-back; its next `ready-to-merge` report wakes the watch again. A "main moved" notice or heads-up with no requested action needs no worker report: keep `ready-to-merge` when the PR is `CLEAN` or `BEHIND`. Integrate main only if GitHub says `DIRTY`, resolve conflicts, rerun checks, push and hand back the new green head; the coordinator's merge updates and retests a merely behind branch. Coordinators send handed-back workers a note only when they need an action (a conflict or requested change). Confirmed merges clear that PR's queue refusals and owner merge requests, with cleared ids in the result line. The next inbox read also clears notices for PRs merged elsewhere, using the stored GitHub reading. Status and `armada merge queue` hide refusals once the PR is known merged or a newer queue attempt supersedes them; the latest unresolved refusal remains visible. Without GitHub evidence, a refusal stays shown.
|
|
228
228
|
- `ask` reports the `blocked` phase with `Agent status: blocked — question: <first line>` (the rest and the numbered options below it) and adds a `question` item to the coordinator's inbox on Armada. The worker then stops and waits for the answer in its session, and reports the phase it resumes. It finds the ticket like `report`.
|
|
229
229
|
- `report awaiting-approval` adds a `plan` item with the full message (and the `--plan` block) and worker handle to the coordinator's inbox. Same-phase heartbeats neither duplicate nor reopen it. Answering it, recording a note, leaving the phase or releasing the ticket closes the plan and any pending approval request. For a pre-approved plan (the brief's "Plan" line says which), post the plan with `report implementing --plan-file -` instead: no approval item is needed.
|
|
230
230
|
- Long runs go through `armada job`, on the project’s runner. A running job whose progress stays unchanged past `[jobs.<name>] stall_minutes` (default 60) shows `stalled N min` in job list/status and a stalled tag in the job strip, and creates one `job-stalled` inbox wake per stall. Check with `armada job status <id>` and stop deliberately with `armada job stop <id>`. Fraction progress (`n/m`) ignores changing ETA/clock text; movement clears the alert. Silence takes precedence; absent progress is never stalled. The alert never stops a job and only covers runs tracked through Armada jobs.
|
|
@@ -275,6 +275,7 @@ armada merge 35 --no-ticket # a pull request no ticket owns: armada init's, a re
|
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
- The checklist names every failure and exits 1: the ticket carries `ready-to-merge` and its newest `Agent status: ready-to-merge — PR #34, head <sha>` comment names this pull request with the full 40-character SHA of its current head; the pull request is open, not a draft, titled in Commitizen format and `CLEAN` for GitHub; every `[gates] required_checks` check is green on the head; no review thread is unresolved.
|
|
278
|
+
- CI is judged on the newest run of each GitHub Actions workflow for the exact head (workflow identity, run number and attempt), shared by the checklist, `--wait` and queue drain. Superseded cancelled runs do not block; running replacements are waited for. A newest cancelled check blocks as `cancelled`, and refusals include its run ID and attempt. Independent workflows, external statuses and checks without workflow metadata still count; incomplete GitHub check readings refuse the merge.
|
|
278
279
|
- A head that lacks commits of its base branch is refused, unless `[gates] local_commands` is set: then the head is merged into the base in a throwaway `git worktree`, the commands run there, and the worktree is removed.
|
|
279
280
|
- `--wait [--timeout <min>]` (30 minutes by default) keeps going until the pull request merges or a real refusal. A head behind its base that GitHub says merges cleanly is updated with GitHub's "update branch" (a merge commit, no force-push), and every required check is waited for on the new head; when the base does not require heads up to date and `[gates] local_commands` is set, it is test-merged instead. A red check, a conflict, any other refused rule, or GitHub refusing the update (a protected branch) or not applying it within 3 minutes stops it and says which. The merge lock is held only while merging, never while waiting; signed in with Armada down, it refuses before touching the branch.
|
|
280
281
|
- A head that is the handed-back SHA followed only by merge commits of the base still counts as the hand-back: each merge commit's first parent is the commit before it, its second parent is on the base branch, and its tree is the clean merge of the two (`git merge-tree`). The merged comment then names both heads (`head <new>, the handed-back <old> updated with main`).
|
|
@@ -315,6 +316,10 @@ Digests default to 09:00, 13:00 and 18:00 on weekdays in the channel’s IANA ti
|
|
|
315
316
|
|
|
316
317
|
**Optional scheduler, off by default.** `GET /api/cron/owner` requires `Authorization: Bearer <CRON_SECRET>`. Production ships with no enabled `crons` entry. Without a scheduler, a coordinator that stops with no worker in flight is noticed on the next fleet call, dashboard poll or GitHub/Linear webhook refresh. To enable Vercel Cron deliberately, set `CRON_SECRET` in the deployment and add `"crons": [{"path":"/api/cron/owner","schedule":"*/15 * * * *"}]` to `packages/dashboard/vercel.json`, then redeploy. Every 15 minutes requires a paid plan; the free plan allows a daily schedule such as `"0 9 * * *"`. The endpoint never refreshes Linear or GitHub and does nothing under the shared-password gate.
|
|
317
318
|
|
|
319
|
+
**Product analytics.** Armada's own production deployment (Vercel production built from `The-Vibe-Company/armada`) reports page views, including moves inside the app, and PostHog's default autocapture to Armada's PostHog project (US cloud). Any other deployment (a fork or another owner's copy, previews, local development, CI) reports nothing unless `NEXT_PUBLIC_POSTHOG_KEY` is set; `NEXT_PUBLIC_POSTHOG_HOST` names another PostHog host. The browser calls PostHog directly, so no dashboard cookie reaches it, and one-time codes in addresses (`user_code`, `code`, `state`) are masked before sending. The SDK loads after the page is idle. With accounts, the browser is identified by the account id with its email and name, forgotten on sign-out, and the server sends `signed_up` once when an account is created.
|
|
320
|
+
|
|
321
|
+
**Stats.** `GET /api/stats` answers `{"total_users","new_users_1d","new_users_7d","active_users_1d","active_users_7d"}` to `Authorization: Bearer <STATS_TOKEN>`; without `STATS_TOKEN` it answers 401 to everyone. Users are accounts with a confirmed address, new ones by creation time; active users are those the dashboard saw in a browser (the shell's visit beacon), not CLI use. Every number is `null` under the shared-password gate, which has no accounts.
|
|
322
|
+
|
|
318
323
|
Try it locally with synthetic data and no key:
|
|
319
324
|
|
|
320
325
|
```sh
|
package/dist/armada.js
CHANGED
|
@@ -6141,23 +6141,28 @@ function handBackProblems({ pr, repository, sha, requiredChecks }) {
|
|
|
6141
6141
|
problems.push(`the head of pull request #${pr.number} could not be read from GitHub`);
|
|
6142
6142
|
else if (sha && FULL_SHA.test(sha) && pr.headSha !== sha)
|
|
6143
6143
|
problems.push(`${sha} is not the head of pull request #${pr.number} (head is ${pr.headSha}); push, then report`);
|
|
6144
|
+
if (pr.checksComplete === false)
|
|
6145
|
+
problems.push("GitHub CI reading is incomplete; cannot verify the head checks");
|
|
6144
6146
|
problems.push(...checkProblems(pr.checks ?? [], requiredChecks));
|
|
6145
6147
|
return problems;
|
|
6146
6148
|
}
|
|
6147
6149
|
function checkIssues(checks, requiredChecks) {
|
|
6148
6150
|
const issues = [];
|
|
6149
|
-
const of = (
|
|
6150
|
-
text: `${required ? "required " : ""}check "${name}" is ${state}`,
|
|
6151
|
-
pending: state !== "failure"
|
|
6151
|
+
const of = (check, required) => ({
|
|
6152
|
+
text: `${required ? "required " : ""}check "${check.name}" is ${check.conclusion === "cancelled" ? "cancelled" : check.state}${check.runId !== undefined ? ` (run ${check.runId}, attempt ${check.runAttempt ?? "unknown"})` : ""}`,
|
|
6153
|
+
pending: check.state !== "failure"
|
|
6152
6154
|
});
|
|
6153
6155
|
if (requiredChecks.length) {
|
|
6156
|
+
for (const check of checks)
|
|
6157
|
+
if (check.workflow && check.state !== "success")
|
|
6158
|
+
issues.push(of(check, false));
|
|
6154
6159
|
for (const name of requiredChecks) {
|
|
6155
6160
|
const runs = checks.filter((c) => c.name === name);
|
|
6156
6161
|
const bad = runs.find((c) => c.state === "failure") ?? runs.find((c) => c.state !== "success");
|
|
6157
6162
|
if (!runs.length)
|
|
6158
6163
|
issues.push({ text: `required check "${name}" has not reported on the head yet`, pending: true });
|
|
6159
6164
|
else if (bad)
|
|
6160
|
-
issues.push(of(
|
|
6165
|
+
issues.push(of(bad, true));
|
|
6161
6166
|
}
|
|
6162
6167
|
} else if (!checks.length) {
|
|
6163
6168
|
issues.push({
|
|
@@ -6167,7 +6172,7 @@ function checkIssues(checks, requiredChecks) {
|
|
|
6167
6172
|
} else {
|
|
6168
6173
|
for (const c of checks)
|
|
6169
6174
|
if (c.state !== "success")
|
|
6170
|
-
issues.push(of(c
|
|
6175
|
+
issues.push(of(c, false));
|
|
6171
6176
|
}
|
|
6172
6177
|
return issues;
|
|
6173
6178
|
}
|
|
@@ -8722,14 +8727,17 @@ function normalizeMain(branch) {
|
|
|
8722
8727
|
}));
|
|
8723
8728
|
}
|
|
8724
8729
|
function normalizePull(raw, repo) {
|
|
8725
|
-
const
|
|
8726
|
-
const
|
|
8730
|
+
const commit = raw.commits.nodes[0]?.commit;
|
|
8731
|
+
const status = commit?.statusCheckRollup ?? null;
|
|
8732
|
+
const checks = headChecks(status?.contexts.nodes ?? [], commit?.checkSuites?.nodes ?? [], raw.headRefOid);
|
|
8733
|
+
const incomplete = status?.contexts.pageInfo?.hasNextPage === true || commit?.checkSuites?.pageInfo.hasNextPage === true;
|
|
8734
|
+
const ci = rollup(checks.map((c) => c.state));
|
|
8727
8735
|
return {
|
|
8728
8736
|
files: raw.files?.nodes ?? null,
|
|
8729
8737
|
additions: raw.additions ?? null,
|
|
8730
8738
|
deletions: raw.deletions ?? null,
|
|
8731
8739
|
filesComplete: !!raw.files && !raw.files.pageInfo.hasNextPage,
|
|
8732
|
-
checksComplete: !status || status.contexts.pageInfo?.hasNextPage === false,
|
|
8740
|
+
checksComplete: (!status || status.contexts.pageInfo?.hasNextPage === false) && commit?.checkSuites?.pageInfo.hasNextPage !== true,
|
|
8733
8741
|
mergeability: raw.mergeable === "CONFLICTING" || raw.mergeStateStatus === "DIRTY" ? "conflicting" : raw.mergeStateStatus === "BEHIND" ? "behind" : raw.mergeable === "MERGEABLE" ? "clean" : "unknown",
|
|
8734
8742
|
url: raw.url,
|
|
8735
8743
|
number: raw.number,
|
|
@@ -8737,8 +8745,8 @@ function normalizePull(raw, repo) {
|
|
|
8737
8745
|
title: raw.title,
|
|
8738
8746
|
state: raw.state === "OPEN" ? "open" : raw.state === "MERGED" ? "merged" : "closed",
|
|
8739
8747
|
draft: raw.isDraft,
|
|
8740
|
-
ci:
|
|
8741
|
-
checks
|
|
8748
|
+
ci: incomplete ? ci === "failure" || status?.state === "FAILURE" ? "failure" : "pending" : ci,
|
|
8749
|
+
checks,
|
|
8742
8750
|
mergeable: raw.mergeable,
|
|
8743
8751
|
headRef: raw.headRefName,
|
|
8744
8752
|
headSha: raw.headRefOid,
|
|
@@ -8747,13 +8755,71 @@ function normalizePull(raw, repo) {
|
|
|
8747
8755
|
mergedAt: raw.mergedAt
|
|
8748
8756
|
};
|
|
8749
8757
|
}
|
|
8758
|
+
function headChecks(contexts, suites, head) {
|
|
8759
|
+
const latest = new Map;
|
|
8760
|
+
const workflowRun = (suite) => suite?.commit.oid === head ? suite.workflowRun : null;
|
|
8761
|
+
for (const suite of [
|
|
8762
|
+
...suites,
|
|
8763
|
+
...contexts.flatMap((c) => c.__typename === "CheckRun" && c.checkSuite ? [c.checkSuite] : [])
|
|
8764
|
+
]) {
|
|
8765
|
+
const run = workflowRun(suite);
|
|
8766
|
+
if (!run)
|
|
8767
|
+
continue;
|
|
8768
|
+
const previous = latest.get(run.workflow.id)?.workflowRun;
|
|
8769
|
+
if (!previous || run.runNumber > previous.runNumber || run.runNumber === previous.runNumber && run.runAttempt > previous.runAttempt)
|
|
8770
|
+
latest.set(run.workflow.id, suite);
|
|
8771
|
+
}
|
|
8772
|
+
const checks = [];
|
|
8773
|
+
const represented = new Set;
|
|
8774
|
+
for (const c of contexts) {
|
|
8775
|
+
if (c.__typename === "StatusContext") {
|
|
8776
|
+
checks.push({ name: c.context, state: checkState("", c.state) });
|
|
8777
|
+
continue;
|
|
8778
|
+
}
|
|
8779
|
+
const run = workflowRun(c.checkSuite);
|
|
8780
|
+
const newestSuite = run && latest.get(run.workflow.id);
|
|
8781
|
+
const newest = newestSuite?.workflowRun;
|
|
8782
|
+
if (run && newest && (run.runNumber < newest.runNumber || run.runNumber === newest.runNumber && run.runAttempt < newest.runAttempt))
|
|
8783
|
+
continue;
|
|
8784
|
+
if (run)
|
|
8785
|
+
represented.add(run.workflow.id);
|
|
8786
|
+
const suiteCancelled = newestSuite?.status === "COMPLETED" && newestSuite.conclusion === "CANCELLED";
|
|
8787
|
+
checks.push({
|
|
8788
|
+
name: c.name,
|
|
8789
|
+
state: suiteCancelled ? "failure" : checkState(c.status, c.conclusion),
|
|
8790
|
+
...suiteCancelled || c.conclusion === "CANCELLED" ? { conclusion: "cancelled" } : {},
|
|
8791
|
+
...run?.databaseId != null ? { runId: run.databaseId, runAttempt: run.runAttempt } : {}
|
|
8792
|
+
});
|
|
8793
|
+
}
|
|
8794
|
+
for (const [id, suite] of latest) {
|
|
8795
|
+
const run = suite.workflowRun;
|
|
8796
|
+
if (!run)
|
|
8797
|
+
continue;
|
|
8798
|
+
const cancelled = suite.status === "COMPLETED" && suite.conclusion === "CANCELLED";
|
|
8799
|
+
const state = checkState(suite.status, suite.conclusion);
|
|
8800
|
+
const hasProblem = checks.some((check) => check.runId === run.databaseId && check.state !== "success");
|
|
8801
|
+
if (cancelled || !represented.has(id) && state !== "success" || suite.status && state !== "success" && !hasProblem) {
|
|
8802
|
+
checks.push({
|
|
8803
|
+
name: `workflow run ${run.databaseId ?? run.runNumber}`,
|
|
8804
|
+
state,
|
|
8805
|
+
workflow: true,
|
|
8806
|
+
...cancelled ? { conclusion: "cancelled" } : {},
|
|
8807
|
+
...run.databaseId != null ? { runId: run.databaseId, runAttempt: run.runAttempt } : {}
|
|
8808
|
+
});
|
|
8809
|
+
}
|
|
8810
|
+
}
|
|
8811
|
+
return checks;
|
|
8812
|
+
}
|
|
8813
|
+
var WORKFLOW_RUN_FIELDS = `status conclusion commit { oid } workflowRun { databaseId runNumber runAttempt workflow { id } }`;
|
|
8750
8814
|
var PULL_FIELDS = `
|
|
8751
8815
|
fragment P on PullRequest {
|
|
8752
8816
|
number title url state isDraft mergeable mergeStateStatus headRefName headRefOid createdAt updatedAt mergedAt additions deletions
|
|
8753
8817
|
files(first: 100) { nodes { path additions deletions changeType } pageInfo { hasNextPage } }
|
|
8754
|
-
commits(last: 1) { nodes { commit {
|
|
8818
|
+
commits(last: 1) { nodes { commit {
|
|
8819
|
+
checkSuites(first: 50) { nodes { ${WORKFLOW_RUN_FIELDS} } pageInfo { hasNextPage } }
|
|
8820
|
+
statusCheckRollup { state contexts(first: 50) { pageInfo { hasNextPage } nodes {
|
|
8755
8821
|
__typename
|
|
8756
|
-
... on CheckRun { name status conclusion }
|
|
8822
|
+
... on CheckRun { name status conclusion checkSuite { ${WORKFLOW_RUN_FIELDS} } }
|
|
8757
8823
|
... on StatusContext { context state }
|
|
8758
8824
|
} } } } } }
|
|
8759
8825
|
}`;
|
|
@@ -8845,7 +8911,8 @@ async function fetchForge(opts) {
|
|
|
8845
8911
|
...repo.open.pageInfo?.hasNextPage ? ["more than 100 open pull requests; the least recently updated are ignored"] : [],
|
|
8846
8912
|
...repo.open.nodes.flatMap((pr) => [
|
|
8847
8913
|
...pr.files?.pageInfo.hasNextPage ? [`PR #${pr.number}: changed files are incomplete (first 100)`] : [],
|
|
8848
|
-
...pr.commits.nodes[0]?.commit.statusCheckRollup?.contexts.pageInfo?.hasNextPage ? [`PR #${pr.number}: checks are incomplete (first 50)`] : []
|
|
8914
|
+
...pr.commits.nodes[0]?.commit.statusCheckRollup?.contexts.pageInfo?.hasNextPage ? [`PR #${pr.number}: checks are incomplete (first 50)`] : [],
|
|
8915
|
+
...pr.commits.nodes[0]?.commit.checkSuites?.pageInfo.hasNextPage ? [`PR #${pr.number}: workflow suites are incomplete (first 50)`] : []
|
|
8849
8916
|
])
|
|
8850
8917
|
]
|
|
8851
8918
|
};
|
|
@@ -8927,6 +8994,9 @@ async function fetchMergePull(opts) {
|
|
|
8927
8994
|
const raw = json.data?.repository?.pullRequest;
|
|
8928
8995
|
if (!raw)
|
|
8929
8996
|
return null;
|
|
8997
|
+
const commit = raw.commits.nodes[0]?.commit;
|
|
8998
|
+
if (raw.state === "OPEN" && (commit?.checkSuites?.pageInfo.hasNextPage || commit?.statusCheckRollup?.contexts.pageInfo?.hasNextPage))
|
|
8999
|
+
throw new GithubError("GitHub: merge CI reading is incomplete (first 50 check suites or contexts); nothing was merged");
|
|
8930
9000
|
const pr = normalizePull(raw, opts.repository);
|
|
8931
9001
|
const threads = raw.reviewThreads.nodes;
|
|
8932
9002
|
return {
|
|
@@ -9328,10 +9398,10 @@ var MERGE_QUEUE_LEASE = "merge-queue";
|
|
|
9328
9398
|
var QUEUE_STALL_MS = 2 * 60000;
|
|
9329
9399
|
var queueOpen = (e) => e.state === "queued" || e.state === "merging";
|
|
9330
9400
|
var REFUSED_SHOWN_MS = 24 * 60 * 60000;
|
|
9331
|
-
function shownQueue(entries, now) {
|
|
9401
|
+
function shownQueue(entries, now, mergedPrs = []) {
|
|
9332
9402
|
const open = entries.filter(queueOpen).sort((a, b) => Number(b.state === "merging") - Number(a.state === "merging") || a.queuedAt.localeCompare(b.queuedAt) || a.id - b.id);
|
|
9333
9403
|
const since = now.getTime() - REFUSED_SHOWN_MS;
|
|
9334
|
-
const refused = entries.filter((e) => e.state === "refused" && Date.parse(e.finishedAt ?? e.updatedAt) >= since && !entries.some((o) => o.pr === e.pr && o.id > e.id)).sort((a, b) => (b.finishedAt ?? "").localeCompare(a.finishedAt ?? "") || b.id - a.id);
|
|
9404
|
+
const refused = entries.filter((e) => e.state === "refused" && !mergedPrs.includes(e.pr) && Date.parse(e.finishedAt ?? e.updatedAt) >= since && !entries.some((o) => o.pr === e.pr && o.id > e.id)).sort((a, b) => (b.finishedAt ?? "").localeCompare(a.finishedAt ?? "") || b.id - a.id);
|
|
9335
9405
|
return [...open, ...refused];
|
|
9336
9406
|
}
|
|
9337
9407
|
|
|
@@ -13978,7 +14048,7 @@ var skills_generated_default = [
|
|
|
13978
14048
|
files: [
|
|
13979
14049
|
{
|
|
13980
14050
|
path: "MERGE.md",
|
|
13981
|
-
content: "# Merging a pull request\n\n`armada merge <pr>` merges one handed-back pull request and does everything around it. It checks the rules below, takes the project's merge lock, squash-merges pinned to the head it checked, confirms the merge on GitHub, records it on Armada, then closes the ticket in Linear and cleans up. When it refuses, fix the cause (usually: the worker fixes CI or a conflict and hands back again) rather than merging by hand.\n\n## Read the result\n\nEvery run ends with one `Result:` line. Never pipe the command through `tail` or `grep`: read that line and what precedes it.\n\n- `Result: merged #N`: merged, and the bookkeeping is done.\n- `Result: not merged (…)`: no merge was confirmed; the worker and its workspace are untouched. If it says `merge unconfirmed`, GitHub may have accepted the attempt: look at the pull request before retrying.\n- `Result: merged #N, Linear pending (armada merge --finish N)`: merged; finish Linear once it answers.\n- A result naming `Armada and Linear pending`: run the printed `armada answer <hand-back id> \"resolved: PR merged\"` line as well as `--finish`.\n- Merged at a different head from the one checked: the merge stands, the mismatch is printed, and nothing is recorded or archived. Check GitHub before finishing.\n\nA confirmed merge exits 0 even with Linear pending. `--dry-run` runs the checklist only and ends `Result: not merged`. `--json` prints one object with the same text in its `result` field.\n\n## What it checks\n\n1. The worker handed back: phase `ready-to-merge`, with the full head SHA it reported. The pull request's head is that SHA, or that SHA with only the default branch merged in (a clean merge, checked with git).\n2. GitHub says `CLEAN` (or `HAS_HOOKS`), not a draft, with a Commitizen title.\n3. Every required check (`[gates] required_checks`, else all of them) passes, and no review thread is open.\n4. The head contains the default branch, or a test merge passes `[gates] local_commands`.\n5. No merge hold is open, unless you pass `--through-hold`.\n6. With `[policy] merge_approval`, you judged it (below); a pull request sent to the owner needs their approval of that head.\n7. With `[[acceptance]]`, the checklist lists the recorded acceptance passes on the head. The worker's hand-back already required them.\n\nOne check stays yours: search the default branch for callers of anything the pull request deletes or renames.\n\nA confirmed merge clears that PR's open queue refusals and owner merge requests. The result line names the cleared item ids. A PR merged elsewhere clears those notices on the next inbox read from Armada's stored GitHub reading. Queued `--no-ticket` merges clear notices when the queue finishes; a direct `--no-ticket` merge clears them on that next reading when the refusal names the PR or the merge request carries its PR number. A failed cleanup write is a warning: GitHub's confirmed merge stays successful, and the stored reading retries resolution.\n\n## Red checks on a pull request\n\n`armada ci why <pr>` names the failing tests, shows the failed step and its test error excerpt, and explains runner problems. For unknown tests it prints up to three pasteable `[[ci.known_failure]]` blocks with exact-name patterns. Only declare a flake after it passed on a rerun of the same head: open the root-cause ticket first, then replace `<root-cause ticket>` (the parser rejects the placeholder). When no test name was found, write a specific pattern from the error lines. `armada ci why <pr> --rerun` reruns failed jobs once per completed first-attempt workflow run only when every failure is a runner problem or a declared `[[ci.known_failure]]`, and names each flake's root-cause ticket. Nothing reruns automatically. Send other failures back to the worker.\n\nNetwork outages qualify as runner problems only in setup before tests/builds run, with validated step evidence. Container image pulls in `Initialize containers` qualify for Docker’s explicit `toomanyrequests`, auth timeouts and pull timeouts; successful `Stop containers` cleanup is allowed. Registry/auth 4xx stays a failure except that explicit Docker rate limit; any later project-step failure stays unsafe. Built-in setup steps are `Set up job`, `Initialize containers` and `Run actions/*`; declare other tool/dependency downloads as exact names or `*` globs in `[ci] setup_steps`. Without step evidence, the network error stays a failure; the CLI explains unavailable evidence or hints how to declare an undeclared setup step.\n\n## After a confirmed merge\n\n`armada merge` does these by itself, in order. Do none of them by hand.\n\n1. **Records** the merge on Armada first, then closes the ticket in Linear: Done, agent labels removed, pull request linked, a merged comment saying how the merge was decided.\n2. **Tells affected workers.** Workers whose open pull request shares files with what landed get a short \"main moved\" note through their runtime; changes to `[merge] notify_paths` (CI workflows by default) or an incomplete file reading concern every working pull request. Workers without a pull request, already handed back, or owned by another coordinator stay quiet, and the output says why. A note that could not be delivered is printed: deliver it in the worker's session with the runtime guide's manual commands, after checking the claim is still that worker's and an unknown outcome did not already arrive. Never send it with `armada answer --note`, which posts it on the ticket and resolves an open plan. `--no-notify` sends nothing and prints the list instead.\n3. **Archives the merged worker's workspace** once GitHub confirmed the merge. `--no-archive` keeps it. A cleanup failure leaves the merge successful and prints the exact `armada stop <ticket> …` command to finish it; copy it whole.\n4. **Closes the spec** when this was its last open ticket, with a summary, unless the team's parent auto-close does it. A failure there is a warning only.\n5. **Lists unblocked tickets** under `Unblocked by <ticket>`: those ready to launch with their routed `armada brief <id> --prompt` command, those without a ready label, parked ones, and those that still wait on other blockers. Tickets you deferred with `armada launch --when-unblocked` are launched in the same run; one it cannot launch (a Claude Code profile, no ready label, a failed launch) keeps its request and prints the command to run.\n6. **Starts the deploy check** for each matching `[[deploy.target]]` and prints `Watching the deploy of <sha> to <target>`. If it prints an `armada deploy watch …` command instead, run that in a persistent terminal.\n7. Ends with the watch line: keep watching while workers are in flight.\n\n## Main kept moving: `--wait`\n\nWorkers hand back without chasing main, and main moves between a green hand-back and its merge. Do not send heads-up notes to handed-back workers unless you need an action: a conflict (`DIRTY`) or a requested change. A `CLEAN` or `BEHIND` pull request keeps its hand-back; use the merge to update and retest a behind branch. The automatic \"main moved\" notice tells working workers to integrate only if GitHub says `DIRTY`, resolve conflicts, rerun checks, push and hand back the new green head. Without `--wait`, a head that lacks commits of main is refused, except when GitHub does not require heads to be up to date (it does not say `BEHIND`) and `[gates] local_commands` is set: Armada then test-merges it locally and runs those commands. Run `armada merge <pr> --wait [--timeout <min>]` (30 minutes by default) in the background:\n\n- In that test-merge case `--wait` test-merges too, so a busy main does not restart CI each time. Otherwise a behind head that merges cleanly is updated with GitHub's \"update branch\" (a merge commit, no force-push), its required checks are waited for, then it merges pinned to the new head. The updated head still counts as the hand-back.\n- Before local commands, Armada warns if the installed Bun, pnpm, npm or Yarn major/minor differs from the test-merged root `package.json`'s `packageManager` pin. Run the printed alignment command when local checks disagree with CI; `armada doctor` shows the same warning. This is advisory and does not refuse a merge.\n- It holds the merge lock only while merging, so two waits never block each other.\n- It stops at once on a red check, a conflict, an open hold, any refused rule, or when GitHub refuses the update. Send the cause to the worker; after an update, the worker pulls before pushing again.\n\n## A queue: `--when-green` and `--drain`\n\nWhen several pull requests are handed back, queue them instead of merging each by hand:\n\n```sh\narmada merge --when-green 12 15 --reason \"CLI only\"\narmada merge --drain\n```\n\n- `--when-green <pr...>` records durable intent, in order, with each entry's `--reason`, `--no-ticket`, `--keep-open` or `--through-hold`. It refuses broken rules now and lets readiness (CI, a behind branch, an owner decision, a hold) wait. Queuing starts nothing.\n- `armada merge --drain` merges the queue one entry at a time, in the background in a persistent terminal. Each behind branch is updated on GitHub and its checks waited for on that exact head (`[merge] queue_retest = \"ci\"`, the default; `\"local\"` uses `[gates] local_commands` instead), so the next entry always starts on the fresh main. Each merge runs every after-merge step above.\n- An open hold pauses the drain and names it; an entry queued with `--through-hold` passes it. At `--timeout <min per entry>` a paused drain exits and the entry returns to the queue without counting an attempt: clear the hold once recovery is checked, then run the drain again. The queue stays in order: a fix queued behind a paused entry waits its turn, so remove the earlier entry first when the fix must go ahead. A refused rule removes that entry, leaves one `queue-refused` inbox item and goes on with the next: fix the cause and queue it again, which clears the item, or close it with `armada answer <id> \"<why>\"`.\n- The owner's Merge button on the dashboard queues a pull request handed back at its current head: `queued_by` is the owner, and the reason, \"merge asked on the dashboard by <owner>\", serves as the `[policy] merge_approval` judgement. Any other press stays a `merge-request` for you. Queued entries with a free `merge-queue` lease and no change for 2 minutes show one `queue-stalled` item per stall: run `armada merge --drain`. The project page and `armada status` (\"Merge queue\") show the queue and the drain's current step.\n- Temporary failures retry three times (after 1, 5 and 15 minutes). A killed drain resumes its entry, reading GitHub first so a merge is never done twice. One drain runs per project; `--json` prints one object per line.\n- `armada merge queue` lists the queue and entries finished in the last day; `armada merge queue remove <pr>` removes one that has not started.\n\n## The owner's merge rule: `--reason` and `--ask-owner`\n\n`[policy] merge_approval` says in plain words which merges the owner approves first. Without it, merge on your own. With it, `armada merge` prints the rule; judge each pull request by its files and what users will see:\n\n- It may merge on its own: `armada merge <pr> --reason \"<why>\"`, for example `--reason \"CLI only\"`.\n- The rule keeps it for the owner: `armada merge <pr> --ask-owner --reason \"<why>\"`. It merges nothing. It puts the pull request (title, files, CI, preview, the ticket's screenshots) on the owner's Validations page and prints the approval link: send it with one question judged in about a minute, never a diff to read. Their decision arrives as a `decision` item; then `armada merge <pr>`. A new head, other than main merged in, needs a new approval.\n\n## A ticket in several pull requests\n\nA hand-back with `--more-prs \"<what remains>\"` is one part of its ticket. Merge it as usual: every check applies. After the merge the ticket returns to `implementing`, its worker stays signed in with its workspace, and Armada tells it to start the next part from the updated main. The final pull request, handed back without the flag, closes the ticket as usual. `armada merge <pr> --keep-open` keeps a ticket open when the hand-back did not say so; `--close` closes it despite the flag. Neither goes with `--no-ticket` or with the other.\n\n## No ticket: `--no-ticket`\n\n`armada merge <pr> --no-ticket` merges a pull request no ticket owns: the `armada init` pull request or a release pull request. Nothing is written to Linear; every other check stays. A branch named after a ticket is refused unless you add `--reason \"<why the ticket stays open>\"`, which is posted on the pull request. When none of the required checks ran on the head (a release pull request opened with the workflow's own token), it passes on GitHub's own state once the head is a minute old.\n\n## Linear is down\n\nAfter its retries, a Linear outage does not stop a merge when Armada holds an open hand-back for the same pull request and exact head: the command says `Linear did not answer; the hand-back was checked on Armada`. After the merge, the remaining Linear work becomes a `linear-pending` inbox item, `Finish Linear for #N`. Run `armada merge --finish <pr>` once Linear answers: it checks GitHub shows the merge, completes the ticket, and resolves the item. Repeating it writes nothing more; it also finishes a pull request merged by hand. Without a matching hand-back on Armada, the merge is refused and nothing is merged.\n\n## Holds, main red and deploys\n\n- `armada hold` lists the project's merge holds, shared by every coordinator; status, inbox and watch show them until cleared. They never expire.\n- `armada hold add \"<reason>\"` pauses merges. `armada merge <pr> --through-hold \"<why this fixes it>\"` merges a fix and records the reason with every hold id; the holds stay open. After verifying the recovery, `armada hold clear <id> --reason \"<what was verified>\"`.\n- `main red since #N` names the oldest failing merge since the last green commit and its failing checks; `a fix is running (#M)` follows when one is. A refreshed red main reading opens one `main-red` hold and wakes watch once per streak. It pauses single merges and the queue; merge the fix with `armada merge <pr> --through-hold \"<why this fixes it>\"`. The next green main reading clears that hold and its inbox item automatically. Running or absent checks leave it open. Clearing it by hand while main is red lets the next refresh reopen it. GitHub CI webhooks are needed for prompt detection; without refreshes no automatic pause opens.\n- With `[[deploy.target]]`, each merge starts a watcher. A failed deploy or smoke check opens a `deploy` hold and one inbox item. `armada deploy status` shows each target; `not deployed (host skipped: …)` ends quietly, opens no hold and does not clear an ancestor’s failure. Retry a failed deploy with `armada deploy retry <target>`; use `--no-redeploy` to recheck after a redeploy on the host. Never `hold clear` a deploy hold before a recheck says healthy. Merge a code fix through the hold; the next healthy deploy of a commit that contains it clears the deploy hold by itself.\n- `--no-lock` skips both the merge lock and the hold check. Use it only when Armada is down and you checked no other coordinator is merging.\n\n## Live acceptance\n\n`[[acceptance]]` declares live checks (a real build, a preview run) with their paths, timeouts and run caps. A worker runs `armada acceptance run` on its pushed head before handing back, and the hand-back is refused without a pass on that exact head. When a worker reaches the cap, judge the cause, then `armada acceptance allow <ticket> --runs 2 --reason \"<why>\"`.\n\n## The release pull request\n\nSome repositories publish through release-please: every merge opens or updates one release pull request (`chore(main): release <version>`, label `autorelease: pending`, a diff of the changelog, manifest and version fields only). Follow the repository's release rules (`AGENTS.md`).\n\n- On a release train, leave it open: the scheduled run merges and publishes it. For an urgent fix, run the release workflow the rules name, for example `gh workflow run release.yml`.\n- Where the rules ask you to merge it, use `armada merge <n> --no-ticket`. No CI runs on it and it often shows `UNSTABLE`; both are expected. Anything else in its diff, or `DIRTY`, is not: stop and tell the owner.\n- After the release run, check the registry (for example `npm view <package> version`). If it did not publish, fix the cause and re-run the failed jobs of that run: a later push does not publish a version already tagged.\n\n## By hand\n\nOnly when `armada merge` cannot run, and following the same checks:\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- One merge at a time per project.\n- Leave out `--delete-branch`: it deletes local worktrees that have the branch checked out, including other agents'.\n- On a GitHub 5xx, check `gh pr view <n> --json state` before retrying.\n- Then run `armada merge --finish <n>` to close the ticket, and `armada stop <ticket>` to archive the worker.\n- Finally, for every target declared in `[[deploy.target]]`, run `armada deploy watch --sha <merge commit sha> --target <name>` in the background. Wait for its healthy deploy and smoke result before resuming normal merges; a failure keeps the deploy hold open. With no declared targets, there is no deploy check.\n\n## The loop’s hand-back\n\nA hand-back shown as `queued in the merge queue (position N)` or `merging: <drain step>` needs no new action; keep the drain running. A note that sends a worker back to work leaves the hand-back until that worker reports its resumed phase, which clears it; its next `ready-to-merge` report wakes the watch again.\n\nA `hand-back` entry means the worker reported `ready-to-merge` with green CI, resolved review threads and the full head SHA. Merge it with `armada merge <pr>`, following [MERGE.md](MERGE.md). The command checks everything, merges pinned to the handed-back head under the project's merge lock, and then, by itself:\n\n- archives the merged worker's workspace once GitHub confirms the merge (never archive by hand before that; `--no-archive` keeps it);\n- tells the working workers it concerns that main moved: those whose open pull requests share files with what landed, or all of them when `[merge] notify_paths` matched or the file reading was incomplete (never send those notes yourself);\n- closes the ticket, closes its spec when it was the last open ticket, and lists the tickets it unblocked, launching those you deferred when it can;\n- starts the deploy check when `[[deploy.target]]` is set;\n- ends with one `Result:` line. Read it: `Result: merged #N` is done; `Result: not merged (…)` confirmed no merge (if it says `merge unconfirmed`, look at GitHub before retrying); `Linear pending` means run `armada merge --finish <pr>` once Linear answers.\n\nWorkers hand back without chasing main, so a head is often behind: add `--wait` in the background; it updates it on GitHub and waits for its checks (without it, a behind head is refused unless `[gates] local_commands` can test-merge it). Several hand-backs at once: queue them with `armada merge --when-green <pr...>` and run `armada merge --drain` in the background; it merges them one at a time, each retested on fresh main. With `[policy] merge_approval`, judge each pull request and pass `--reason \"<why>\"`, or `--ask-owner --reason \"<why>\"` to send it to the owner first. A hand-back with `--more-prs` keeps its ticket and worker open after the merge; `--keep-open` and `--close` override that.\n\nDone when the pull request is merged, the result line says so, and nothing it printed is left to do.\n"
|
|
14051
|
+
content: "# Merging a pull request\n\n`armada merge <pr>` merges one handed-back pull request and does everything around it. It checks the rules below, takes the project's merge lock, squash-merges pinned to the head it checked, confirms the merge on GitHub, records it on Armada, then closes the ticket in Linear and cleans up. When it refuses, fix the cause (usually: the worker fixes CI or a conflict and hands back again) rather than merging by hand.\n\n## Read the result\n\nEvery run ends with one `Result:` line. Never pipe the command through `tail` or `grep`: read that line and what precedes it.\n\n- `Result: merged #N`: merged, and the bookkeeping is done.\n- `Result: not merged (…)`: no merge was confirmed; the worker and its workspace are untouched. If it says `merge unconfirmed`, GitHub may have accepted the attempt: look at the pull request before retrying.\n- `Result: merged #N, Linear pending (armada merge --finish N)`: merged; finish Linear once it answers.\n- A result naming `Armada and Linear pending`: run the printed `armada answer <hand-back id> \"resolved: PR merged\"` line as well as `--finish`.\n- Merged at a different head from the one checked: the merge stands, the mismatch is printed, and nothing is recorded or archived. Check GitHub before finishing.\n\nA confirmed merge exits 0 even with Linear pending. `--dry-run` runs the checklist only and ends `Result: not merged`. `--json` prints one object with the same text in its `result` field.\n\n## What it checks\n\n1. The worker handed back: phase `ready-to-merge`, with the full head SHA it reported. The pull request's head is that SHA, or that SHA with only the default branch merged in (a clean merge, checked with git).\n2. GitHub says `CLEAN` (or `HAS_HOOKS`), not a draft, with a Commitizen title.\n3. Every required check (`[gates] required_checks`, else all of them) passes, and no review thread is open.\n4. The head contains the default branch, or a test merge passes `[gates] local_commands`.\n5. No merge hold is open, unless you pass `--through-hold`.\n6. With `[policy] merge_approval`, you judged it (below); a pull request sent to the owner needs their approval of that head.\n7. With `[[acceptance]]`, the checklist lists the recorded acceptance passes on the head. The worker's hand-back already required them.\n\nOne check stays yours: search the default branch for callers of anything the pull request deletes or renames.\n\nA confirmed merge clears that PR's open queue refusals and owner merge requests. The result line names the cleared item ids. A PR merged elsewhere clears those notices on the next inbox read from Armada's stored GitHub reading. Queued `--no-ticket` merges clear notices when the queue finishes; a direct `--no-ticket` merge clears them on that next reading when the refusal names the PR or the merge request carries its PR number. A failed cleanup write is a warning: GitHub's confirmed merge stays successful, and the stored reading retries resolution.\n\n## Red checks on a pull request\n\nThe checklist, `--wait` and queue drain judge the newest run of each GitHub Actions workflow on the exact head, by workflow identity and run number/attempt. A cancelled older run replaced on that head does not block; a running replacement is waited for. A newest cancelled check still blocks as `cancelled`, with its run ID and attempt in the refusal. Checks without workflow metadata and external statuses remain independent; incomplete GitHub check readings refuse the merge. This does not rerun CI or change the pinned-SHA merge.\n\n`armada ci why <pr>` names the failing tests, shows the failed step and its test error excerpt, and explains runner problems. For unknown tests it prints up to three pasteable `[[ci.known_failure]]` blocks with exact-name patterns. Only declare a flake after it passed on a rerun of the same head: open the root-cause ticket first, then replace `<root-cause ticket>` (the parser rejects the placeholder). When no test name was found, write a specific pattern from the error lines. `armada ci why <pr> --rerun` reruns failed jobs once per completed first-attempt workflow run only when every failure is a runner problem or a declared `[[ci.known_failure]]`, and names each flake's root-cause ticket. Nothing reruns automatically. Send other failures back to the worker.\n\nNetwork outages qualify as runner problems only in setup before tests/builds run, with validated step evidence. Container image pulls in `Initialize containers` qualify for Docker’s explicit `toomanyrequests`, auth timeouts and pull timeouts; successful `Stop containers` cleanup is allowed. Registry/auth 4xx stays a failure except that explicit Docker rate limit; any later project-step failure stays unsafe. Built-in setup steps are `Set up job`, `Initialize containers` and `Run actions/*`; declare other tool/dependency downloads as exact names or `*` globs in `[ci] setup_steps`. Without step evidence, the network error stays a failure; the CLI explains unavailable evidence or hints how to declare an undeclared setup step.\n\n## After a confirmed merge\n\n`armada merge` does these by itself, in order. Do none of them by hand.\n\n1. **Records** the merge on Armada first, then closes the ticket in Linear: Done, agent labels removed, pull request linked, a merged comment saying how the merge was decided.\n2. **Tells affected workers.** Workers whose open pull request shares files with what landed get a short \"main moved\" note through their runtime; changes to `[merge] notify_paths` (CI workflows by default) or an incomplete file reading concern every working pull request. Workers without a pull request, already handed back, or owned by another coordinator stay quiet, and the output says why. A note that could not be delivered is printed: deliver it in the worker's session with the runtime guide's manual commands, after checking the claim is still that worker's and an unknown outcome did not already arrive. Never send it with `armada answer --note`, which posts it on the ticket and resolves an open plan. `--no-notify` sends nothing and prints the list instead.\n3. **Archives the merged worker's workspace** once GitHub confirmed the merge. `--no-archive` keeps it. A cleanup failure leaves the merge successful and prints the exact `armada stop <ticket> …` command to finish it; copy it whole.\n4. **Closes the spec** when this was its last open ticket, with a summary, unless the team's parent auto-close does it. A failure there is a warning only.\n5. **Lists unblocked tickets** under `Unblocked by <ticket>`: those ready to launch with their routed `armada brief <id> --prompt` command, those without a ready label, parked ones, and those that still wait on other blockers. Tickets you deferred with `armada launch --when-unblocked` are launched in the same run; one it cannot launch (a Claude Code profile, no ready label, a failed launch) keeps its request and prints the command to run.\n6. **Starts the deploy check** for each matching `[[deploy.target]]` and prints `Watching the deploy of <sha> to <target>`. If it prints an `armada deploy watch …` command instead, run that in a persistent terminal.\n7. Ends with the watch line: keep watching while workers are in flight.\n\n## Main kept moving: `--wait`\n\nWorkers hand back without chasing main, and main moves between a green hand-back and its merge. Do not send heads-up notes to handed-back workers unless you need an action: a conflict (`DIRTY`) or a requested change. A `CLEAN` or `BEHIND` pull request keeps its hand-back; use the merge to update and retest a behind branch. The automatic \"main moved\" notice tells working workers to integrate only if GitHub says `DIRTY`, resolve conflicts, rerun checks, push and hand back the new green head. Without `--wait`, a head that lacks commits of main is refused, except when GitHub does not require heads to be up to date (it does not say `BEHIND`) and `[gates] local_commands` is set: Armada then test-merges it locally and runs those commands. Run `armada merge <pr> --wait [--timeout <min>]` (30 minutes by default) in the background:\n\n- In that test-merge case `--wait` test-merges too, so a busy main does not restart CI each time. Otherwise a behind head that merges cleanly is updated with GitHub's \"update branch\" (a merge commit, no force-push), its required checks are waited for, then it merges pinned to the new head. The updated head still counts as the hand-back.\n- Before local commands, Armada warns if the installed Bun, pnpm, npm or Yarn major/minor differs from the test-merged root `package.json`'s `packageManager` pin. Run the printed alignment command when local checks disagree with CI; `armada doctor` shows the same warning. This is advisory and does not refuse a merge.\n- It holds the merge lock only while merging, so two waits never block each other.\n- It stops at once on a red check, a conflict, an open hold, any refused rule, or when GitHub refuses the update. Send the cause to the worker; after an update, the worker pulls before pushing again.\n\n## A queue: `--when-green` and `--drain`\n\nWhen several pull requests are handed back, queue them instead of merging each by hand:\n\n```sh\narmada merge --when-green 12 15 --reason \"CLI only\"\narmada merge --drain\n```\n\n- `--when-green <pr...>` records durable intent, in order, with each entry's `--reason`, `--no-ticket`, `--keep-open` or `--through-hold`. It refuses broken rules now and lets readiness (CI, a behind branch, an owner decision, a hold) wait. Queuing starts nothing.\n- `armada merge --drain` merges the queue one entry at a time, in the background in a persistent terminal. Each behind branch is updated on GitHub and its checks waited for on that exact head (`[merge] queue_retest = \"ci\"`, the default; `\"local\"` uses `[gates] local_commands` instead), so the next entry always starts on the fresh main. Each merge runs every after-merge step above.\n- An open hold pauses the drain and names it; an entry queued with `--through-hold` passes it. At `--timeout <min per entry>` a paused drain exits and the entry returns to the queue without counting an attempt: clear the hold once recovery is checked, then run the drain again. The queue stays in order: a fix queued behind a paused entry waits its turn, so remove the earlier entry first when the fix must go ahead. A refused rule removes that entry, leaves one `queue-refused` inbox item and goes on with the next: fix the cause and queue it again, which clears the item, or close it with `armada answer <id> \"<why>\"`.\n- The owner's Merge button on the dashboard queues a pull request handed back at its current head: `queued_by` is the owner, and the reason, \"merge asked on the dashboard by <owner>\", serves as the `[policy] merge_approval` judgement. Any other press stays a `merge-request` for you. Queued entries with a free `merge-queue` lease and no change for 2 minutes show one `queue-stalled` item per stall: run `armada merge --drain`. The project page and `armada status` (\"Merge queue\") show the queue and the drain's current step.\n- Temporary failures retry three times (after 1, 5 and 15 minutes). A killed drain resumes its entry, reading GitHub first so a merge is never done twice. One drain runs per project; `--json` prints one object per line.\n- `armada merge queue` lists the queue and entries finished in the last day. Refusals disappear from it and status once GitHub reports the PR merged or a newer queue attempt supersedes them; the newest unresolved refusal stays visible. If GitHub is unavailable, refusals remain until a later successful read; `armada merge queue remove <pr>` removes one that has not started.\n\n## The owner's merge rule: `--reason` and `--ask-owner`\n\n`[policy] merge_approval` says in plain words which merges the owner approves first. Without it, merge on your own. With it, `armada merge` prints the rule; judge each pull request by its files and what users will see:\n\n- It may merge on its own: `armada merge <pr> --reason \"<why>\"`, for example `--reason \"CLI only\"`.\n- The rule keeps it for the owner: `armada merge <pr> --ask-owner --reason \"<why>\"`. It merges nothing. It puts the pull request (title, files, CI, preview, the ticket's screenshots) on the owner's Validations page and prints the approval link: send it with one question judged in about a minute, never a diff to read. Their decision arrives as a `decision` item; then `armada merge <pr>`. A new head, other than main merged in, needs a new approval.\n\n## A ticket in several pull requests\n\nA hand-back with `--more-prs \"<what remains>\"` is one part of its ticket. Merge it as usual: every check applies. After the merge the ticket returns to `implementing`, its worker stays signed in with its workspace, and Armada tells it to start the next part from the updated main. The final pull request, handed back without the flag, closes the ticket as usual. `armada merge <pr> --keep-open` keeps a ticket open when the hand-back did not say so; `--close` closes it despite the flag. Neither goes with `--no-ticket` or with the other.\n\n## No ticket: `--no-ticket`\n\n`armada merge <pr> --no-ticket` merges a pull request no ticket owns: the `armada init` pull request or a release pull request. Nothing is written to Linear; every other check stays. A branch named after a ticket is refused unless you add `--reason \"<why the ticket stays open>\"`, which is posted on the pull request. When none of the required checks ran on the head (a release pull request opened with the workflow's own token), it passes on GitHub's own state once the head is a minute old.\n\n## Linear is down\n\nAfter its retries, a Linear outage does not stop a merge when Armada holds an open hand-back for the same pull request and exact head: the command says `Linear did not answer; the hand-back was checked on Armada`. After the merge, the remaining Linear work becomes a `linear-pending` inbox item, `Finish Linear for #N`. Run `armada merge --finish <pr>` once Linear answers: it checks GitHub shows the merge, completes the ticket, and resolves the item. Repeating it writes nothing more; it also finishes a pull request merged by hand. Without a matching hand-back on Armada, the merge is refused and nothing is merged.\n\n## Holds, main red and deploys\n\n- `armada hold` lists the project's merge holds, shared by every coordinator; status, inbox and watch show them until cleared. They never expire.\n- `armada hold add \"<reason>\"` pauses merges. `armada merge <pr> --through-hold \"<why this fixes it>\"` merges a fix and records the reason with every hold id; the holds stay open. After verifying the recovery, `armada hold clear <id> --reason \"<what was verified>\"`.\n- `main red since #N` names the oldest failing merge since the last green commit and its failing checks; `a fix is running (#M)` follows when one is. A refreshed red main reading opens one `main-red` hold and wakes watch once per streak. It pauses single merges and the queue; merge the fix with `armada merge <pr> --through-hold \"<why this fixes it>\"`. The next green main reading clears that hold and its inbox item automatically. Running or absent checks leave it open. Clearing it by hand while main is red lets the next refresh reopen it. GitHub CI webhooks are needed for prompt detection; without refreshes no automatic pause opens.\n- With `[[deploy.target]]`, each merge starts a watcher. A failed deploy or smoke check opens a `deploy` hold and one inbox item. `armada deploy status` shows each target; `not deployed (host skipped: …)` ends quietly, opens no hold and does not clear an ancestor’s failure. Retry a failed deploy with `armada deploy retry <target>`; use `--no-redeploy` to recheck after a redeploy on the host. Never `hold clear` a deploy hold before a recheck says healthy. Merge a code fix through the hold; the next healthy deploy of a commit that contains it clears the deploy hold by itself.\n- `--no-lock` skips both the merge lock and the hold check. Use it only when Armada is down and you checked no other coordinator is merging.\n\n## Live acceptance\n\n`[[acceptance]]` declares live checks (a real build, a preview run) with their paths, timeouts and run caps. A worker runs `armada acceptance run` on its pushed head before handing back, and the hand-back is refused without a pass on that exact head. When a worker reaches the cap, judge the cause, then `armada acceptance allow <ticket> --runs 2 --reason \"<why>\"`.\n\n## The release pull request\n\nSome repositories publish through release-please: every merge opens or updates one release pull request (`chore(main): release <version>`, label `autorelease: pending`, a diff of the changelog, manifest and version fields only). Follow the repository's release rules (`AGENTS.md`).\n\n- On a release train, leave it open: the scheduled run merges and publishes it. For an urgent fix, run the release workflow the rules name, for example `gh workflow run release.yml`.\n- Where the rules ask you to merge it, use `armada merge <n> --no-ticket`. No CI runs on it and it often shows `UNSTABLE`; both are expected. Anything else in its diff, or `DIRTY`, is not: stop and tell the owner.\n- After the release run, check the registry (for example `npm view <package> version`). If it did not publish, fix the cause and re-run the failed jobs of that run: a later push does not publish a version already tagged.\n\n## By hand\n\nOnly when `armada merge` cannot run, and following the same checks:\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- One merge at a time per project.\n- Leave out `--delete-branch`: it deletes local worktrees that have the branch checked out, including other agents'.\n- On a GitHub 5xx, check `gh pr view <n> --json state` before retrying.\n- Then run `armada merge --finish <n>` to close the ticket, and `armada stop <ticket>` to archive the worker.\n- Finally, for every target declared in `[[deploy.target]]`, run `armada deploy watch --sha <merge commit sha> --target <name>` in the background. Wait for its healthy deploy and smoke result before resuming normal merges; a failure keeps the deploy hold open. With no declared targets, there is no deploy check.\n\n## The loop’s hand-back\n\nA hand-back shown as `queued in the merge queue (position N)` or `merging: <drain step>` needs no new action; keep the drain running. A note that sends a worker back to work leaves the hand-back until that worker reports its resumed phase, which clears it; its next `ready-to-merge` report wakes the watch again.\n\nA `hand-back` entry means the worker reported `ready-to-merge` with green CI, resolved review threads and the full head SHA. Merge it with `armada merge <pr>`, following [MERGE.md](MERGE.md). The command checks everything, merges pinned to the handed-back head under the project's merge lock, and then, by itself:\n\n- archives the merged worker's workspace once GitHub confirms the merge (never archive by hand before that; `--no-archive` keeps it);\n- tells the working workers it concerns that main moved: those whose open pull requests share files with what landed, or all of them when `[merge] notify_paths` matched or the file reading was incomplete (never send those notes yourself);\n- closes the ticket, closes its spec when it was the last open ticket, and lists the tickets it unblocked, launching those you deferred when it can;\n- starts the deploy check when `[[deploy.target]]` is set;\n- ends with one `Result:` line. Read it: `Result: merged #N` is done; `Result: not merged (…)` confirmed no merge (if it says `merge unconfirmed`, look at GitHub before retrying); `Linear pending` means run `armada merge --finish <pr>` once Linear answers.\n\nWorkers hand back without chasing main, so a head is often behind: add `--wait` in the background; it updates it on GitHub and waits for its checks (without it, a behind head is refused unless `[gates] local_commands` can test-merge it). Several hand-backs at once: queue them with `armada merge --when-green <pr...>` and run `armada merge --drain` in the background; it merges them one at a time, each retested on fresh main. With `[policy] merge_approval`, judge each pull request and pass `--reason \"<why>\"`, or `--ask-owner --reason \"<why>\"` to send it to the owner first. A hand-back with `--more-prs` keeps its ticket and worker open after the merge; `--keep-open` and `--close` override that.\n\nDone when the pull request is merged, the result line says so, and nothing it printed is left to do.\n"
|
|
13982
14052
|
},
|
|
13983
14053
|
{
|
|
13984
14054
|
path: "REFERENCE.md",
|
|
@@ -18050,7 +18120,7 @@ function buildStatus({
|
|
|
18050
18120
|
...launchWhenUnblocked ? { launchWhenUnblocked } : {},
|
|
18051
18121
|
...slots ? { slots } : {},
|
|
18052
18122
|
...holds ? { holds } : {},
|
|
18053
|
-
...queue ? { queue: shownQueue(queue, now) } : {},
|
|
18123
|
+
...queue ? { queue: shownQueue(queue, now, forge?.prs.filter((p) => p.state === "merged").map((p) => p.number) ?? []) } : {},
|
|
18054
18124
|
main: forge?.main ? mainHealth(forge.main, config.gates.requiredChecks, forge.mainComplete) : null,
|
|
18055
18125
|
progress: {
|
|
18056
18126
|
done: m.program.filter((ticket) => m.isLeaf(ticket) && isDone(ticket)).length,
|
|
@@ -18436,7 +18506,7 @@ ${attachments.join(`
|
|
|
18436
18506
|
};
|
|
18437
18507
|
}
|
|
18438
18508
|
// package.json
|
|
18439
|
-
var version = "0.2.
|
|
18509
|
+
var version = "0.2.67";
|
|
18440
18510
|
|
|
18441
18511
|
// src/io.ts
|
|
18442
18512
|
class UsageError extends Error {
|
|
@@ -27534,7 +27604,31 @@ async function merge2(io, config, credentials, a, configPath, guards) {
|
|
|
27534
27604
|
}
|
|
27535
27605
|
if (a.rest.length !== 1)
|
|
27536
27606
|
throw new UsageError("use armada merge queue [--json] or armada merge queue remove <pr>");
|
|
27537
|
-
const
|
|
27607
|
+
const history = await fleet.queueList();
|
|
27608
|
+
const now = (io.now ?? (() => new Date))();
|
|
27609
|
+
const candidates = shownQueue(history, now).filter((entry) => entry.state === "refused");
|
|
27610
|
+
const merged = [];
|
|
27611
|
+
if (credentials.githubToken) {
|
|
27612
|
+
const token = credentials.githubToken;
|
|
27613
|
+
const results = await Promise.allSettled(candidates.map((entry) => fetchPullRequest({
|
|
27614
|
+
token,
|
|
27615
|
+
repository: config.github.repository,
|
|
27616
|
+
number: entry.pr,
|
|
27617
|
+
...httpOptions(io)
|
|
27618
|
+
})));
|
|
27619
|
+
for (const result of results) {
|
|
27620
|
+
if (result.status === "fulfilled" && result.value?.state === "merged")
|
|
27621
|
+
merged.push(result.value.number);
|
|
27622
|
+
}
|
|
27623
|
+
if (results.some((result) => result.status === "rejected"))
|
|
27624
|
+
io.stderr(`Warning: GitHub could not be read for some refused PRs; their refusals remain shown.
|
|
27625
|
+
`);
|
|
27626
|
+
} else if (candidates.length) {
|
|
27627
|
+
io.stderr(`Warning: GitHub was not read (no token); unresolved refusals remain shown.
|
|
27628
|
+
`);
|
|
27629
|
+
}
|
|
27630
|
+
const visible = new Set(shownQueue(history, now, merged).map((entry) => entry.id));
|
|
27631
|
+
const entries = history.filter((entry) => entry.state !== "refused" || visible.has(entry.id));
|
|
27538
27632
|
const watch = await queueWatch();
|
|
27539
27633
|
io.stdout(a.json ? `${JSON.stringify({ entries, holds: [], watch, result: "Result: not merged (queue listed; nothing was merged)" }, null, 2)}
|
|
27540
27634
|
` : entries.length ? `${queueLines(entries).join(`
|