@the-vibe-company/armada 0.2.61 → 0.2.62
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 +10 -2
- package/dist/armada.js +348 -124
- package/package.json +1 -1
package/dist/armada.js
CHANGED
|
@@ -1494,6 +1494,23 @@ import { basename as basename4, dirname as dirname14, join as join11, resolve as
|
|
|
1494
1494
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
1495
1495
|
|
|
1496
1496
|
// ../core/src/http.ts
|
|
1497
|
+
class UnreadableAnswer extends Error {
|
|
1498
|
+
status;
|
|
1499
|
+
constructor(status) {
|
|
1500
|
+
super(`unreadable answer (HTTP ${status})`);
|
|
1501
|
+
this.status = status;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
async function readJson(response) {
|
|
1505
|
+
try {
|
|
1506
|
+
return await response.json();
|
|
1507
|
+
} catch (error) {
|
|
1508
|
+
if (error instanceof SyntaxError)
|
|
1509
|
+
throw new UnreadableAnswer(response.status);
|
|
1510
|
+
throw error;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1497
1514
|
class HttpRequestError extends Error {
|
|
1498
1515
|
attempts;
|
|
1499
1516
|
transient;
|
|
@@ -1630,14 +1647,16 @@ async function httpRequest(url, init, opts, read) {
|
|
|
1630
1647
|
if (init.signal?.aborted || error instanceof Error && error.name === "AbortError" && !deadline.aborted)
|
|
1631
1648
|
throw error;
|
|
1632
1649
|
const cause = deadline.aborted ? deadline.reason : error;
|
|
1633
|
-
const
|
|
1650
|
+
const unreadable = cause instanceof UnreadableAnswer;
|
|
1651
|
+
const retryable = transient(cause) || unreadable && !!opts.retry && !!response?.ok;
|
|
1652
|
+
const transport = fetchFailed || deadline.aborted || transient(cause) || unreadable;
|
|
1634
1653
|
if (!transport)
|
|
1635
1654
|
throw error;
|
|
1636
|
-
if (attempt < attempts && transportRetries < 1 && (!response || response.ok) &&
|
|
1655
|
+
if (attempt < attempts && transportRetries < 1 && (!response || response.ok) && retryable) {
|
|
1637
1656
|
transportRetries++;
|
|
1638
1657
|
continue;
|
|
1639
1658
|
}
|
|
1640
|
-
throw new HttpRequestError(cause, limit, attempt,
|
|
1659
|
+
throw new HttpRequestError(cause, limit, attempt, retryable);
|
|
1641
1660
|
} finally {
|
|
1642
1661
|
deadline.removeEventListener("abort", onDeadline);
|
|
1643
1662
|
controller.abort();
|
|
@@ -1680,7 +1699,7 @@ var installCommand = (version) => `npm install -g ${CLI_PACKAGE}@${version}`;
|
|
|
1680
1699
|
var upgradeLine = (version, install) => `Armada ${version} is older than this server expects: ${installCommand(install)}`;
|
|
1681
1700
|
var releaseNotesUrl = (version) => `https://github.com/The-Vibe-Company/armada/releases/tag/v${version}`;
|
|
1682
1701
|
var newerRelease = (running, latest) => latest && running !== "0.0.0" && compareVersions(latest, running) > 0 ? latest : null;
|
|
1683
|
-
var releaseLine = (running, latest, { setupBehind }) => `Armada
|
|
1702
|
+
var releaseLine = (running, latest, { setupBehind }) => setupBehind ? `This project's Armada setup is behind ${latest}: armada upgrade, then merge the setup pull request it opens.` : `Armada ${latest} is out (you run ${running}): armada upgrade. Changes: ${releaseNotesUrl(latest)}`;
|
|
1684
1703
|
|
|
1685
1704
|
class ArmadaApiError extends Error {
|
|
1686
1705
|
next;
|
|
@@ -2065,6 +2084,23 @@ function deployDetail(output) {
|
|
|
2065
2084
|
}
|
|
2066
2085
|
return tail.reverse().join("");
|
|
2067
2086
|
}
|
|
2087
|
+
function checkReading(result, sha) {
|
|
2088
|
+
const pending = { sha: null, state: "pending", detail: result.detail };
|
|
2089
|
+
if (result.notRunnable)
|
|
2090
|
+
return { ...pending, notRunnable: true };
|
|
2091
|
+
if (result.timedOut)
|
|
2092
|
+
return { ...pending, detail: "check timed out" };
|
|
2093
|
+
if (result.outputExceeded)
|
|
2094
|
+
return { ...pending, detail: "check output exceeded limit" };
|
|
2095
|
+
const last = result.stdout.trim().split(`
|
|
2096
|
+
`).at(-1)?.trim() ?? "";
|
|
2097
|
+
const reportedSha = /^[0-9a-f]{40}$/i.test(last) ? last.toLowerCase() : sha;
|
|
2098
|
+
if (result.code === 0 || result.code === 1)
|
|
2099
|
+
return { sha: reportedSha, state: result.code === 0 ? "success" : "failure", detail: result.detail };
|
|
2100
|
+
if (result.code === 2)
|
|
2101
|
+
return last.startsWith("skipped") ? { ...pending, state: "skipped", detail: last.slice("skipped".length).replace(/^[:\s]+/, "") } : pending;
|
|
2102
|
+
return { ...pending, detail: `check exited ${result.code}; the contract is 0 live, 1 failed, 2 pending or skipped` };
|
|
2103
|
+
}
|
|
2068
2104
|
async function watchDeploy(o) {
|
|
2069
2105
|
const deadline = (o.startedAt ?? o.now()).getTime() + o.target.timeoutMinutes * 60000;
|
|
2070
2106
|
let detail = "waiting for the merge commit";
|
|
@@ -2074,7 +2110,7 @@ async function watchDeploy(o) {
|
|
|
2074
2110
|
sha: o.sha,
|
|
2075
2111
|
state,
|
|
2076
2112
|
detail: deployDetail(detail),
|
|
2077
|
-
pauseOnFailure: state !== "not-runnable" && o.target.pauseOnFailure,
|
|
2113
|
+
pauseOnFailure: state !== "not-runnable" && state !== "not-deployed" && o.target.pauseOnFailure,
|
|
2078
2114
|
liveSha
|
|
2079
2115
|
});
|
|
2080
2116
|
await record("waiting");
|
|
@@ -2106,6 +2142,10 @@ async function watchDeploy(o) {
|
|
|
2106
2142
|
await record("not-runnable");
|
|
2107
2143
|
return "not-runnable";
|
|
2108
2144
|
}
|
|
2145
|
+
if (live.state === "skipped") {
|
|
2146
|
+
await record("not-deployed");
|
|
2147
|
+
return "not-deployed";
|
|
2148
|
+
}
|
|
2109
2149
|
let includes = live.sha === o.sha;
|
|
2110
2150
|
if (live.sha && !includes) {
|
|
2111
2151
|
try {
|
|
@@ -2115,6 +2155,8 @@ async function watchDeploy(o) {
|
|
|
2115
2155
|
could not compare the live commit; retrying`;
|
|
2116
2156
|
}
|
|
2117
2157
|
}
|
|
2158
|
+
if (!includes && live.sha && live.state === "success" && o.target.check)
|
|
2159
|
+
detail = `check reported live ${live.sha}, which does not contain ${o.sha}`;
|
|
2118
2160
|
if (includes && (live.state === "failure" || live.state === "error")) {
|
|
2119
2161
|
await record("deploy-failed");
|
|
2120
2162
|
return "deploy-failed";
|
|
@@ -2149,7 +2191,7 @@ ${detail}`;
|
|
|
2149
2191
|
}
|
|
2150
2192
|
function deployLine(row, now) {
|
|
2151
2193
|
const age = Math.max(0, Math.floor((now.getTime() - Date.parse(row.updatedAt)) / 60000));
|
|
2152
|
-
return `${row.target}: ${row.state === "skipped" ? "skipped (not configured on this machine)" : row.state === "not-runnable" ? "not runnable (configuration)" : row.state} ${row.sha}${row.state === "waiting" || row.state === "live" ? ` — watching since ${row.startedAt.slice(11, 16)}, no news for ${age} min${age >= 2 ? "; watcher may have stopped" : ""}` : ""}`;
|
|
2194
|
+
return `${row.target}: ${row.state === "not-deployed" ? `not deployed (host skipped: ${row.detail})` : row.state === "skipped" ? "skipped (not configured on this machine)" : row.state === "not-runnable" ? "not runnable (configuration)" : row.state} ${row.sha}${row.state === "waiting" || row.state === "live" ? ` — watching since ${row.startedAt.slice(11, 16)}, no news for ${age} min${age >= 2 ? "; watcher may have stopped" : ""}` : ""}`;
|
|
2153
2195
|
}
|
|
2154
2196
|
|
|
2155
2197
|
// ../../node_modules/.bun/smol-toml@1.9.0/node_modules/smol-toml/dist/error.js
|
|
@@ -4005,6 +4047,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
4005
4047
|
"requires_env",
|
|
4006
4048
|
"github_environment",
|
|
4007
4049
|
"live_sha_command",
|
|
4050
|
+
"check",
|
|
4008
4051
|
"smoke",
|
|
4009
4052
|
"timeout_minutes",
|
|
4010
4053
|
"pause_on_failure"
|
|
@@ -4018,8 +4061,9 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
4018
4061
|
const optional = (key) => row[key] === undefined ? null : str(row, path, key);
|
|
4019
4062
|
const githubEnvironment = optional("github_environment");
|
|
4020
4063
|
const liveShaCommand = optional("live_sha_command");
|
|
4021
|
-
|
|
4022
|
-
|
|
4064
|
+
const check = optional("check");
|
|
4065
|
+
if ([githubEnvironment, liveShaCommand, check].filter((source) => source !== null).length !== 1)
|
|
4066
|
+
problems.push(`"${path}" needs exactly one of github_environment, live_sha_command or check`);
|
|
4023
4067
|
const timeoutMinutes = row.timeout_minutes ?? 20;
|
|
4024
4068
|
if (typeof timeoutMinutes !== "number" || !Number.isFinite(timeoutMinutes) || timeoutMinutes < 1 || timeoutMinutes > 120)
|
|
4025
4069
|
problems.push(`"${path}.timeout_minutes" must be from 1 to 120`);
|
|
@@ -4039,6 +4083,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
4039
4083
|
branch: optional("branch"),
|
|
4040
4084
|
githubEnvironment,
|
|
4041
4085
|
liveShaCommand,
|
|
4086
|
+
check,
|
|
4042
4087
|
smoke: optional("smoke"),
|
|
4043
4088
|
timeoutMinutes: typeof timeoutMinutes === "number" ? timeoutMinutes : 20,
|
|
4044
4089
|
pauseOnFailure: row.pause_on_failure !== false
|
|
@@ -4394,12 +4439,16 @@ repository = ${q(p.repository)}
|
|
|
4394
4439
|
# branch = "main" # omit to watch any merged base branch
|
|
4395
4440
|
# paths = ["cmd/**", "internal/**"] # optional: only watch merges touching these globs
|
|
4396
4441
|
# github_environment = "production"
|
|
4397
|
-
##
|
|
4442
|
+
## Choose exactly one: github_environment, live_sha_command or check.
|
|
4443
|
+
## check = "./scripts/check-deploy.sh" # exit 0 live, 1 host failure, 2 pending or skipped
|
|
4444
|
+
## A host skip ends with "skipped: <reason>" on stdout and exit 2.
|
|
4445
|
+
## Exit 1 only for a confirmed host failure; use 2 for network errors.
|
|
4446
|
+
## Legacy source (failure waits until timeout; host skips become pauses):
|
|
4398
4447
|
## live_sha_command = 'cd "$DEPLOY_LINK_DIR" && hosting-cli live-sha'
|
|
4399
4448
|
## requires_env = ["DEPLOY_LINK_DIR"]
|
|
4400
4449
|
## On each coordinator machine: armada config set deploy.env.DEPLOY_LINK_DIR /path/to/linked-service
|
|
4401
4450
|
## Machine settings win over the process environment; missing settings skip without a hold.
|
|
4402
|
-
# smoke = "curl -fsS https://example.test/health"
|
|
4451
|
+
# smoke = "curl -fsS https://example.test/health" # without smoke, a live but broken service reads healthy
|
|
4403
4452
|
# timeout_minutes = 20 # 1–120; smoke shares this deadline
|
|
4404
4453
|
# pause_on_failure = true
|
|
4405
4454
|
|
|
@@ -7070,7 +7119,7 @@ async function githubQuery(opts, query, variables) {
|
|
|
7070
7119
|
}, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7071
7120
|
if (!res.ok)
|
|
7072
7121
|
throw new GithubError(`GitHub API HTTP ${res.status}`, retryStatus(res.status));
|
|
7073
|
-
const json = await res
|
|
7122
|
+
const json = await readJson(res);
|
|
7074
7123
|
if (json.errors?.length)
|
|
7075
7124
|
throw new GithubError(`GitHub API: ${json.errors.map((e) => e.message).join("; ")}`);
|
|
7076
7125
|
return json;
|
|
@@ -7176,7 +7225,7 @@ async function fetchDefaultBranchFile(opts) {
|
|
|
7176
7225
|
}, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7177
7226
|
if (!res.ok)
|
|
7178
7227
|
throw new GithubError(`GitHub API HTTP ${res.status}`, retryStatus(res.status));
|
|
7179
|
-
const json = await res
|
|
7228
|
+
const json = await readJson(res);
|
|
7180
7229
|
if (json.errors?.length)
|
|
7181
7230
|
throw new GithubError(`GitHub API: ${json.errors.map((e) => e.message).join("; ")}`);
|
|
7182
7231
|
if (!json.data?.repository)
|
|
@@ -7304,7 +7353,7 @@ async function fetchRepository(opts) {
|
|
|
7304
7353
|
return httpRequest(`https://api.github.com/repos/${opts.repository}`, { method: "GET", headers: { Accept: "application/vnd.github+json", Authorization: `Bearer ${opts.token}` } }, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (response) => {
|
|
7305
7354
|
if (!response.ok)
|
|
7306
7355
|
throw new GithubError(`GitHub API HTTP ${response.status}`);
|
|
7307
|
-
const body = await response
|
|
7356
|
+
const body = await readJson(response);
|
|
7308
7357
|
if (typeof body.full_name !== "string" || !/^[a-z0-9-]+\/[a-z0-9_.-]+$/i.test(body.full_name))
|
|
7309
7358
|
throw new GithubError("GitHub API returned no valid repository full_name");
|
|
7310
7359
|
return { fullName: body.full_name };
|
|
@@ -7421,7 +7470,7 @@ async function fetchBranchRules(opts) {
|
|
|
7421
7470
|
return null;
|
|
7422
7471
|
if (!res.ok)
|
|
7423
7472
|
throw new GithubError(`GitHub API HTTP ${res.status} reading branch rules`);
|
|
7424
|
-
return await res
|
|
7473
|
+
return await readJson(res);
|
|
7425
7474
|
});
|
|
7426
7475
|
const repo = await get("");
|
|
7427
7476
|
if (!repo?.default_branch || typeof repo.allow_squash_merge !== "boolean" || typeof repo.delete_branch_on_merge !== "boolean")
|
|
@@ -7554,7 +7603,7 @@ async function fetchJobSteps(opts) {
|
|
|
7554
7603
|
return httpRequest(`${GITHUB_REST}/repos/${opts.repository}/actions/jobs/${opts.jobId}`, { headers: { Authorization: `Bearer ${opts.token}`, Accept: "application/vnd.github+json" } }, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7555
7604
|
if (!res.ok)
|
|
7556
7605
|
throw new GithubError(`GitHub Actions HTTP ${res.status} reading job steps`);
|
|
7557
|
-
const job = await res
|
|
7606
|
+
const job = await readJson(res);
|
|
7558
7607
|
if (!job || job.id !== opts.jobId || job.run_id !== opts.runId || job.head_sha !== opts.sha || job.name !== opts.name || job.status !== "completed" || job.conclusion !== "failure" || !Array.isArray(job.steps) || !job.steps.length || job.steps.some((s) => !s || typeof s.name !== "string" || s.conclusion !== null && typeof s.conclusion !== "string" || !Number.isSafeInteger(s.number) || (s.number ?? 0) < 1))
|
|
7559
7608
|
throw new GithubError("GitHub Actions returned incomplete or mismatched job steps");
|
|
7560
7609
|
if (new Set(job.steps.map((s) => s.number)).size !== job.steps.length)
|
|
@@ -7575,7 +7624,7 @@ async function fetchWorkflowRun(opts) {
|
|
|
7575
7624
|
}, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7576
7625
|
if (!res.ok)
|
|
7577
7626
|
throw new GithubError(`GitHub Actions HTTP ${res.status}; token needs Actions repository permission (read)`);
|
|
7578
|
-
const json = await res
|
|
7627
|
+
const json = await readJson(res);
|
|
7579
7628
|
if (!Number.isSafeInteger(json.run_attempt) || (json.run_attempt ?? 0) < 1)
|
|
7580
7629
|
throw new GithubError("GitHub Actions returned no run attempt");
|
|
7581
7630
|
return { attempt: json.run_attempt, status: typeof json.status === "string" ? json.status : null };
|
|
@@ -7585,7 +7634,7 @@ async function fetchShaComparison(opts) {
|
|
|
7585
7634
|
return httpRequest(`https://api.github.com/repos/${opts.repository}/compare/${encodeURIComponent(opts.base)}...${encodeURIComponent(opts.head)}`, { method: "GET", headers: { Accept: "application/vnd.github+json", Authorization: `Bearer ${opts.token}` } }, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7586
7635
|
if (!res.ok)
|
|
7587
7636
|
throw new GithubError(`GitHub API HTTP ${res.status} comparing deploy commits`);
|
|
7588
|
-
const comparison = await res
|
|
7637
|
+
const comparison = await readJson(res);
|
|
7589
7638
|
return comparison.status === "ahead" || comparison.status === "identical";
|
|
7590
7639
|
});
|
|
7591
7640
|
}
|
|
@@ -8884,6 +8933,10 @@ async function after(ctx, c, merged, lines, handBackId, keepOpen, more, unlocked
|
|
|
8884
8933
|
await ctx.sleep(wait);
|
|
8885
8934
|
}
|
|
8886
8935
|
}
|
|
8936
|
+
if (live$?.warnings)
|
|
8937
|
+
c.warnings.push(...live$.warnings);
|
|
8938
|
+
if (live$?.cleared?.length)
|
|
8939
|
+
lines.push(`cleared: ${live$.cleared.map((id) => `${live$.clearedKinds?.[id] === "queue-refused" ? "queue refusal" : "merge request"} #${id}`).join(", ")}`);
|
|
8887
8940
|
if (live$?.resolved)
|
|
8888
8941
|
lines.push(`Hand-back resolved in the coordinator's inbox.`);
|
|
8889
8942
|
let linearPending = false;
|
|
@@ -9283,6 +9336,10 @@ function checkAttachment(input) {
|
|
|
9283
9336
|
return "attachment link type limit: a valid HTTPS URL is required";
|
|
9284
9337
|
}
|
|
9285
9338
|
}
|
|
9339
|
+
// ../core/src/coordinators.ts
|
|
9340
|
+
function strandedOwners(records, me, silenceMinutes, now) {
|
|
9341
|
+
return records.filter((role) => role.name !== me && role.tickets.length > 0 && now.getTime() - Date.parse(role.seenAt) > 2 * silenceMinutes * 60000);
|
|
9342
|
+
}
|
|
9286
9343
|
// ../core/src/credentials.ts
|
|
9287
9344
|
var DEFAULT_ARMADA_API_URL = "https://armada.thevibecompany.co";
|
|
9288
9345
|
var SESSION_TOKEN_VARIABLE = "ARMADA_SESSION_TOKEN";
|
|
@@ -9996,7 +10053,7 @@ async function checkInbox(fleet, o) {
|
|
|
9996
10053
|
ownedOpenJobs = read.ownedOpenJobs;
|
|
9997
10054
|
etag = read.etag;
|
|
9998
10055
|
warnings.push(...read.warnings);
|
|
9999
|
-
if (items.some((e) => e.new))
|
|
10056
|
+
if (items.some((e) => e.new && !e.queue))
|
|
10000
10057
|
return report(false);
|
|
10001
10058
|
}
|
|
10002
10059
|
}
|
|
@@ -10582,8 +10639,11 @@ async function watchInbox(fleet, o) {
|
|
|
10582
10639
|
if (err instanceof ArmadaApiError && err.upgrade) {
|
|
10583
10640
|
const release = await untilAborted(o.signal, () => o.release?.());
|
|
10584
10641
|
if (release) {
|
|
10585
|
-
items = [...items, { ...release, new:
|
|
10586
|
-
|
|
10642
|
+
items = [...items.filter((e) => e.kind !== "version"), { ...release, new: !known.has(entryKey(release)) }];
|
|
10643
|
+
if (items.some((e) => e.new && !e.queue && (e.owner == null || e.owner === (o.coordinatorName ?? "default"))))
|
|
10644
|
+
return report("items");
|
|
10645
|
+
await untilAborted(o.signal, () => o.sleep(boundedWait(o, pollMs)));
|
|
10646
|
+
continue;
|
|
10587
10647
|
}
|
|
10588
10648
|
}
|
|
10589
10649
|
if (!transientFailure(err))
|
|
@@ -10602,7 +10662,7 @@ async function watchInbox(fleet, o) {
|
|
|
10602
10662
|
openJobs = read.openJobs ?? [];
|
|
10603
10663
|
ownedOpenJobs = read.ownedOpenJobs;
|
|
10604
10664
|
etag = read.etag;
|
|
10605
|
-
known = new Set(items.map(entryKey));
|
|
10665
|
+
known = new Set([...known].filter((key) => key.startsWith("version:")).concat(items.map(entryKey)));
|
|
10606
10666
|
for (const w of read.warnings)
|
|
10607
10667
|
warnings.add(w);
|
|
10608
10668
|
await untilAborted(o.signal, () => o.onRead?.({
|
|
@@ -10614,9 +10674,10 @@ async function watchInbox(fleet, o) {
|
|
|
10614
10674
|
}));
|
|
10615
10675
|
}
|
|
10616
10676
|
const release = await untilAborted(o.signal, () => o.release?.()) ?? null;
|
|
10677
|
+
items = items.filter((e) => e.kind !== "version");
|
|
10617
10678
|
if (release)
|
|
10618
|
-
items
|
|
10619
|
-
if (items.some((e) => e.new))
|
|
10679
|
+
items.push({ ...release, new: !known.has(entryKey(release)) });
|
|
10680
|
+
if (items.some((e) => e.new && !e.queue && (e.owner == null || e.owner === (o.coordinatorName ?? "default"))))
|
|
10620
10681
|
return report("items");
|
|
10621
10682
|
if (read && inFlight !== null && !inFlight.length && !openJobs.length && !items.length)
|
|
10622
10683
|
return report("nothing");
|
|
@@ -10725,6 +10786,7 @@ async function* followFleet(fleet, o) {
|
|
|
10725
10786
|
owner: item.author,
|
|
10726
10787
|
at: item.createdAt,
|
|
10727
10788
|
body: item.body,
|
|
10789
|
+
...item.queue ? { queue: item.queue } : {},
|
|
10728
10790
|
new: !first
|
|
10729
10791
|
};
|
|
10730
10792
|
seen.add(key);
|
|
@@ -10835,7 +10897,7 @@ async function* followFleet(fleet, o) {
|
|
|
10835
10897
|
}
|
|
10836
10898
|
}
|
|
10837
10899
|
}
|
|
10838
|
-
function releaseEntry(running, latest, at, options = {
|
|
10900
|
+
function releaseEntry(running, latest, at, options = { minimum: null }) {
|
|
10839
10901
|
return {
|
|
10840
10902
|
id: null,
|
|
10841
10903
|
kind: "version",
|
|
@@ -10843,11 +10905,8 @@ function releaseEntry(running, latest, at, options = { setupBehind: false, minim
|
|
|
10843
10905
|
author: null,
|
|
10844
10906
|
version: latest,
|
|
10845
10907
|
body: [
|
|
10846
|
-
`Armada ${latest} required (you run ${running}). Changes: ${releaseNotesUrl(latest)}`,
|
|
10908
|
+
`Armada ${options.minimum ?? latest} required (you run ${running}). Changes: ${releaseNotesUrl(latest)}`,
|
|
10847
10909
|
...options.minimum ? [`The server requires Armada ${options.minimum} or newer.`] : [],
|
|
10848
|
-
...options.setupBehind ? [
|
|
10849
|
-
"This project's Armada setup is behind: armada upgrade checks it, then runs armada init --merge only if still needed."
|
|
10850
|
-
] : [],
|
|
10851
10910
|
`Run armada upgrade (${installCommand(latest)} if upgrading by hand).`,
|
|
10852
10911
|
"Workers in flight keep the version their brief pinned: tell them nothing unless the notes say otherwise."
|
|
10853
10912
|
].join(`
|
|
@@ -11160,6 +11219,7 @@ async function readWatchState(paths, project, name = "default") {
|
|
|
11160
11219
|
...typeof r.peekTail === "object" && r.peekTail !== null && !Array.isArray(r.peekTail) ? { peekTail: peekTails(r.peekTail) } : {},
|
|
11161
11220
|
root: stringOr(r.root),
|
|
11162
11221
|
seen: strings(r.seen) ?? [],
|
|
11222
|
+
...r.seenScope === "mine" || r.seenScope === "all" ? { seenScope: r.seenScope } : {},
|
|
11163
11223
|
inFlight: strings(r.inFlight),
|
|
11164
11224
|
...Array.isArray(r.openJobs) ? { openJobs: r.openJobs.filter((id) => Number.isSafeInteger(id) && Number(id) > 0) } : {},
|
|
11165
11225
|
readAt: stringOr(r.readAt),
|
|
@@ -11291,24 +11351,49 @@ async function runningWatch(paths, project, alive = processAlive, name = "defaul
|
|
|
11291
11351
|
return pid !== null && alive(pid) ? pid : null;
|
|
11292
11352
|
}
|
|
11293
11353
|
var NOTICED_KEPT = 50;
|
|
11354
|
+
var noticesFile = (paths) => join(paths.dir, "notices.json");
|
|
11294
11355
|
var releasesFile = (paths) => join(paths.dir, "releases.json");
|
|
11295
|
-
async function
|
|
11356
|
+
async function readNotices(paths) {
|
|
11357
|
+
const [current, legacy] = await Promise.all([
|
|
11358
|
+
readNoticeFile(noticesFile(paths), false),
|
|
11359
|
+
readNoticeFile(releasesFile(paths), true)
|
|
11360
|
+
]);
|
|
11361
|
+
const receipts = new Map;
|
|
11362
|
+
for (const entry of [...current, ...legacy]) {
|
|
11363
|
+
const previous = receipts.get(entry.key);
|
|
11364
|
+
if (!previous || entry.at !== null && (previous.at === null || Date.parse(entry.at) > Date.parse(previous.at)))
|
|
11365
|
+
receipts.set(entry.key, entry);
|
|
11366
|
+
}
|
|
11367
|
+
return [...receipts.values()];
|
|
11368
|
+
}
|
|
11369
|
+
async function readNoticeFile(path, legacy) {
|
|
11370
|
+
let text;
|
|
11296
11371
|
try {
|
|
11297
|
-
|
|
11298
|
-
|
|
11372
|
+
text = await readFile(path, "utf8");
|
|
11373
|
+
} catch (err) {
|
|
11374
|
+
if (err.code === "ENOENT")
|
|
11299
11375
|
return [];
|
|
11300
|
-
|
|
11301
|
-
if (typeof entry === "string")
|
|
11302
|
-
return [{ version: entry, at: null }];
|
|
11303
|
-
if (!entry || typeof entry.version !== "string" || typeof entry.at !== "string" || !Number.isFinite(Date.parse(entry.at)))
|
|
11304
|
-
return [];
|
|
11305
|
-
return [{ version: entry.version, at: entry.at }];
|
|
11306
|
-
});
|
|
11307
|
-
} catch {
|
|
11308
|
-
return [];
|
|
11376
|
+
throw err;
|
|
11309
11377
|
}
|
|
11378
|
+
const raw = JSON.parse(text);
|
|
11379
|
+
if (!Array.isArray(raw?.noticed))
|
|
11380
|
+
throw new Error("invalid notice memory");
|
|
11381
|
+
return raw.noticed.map((entry) => {
|
|
11382
|
+
if (legacy && typeof entry === "string")
|
|
11383
|
+
return { key: `release:${entry}`, at: null };
|
|
11384
|
+
const key = legacy ? entry?.version : entry?.key;
|
|
11385
|
+
if (typeof key !== "string" || !key || !(entry.at === null || typeof entry.at === "string" && Number.isFinite(Date.parse(entry.at))))
|
|
11386
|
+
throw new Error("invalid notice memory");
|
|
11387
|
+
return { key: legacy ? `release:${key}` : key, at: entry.at };
|
|
11388
|
+
});
|
|
11389
|
+
}
|
|
11390
|
+
async function reserveNotice(paths, key, now, everyMs, options = {}) {
|
|
11391
|
+
return reserveMatchingNotice(paths, key, now, everyMs, (candidate) => candidate === key, options).catch(() => false);
|
|
11310
11392
|
}
|
|
11311
11393
|
async function addNoticedRelease(paths, version, at = new Date, options = {}) {
|
|
11394
|
+
return reserveMatchingNotice(paths, `release:${version}`, at, options.intervalMs ?? 0, (key) => key.startsWith("release:") && key.startsWith("release:setup:") === version.startsWith("setup:"), options).catch(() => false);
|
|
11395
|
+
}
|
|
11396
|
+
async function reserveMatchingNotice(paths, key, now, everyMs, matches, options) {
|
|
11312
11397
|
const pid = options.pid ?? process.pid;
|
|
11313
11398
|
const alive = options.alive ?? processAlive;
|
|
11314
11399
|
await mkdir(paths.dir, { recursive: true, mode: 448 });
|
|
@@ -11357,19 +11442,20 @@ async function addNoticedRelease(paths, version, at = new Date, options = {}) {
|
|
|
11357
11442
|
}
|
|
11358
11443
|
if (!taken)
|
|
11359
11444
|
return false;
|
|
11360
|
-
const previous = await
|
|
11361
|
-
if (previous.some((entry) =>
|
|
11362
|
-
if (entry.at === null)
|
|
11363
|
-
return false;
|
|
11364
|
-
const age = at.getTime() - Date.parse(entry.at);
|
|
11365
|
-
return age >= 0 && age < (options.intervalMs ?? 0);
|
|
11366
|
-
}))
|
|
11445
|
+
const previous = await readNotices(paths);
|
|
11446
|
+
if (previous.some((entry) => matches(entry.key) && (everyMs === Infinity || entry.at !== null && now.getTime() - Date.parse(entry.at) < everyMs)))
|
|
11367
11447
|
return false;
|
|
11368
|
-
const noticed = previous.filter((entry) => entry.
|
|
11369
|
-
noticed.push({
|
|
11370
|
-
const
|
|
11371
|
-
|
|
11372
|
-
|
|
11448
|
+
const noticed = previous.filter((entry) => entry.key !== key);
|
|
11449
|
+
noticed.push({ key, at: now.toISOString() });
|
|
11450
|
+
const releases = noticed.filter((entry) => entry.key.startsWith("release:")).slice(-NOTICED_KEPT);
|
|
11451
|
+
const kept = noticed.filter((entry) => !entry.key.startsWith("release:"));
|
|
11452
|
+
if (key.startsWith("release:"))
|
|
11453
|
+
await writePrivate(paths, releasesFile(paths), `${JSON.stringify({
|
|
11454
|
+
noticed: releases.map((entry) => entry.at === null ? entry.key.slice(8) : { version: entry.key.slice(8), at: entry.at })
|
|
11455
|
+
}, null, 2)}
|
|
11456
|
+
`, 420);
|
|
11457
|
+
await writePrivate(paths, noticesFile(paths), `${JSON.stringify({ noticed: [...kept, ...releases] }, null, 2)}
|
|
11458
|
+
`, 420);
|
|
11373
11459
|
return true;
|
|
11374
11460
|
} finally {
|
|
11375
11461
|
if (taken && await readFile(lock, "utf8").catch(() => null) === holder)
|
|
@@ -11622,15 +11708,15 @@ var skills_generated_default = [
|
|
|
11622
11708
|
files: [
|
|
11623
11709
|
{
|
|
11624
11710
|
path: "MERGE.md",
|
|
11625
|
-
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\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 ask the worker to bring main in. 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- 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- A failed deploy or smoke check opens a `deploy` hold and one inbox item. `armada deploy status` shows each target. Merge the 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"
|
|
11711
|
+
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## 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 ask the worker to bring main in. 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- 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- 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. Merge the 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"
|
|
11626
11712
|
},
|
|
11627
11713
|
{
|
|
11628
11714
|
path: "REFERENCE.md",
|
|
11629
|
-
content: "# Coordinator reference\n\nDetail the loop in [SKILL.md](SKILL.md) points to. Read the section you need.\n\n## Named coordinators\n\nA project can share its work between coordinators, each with a name: `ARMADA_COORDINATOR=<name>` in the environment wins, then `armada coordinator use <name>` for this checkout, else `default`.\n\n- Every launch records the coordinator that made it, and the worker inherits that owner from its launch token; a worker cannot choose it.\n- `armada status --mine`, `armada inbox --mine` and a named coordinator's `armada watch` show its own workers and unowned items. `armada inbox --all` and `armada watch --all` show the whole fleet (`armada status --all` lists every registered project instead); `default` sees the whole fleet unless it passes `--mine`. Status always keeps the whole frontier and marks another coordinator's pending launch `launching by <name>`.\n- Inbox entries name their owner or say `unowned`. Ownership follows the open worker session, then the newest pending launch, then the item. Unowned alarms reach everyone until someone takes them.\n- `armada coordinator list` shows each name, its sessions and its tickets. `armada coordinator take ABC-12 --from <name>` moves a ticket's worker (or pending launch) to you atomically; the worker keeps its phase.\n- Each name has its own watch lock on a machine: `armada watch --stop` stops yours, `armada watch --stop --name <name>` another's.\n- Your own coordination ticket is not a worker: the watch leaves out the claim whose handle is yours (`ARMADA_COORDINATOR_HANDLE`, else Conductor's workspace and session).\n\n## The watch\n\nPlain `armada watch` waits until
|
|
11715
|
+
content: "# Coordinator reference\n\nDetail the loop in [SKILL.md](SKILL.md) points to. Read the section you need.\n\n## Named coordinators\n\nA project can share its work between coordinators, each with a name: `ARMADA_COORDINATOR=<name>` in the environment wins, then `armada coordinator use <name>` for this checkout, else `default`.\n\n- Every launch records the coordinator that made it, and the worker inherits that owner from its launch token; a worker cannot choose it.\n- `armada status --mine`, `armada inbox --mine` and a named coordinator's `armada watch` show its own workers and unowned items. `armada inbox --all` and `armada watch --all` show the whole fleet (`armada status --all` lists every registered project instead); `default` sees the whole fleet unless it passes `--mine`. Status always keeps the whole frontier and marks another coordinator's pending launch `launching by <name>`.\n- Inbox entries name their owner or say `unowned`. Ownership follows the open worker session, then the newest pending launch, then the item. Unowned alarms reach everyone until someone takes them.\n- `armada coordinator list` shows each name, its sessions and its tickets. `armada coordinator take ABC-12 --from <name>` moves a ticket's worker (or pending launch) to you atomically; the worker keeps its phase.\n- `armada status` names another coordinator's stranded tickets after twice `[policy] silence_minutes` without activity and prints the exact `armada coordinator take … --from <name>` command; take them when resuming that role's work.\n- Each name has its own watch lock on a machine: `armada watch --stop` stops yours, `armada watch --stop --name <name>` another's.\n- Your own coordination ticket is not a worker: the watch leaves out the claim whose handle is yours (`ARMADA_COORDINATOR_HANDLE`, else Conductor's workspace and session).\n\n## The watch\n\nPlain `armada watch` waits until a new own or unowned item you have not been shown needs you (a question, plan, request, hand-back, merge hold, deploy failure, job notice, silent, stopped or unstarted worker), prints it and exits. Items owned by another named coordinator stay in the listing, marked `owner: <name>`, but do not wake you, even with `--all`. Reading `armada inbox` preserves shown history; `--mine` cannot prune keys from a broader `--all` read. It exits with `nothing to watch` when nothing in its scope is in flight or open. Armada being down does not end it; a harness time limit can, so start it again when it ends without news. `--for <minutes>` bounds it cleanly.\n\n`armada watch --follow` prints one line per item and keeps running:\n\n- `--for <minutes>` ends it with `resume: armada watch --follow …`; keep it below your harness's command limit.\n- A restart resumes this machine's stored cursor for your coordinator name. `--since <cursor>` resumes elsewhere and shows every open item once, marked `open`.\n- `--tickets ABC-1,ABC-2` and `--kinds question,hand-back` filter lines. `--kinds claim,report,release,merge,handover` (or `all`) adds informational events; `handover` is a report entering ready-to-merge. `--json` prints NDJSON with a cursor on every line.\n- A printed line counts as seen, even if your harness never read it: use follow only where every line reaches you. Harnesses that wake only when a command ends keep plain watch.\n\nBoth modes share one lock per project and name on a machine. `armada inbox --wait [--timeout <seconds>]` (300 by default) is the fallback for a runtime that cannot run a background command.\n\n## Silence and liveness\n\n- **Silent**: no heartbeat, report or answer for `[policy] silence_minutes` (15 by default). A worker's first allowance adds `launch_grace_minutes` (defaults to `silence_minutes`). Shipping at stage `ci` gets `ci_wait_minutes` (45 by default). Waiting phases (`awaiting-approval`, `blocked`, `awaiting-validation`) are never silent while unanswered.\n- **Conductor sessions are observed**: a session Armada sees working is only called silent past twice the allowance, and the alert says it is still working. A session idle in a working phase for five minutes without a report or answer is `stopped`: nothing will wake it.\n- A silence wakes the watch at its allowance, then at twice, four times and each doubling after.\n- **Quiet**: a live worker without a report for `quiet_minutes` (45 by default) is a note for you only.\n- **Not started**: no claim `not_started_minutes` (10 by default) after the launch. An unused token that expired produces one notice, then clears.\n- Claims end by themselves when their ticket is Done or Canceled, their hand-back merged, their session was revoked or their workspace archived.\n\n## Upgrades\n\n`armada status` and `armada inbox` mention a new Armada release at most once a day; ordinary releases leave the watch running. Only a CLI below the server minimum stops either watch mode with a `version` item, worded `Armada <x> required (you run <y>)`. Setup behind gets a separate daily notice in status, inbox and plain watch's final output: “This project's Armada setup is behind <version>: `armada upgrade`, then merge the setup pull request it opens.” Setup drift leaves the watch running. Run `armada upgrade`: it waits for npm, installs the release, checks `armada --version`, and runs `armada init --merge` only when the project's setup is outdated. Workers in flight keep the version their brief pinned.\n\n## Specs\n\nSpecs are direct children of the program root, titled `Spec N — Name` (`Spec N/M — Name` is read too).\n\n- `armada spec add \"<name>\"` appends one with the **In short** template and prints its URL; earlier titles are untouched.\n- `armada spec add \"<name>\" --at 5` previews the renames a middle insertion needs; repeat with `--apply` to write them.\n- `armada spec renumber` previews a repair of gaps, duplicates and stale totals; `--apply` writes it.\n- `[tracker] spec_titles = \"N/M\"` keeps totals in every title; appending then needs `--apply` too.\n- Writes are sequential and stop at the first failure, listing what was not confirmed: inspect Linear before retrying.\n\nWhen `armada merge` closes a spec's last open ticket, it closes the spec with a summary, unless the team's own parent auto-close does it.\n\n## Secrets\n\nThe secrets workers need (an LLM key, a test database URL) are kept per project in Armada, and workers use them through `armada run -- <command>`.\n\n- `armada secrets` lists the names, never a value. `armada doctor` names those `[secrets] names` expects and Armada lacks.\n- An owner or admin sets one with `armada secrets set <NAME>` (hidden prompt), `--value-stdin`, or `--from-env <VAR>`, which moves a variable without anyone reading it; `--org` sets it for every project. `armada secrets unset <NAME>` removes it.\n- Anyone else asks with `armada secrets request <NAME> --ticket <id> --reason \"<why>\"`: the owner gets a link and types the value into the vault. Repeated requests reuse one link.\n- Never put a value on a command line, in a brief, in notes or in chat. A value pasted anywhere must be rotated.\n\n## Long jobs\n\nLong runs (an evaluation, a backfill, a load test) run on the project's own runner, declared in `[jobs.<name>]` with its start, status and stop commands. Never run them in a session.\n\n- `armada job start <name> --ticket <id>` dispatches one and stores its runner reference; `armada job status` asks the runner, `armada job list` reads stored progress.\n- `armada job stop <id>` stops one on purpose; nothing is stopped automatically, even when its ticket is Done.\n- A runner can push progress with `armada job beat <id> --progress \"40/120\"`, signed in with an organization API key.\n- A job without news past its silence limit is a `job-silent` entry; a finished job leaves one `job` notice. Read it, then `armada answer <item> \"<what you checked>\"`.\n- `armada job recover <id> --ref <reference>` attaches a runner reference that a lost answer did not record.\n\n## Shared resources\n\nMigration numbers, ports and other shared names are reserved per ticket through Armada: `armada reserve <key> --next --floor <n>` for numbers, `--value <name>` for names. `armada reserve --list` shows the holders. A release frees a ticket's reservations; a merge keeps them used for good. Declare well-known keys in `[[reservations]]` so briefs list them.\n\n## The owner's channel\n\nOrganization > Notifications (owner or admin) connects one chat webhook. Owner validations, escalated questions and a stopped coordinator with items waiting reach it by themselves, outside quiet hours. Digests go out at the times set there; `armada digest --send` posts one now, and `armada digest --lang en|fr` overrides `[tracker] language` for the printed text.\n"
|
|
11630
11716
|
},
|
|
11631
11717
|
{
|
|
11632
11718
|
path: "SKILL.md",
|
|
11633
|
-
content: "---\nname: armada-coordinator\ndescription: Coordinating an Armada fleet of coding agents on one project. Use when designated coordinator, or asked to launch workers on ready tickets, answer their questions, merge their green pull requests, or resume a fleet in a new local or cloud session. Reads the fleet with armada status and armada inbox and drives workers through the runtime guide skill.\n---\n\nThe coordinator turns the owner's intent into merged pull requests. Each worker owns one ticket and follows the `armada-worker` skill; the coordinator chooses what runs, answers questions, merges and reports. `armada.toml` names the program root, the label groups and the policy. `AGENTS.md` (or `CLAUDE.md`) holds the repository's own rules, and they win where they are stricter.\n\n**Standing authority.** Unless the owner said otherwise, they delegate reversible technical decisions, plan approval and merging to you: act, then report. Escalate only product decisions, irreversible or outward-facing actions, and anything that spends money.\n\n**Armada does the runtime work.** For Conductor and herdr workers, `armada launch`, `armada answer`, `armada peek`, `armada relaunch` and `armada merge` launch, deliver, observe, replace and archive by themselves. Read the runtime guide (`armada skill armada-runtime-conductor`, `-herdr` or `-claude-code`) only when a command reports a limitation, and for every Claude Code subagent: Armada does none of that for them.\n\nThis file is the loop. [MERGE.md](MERGE.md) covers merging; [REFERENCE.md](REFERENCE.md) covers the watch's options, named coordinators, silence rules, upgrades, specs, secrets and long jobs.\n\n## Start\n\n1. **Sign in.** `armada whoami` says whether this terminal is signed in and to which organization. If not: a person runs `armada login` and approves the code in the browser; a headless coordinator (a cloud workspace, CI) sets `ARMADA_API_KEY` to an organization API key an owner created, or runs `armada login --api-key`. Signed in, Armada gives each command the organization's keys and puts a one-time launch token in every brief, so no worker needs a key. Keys set in the environment still win. `armada doctor` checks the repository and the sign-in together.\n2. **Take your name.** One project can have several coordinators, each with a name. Set `ARMADA_COORDINATOR=<name>` (a cloud workspace) or run `armada coordinator use <name>` (this checkout); without either the name is `default`. A named coordinator sees its own workers and unowned items; `default` sees the whole fleet. `armada coordinator list` shows the names, their sessions and tickets. See REFERENCE.md before sharing a project.\n3. **Find your coordination ticket**, if the owner gave you one. Read its comments, newest first. A last comment `Agent status: released — <text>` is a hand-over: `<text>` is the state the previous coordinator left. Claim the ticket with your own handle, never the previous one: `armada claim <ticket> --runtime <your runtime> --handle <your handle> --branch <default branch>` (in Conductor, `--runtime conductor --handle \"$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID\"`; elsewhere set `ARMADA_COORDINATOR_HANDLE` to the handle you claimed with). Report on it as a worker would, `armada report implementing --ticket <ticket> --message \"<what you found and do next>\"`, and hand over with `armada release --ticket <ticket> --reason \"<state so far and what remains>\"` when you stop before the run ends. Write that reason for a reader with none of your context.\n4. **Run from anywhere.** Commands find the project from the checkout. From another folder, pass `--project <slug>` (this machine's last watched checkout) or set `ARMADA_CONFIG=/path/to/armada.toml`; `--config <path>` wins over both.\n\n## Loop\n\nRepeat these steps in order. Each ends on a \"done when\".\n\n### 1. Read the fleet\n\n`armada status --mine` and `armada inbox --mine`; without `--mine` they show the whole fleet. Never work from memory: a new session resumes from these two commands. Status lists the tickets in flight with their phases, the frontier of ready tickets, pull requests waiting, pending and deferred launches, open jobs, merge holds and the default branch's health. The inbox lists, oldest first, everything that waits for you; each entry says what to run.\n\nDone when you can name every ticket in flight and its phase, every ready ticket, every pull request waiting and every open inbox entry.\n\n### 2. Keep watching\n\nYou only learn of something new when a command you run ends. While a worker is in flight, keep exactly one `armada watch` running in the background (Claude Code: a Bash call with `run_in_background`). It waits until something needs you, prints it and exits, which wakes you. Act on it, then start it again. The last line of `armada inbox`, `watch`, `merge`, `launch` and `brief` says what to do: `2 workers in flight (ABC-1, ABC-2) — keep watching: armada watch`, `armada watch is already running (pid …)`, or `nothing to watch`. Follow it.\n\n- Never write your own polling loop, `sleep` loop or transcript poller: `armada watch`, `armada peek` and `armada inbox` replace them.\n- `armada watch --follow` keeps running and prints a line per event; use it only where every output line reaches you (a terminal, a herdr pane, a harness tool such as Claude Code's Monitor) or in a script. Pass `--for <minutes>` below your harness's command limit; it ends with the command that resumes it.\n- `armada status` and `armada inbox` run fine beside a watch. Stop a watch only with `armada watch --stop`, never `pkill`.\n- A runtime that cannot run a background command calls `armada inbox --wait` again and again instead.\n- In Claude Code, the stop hook `armada init` installs refuses to end your turn while workers are in flight and no watch runs. `ARMADA_STOP_HOOK=off` turns it off; say so in your report.\n\nDone when a watch runs, or the last line says `nothing to watch`.\n\n### 3. Answer what waits for you\n\nWork through the inbox, oldest first.\n\n- **`question` and `plan`.** Decide, then `armada answer <item> \"<answer>\"`. For Conductor and herdr it delivers the text into the worker's session, posts it on the ticket and resolves the item, in one command; never send it a second time by hand. Repeating the same text after a failure is safe: Conductor deduplicates it. For a plan: read all of it, then `armada answer <item> \"approved\"` or concrete amendments with the reason. A plan item lists the worker's declared paths and their overlaps with other workers; a worker proceeds through overlaps on its own and asks only when it must change a contract another ticket relies on. A Claude Code worker: deliver with the runtime guide's *Message* section first, then `armada answer`.\n- **Notes you start.** `armada answer --note <ticket> \"<message>\"` delivers and records a message the worker did not ask for. It also resolves that ticket's open plan without approving it: answer a waiting plan with `armada answer <item>` instead. A live herdr approval prompt (`runtime-blocked`) has no item id: read the pane with `armada peek`, then `armada answer <ticket> \"<input>\"`.\n- **Product decisions** go to the owner: `armada ask-owner <ticket> \"<question>\" --choices \"<a> | <b>\" [--check \"<check>\"]` puts one question, judged in about a minute, on the owner's Validations page and prints the link to send. Never ask the owner to read a diff. Their pick returns as a `decision` item.\n- **The owner's requests** from the dashboard, signed with their name:\n - `answer-request`: `armada answer <request id> \"<the owner's answer>\"`, which delivers and resolves the question or plan it names.\n - `launch-request`: launch the ticket as in step 5 (the claim resolves it), or decline it with `armada answer <request id> \"<why>\"` when it collides with work in flight.\n - Merge pressed on a pull request handed back at its current head goes straight into the merge queue, queued by the owner; no item arrives, so keep `armada merge --drain` running. A press the dashboard could not queue arrives as a `merge-request`.\n - `merge-request`, `release-request`, `plan-changes`: merge, release or relay the plan changes, then answer the item with what you did.\n - `decision`: an approved merge, `armada merge <pr>`; requested changes or a choice, deliver them with `armada answer`; an approved design ticket, `armada done <ticket>`, then cut the ticket that builds it, blocked by this one.\n- **A missing secret.** A worker asks with `armada ask --secret <NAME>`. Run `armada secrets request <NAME> --ticket <id> --reason \"<why>\"` and send the printed link to an owner or admin, who types the value into the vault. Never ask for a value in chat; a pasted value must be rotated. When the inbox says `<NAME> is set`, tell the worker to re-run through `armada run`.\n- **Other entries**: `hand-back` (step 6), `queue-stalled` (queued pull requests with no drain for 2 minutes: run `armada merge --drain`), `queue-refused` and `linear-pending` (MERGE.md), `hold` and `deploy` (step 7), `job` and `job-silent` (REFERENCE.md), `unblocked` (step 5), `stopped`, `silent` and `not-started` (step 4), `version` (run `armada upgrade`).\n\nDecide reversible choices yourself and prefer the option that keeps behaviour observable. Shared numbers and names (migrations, ports, versions) are never yours to hand out: workers take them with `armada reserve`, and `armada reserve --list` shows the holders.\n\nDone when the inbox shows no open question, plan or request.\n\n### 4. Check stopped, silent and unstarted workers\n\nRun `armada peek <ticket>`: the runtime's state, the worker's last reply, its recent commands, its report and heartbeat ages, its PR checks and open questions. It never writes to the worker.\n\n- **`stopped`** (Armada saw the session idle in a working phase) or **`silent`** (no heartbeat, report or answer within its allowance): read the last reply. A worker that is merely idle gets a nudge with `armada answer --note`. A worker that died, failed or whose workspace is gone is replaced with `armada relaunch <ticket> --reason \"<why>\"`: it releases only the old worker, launches a new one on the same branch and pull request, then archives the old one. `--dry-run` shows the plan first.\n- **`not-started`**: a launched worker that has not claimed. The entry says whether it never used its launch token or signed in and stopped before the claim. A worker stuck on a setup choice gets a note to take the safe option; one that is gone is relaunched, or its launch cancelled with `armada launch revoke <ticket>`.\n\nSilence allowances, grace periods and wake-up levels are in REFERENCE.md.\n\nDone when every worker in flight is working, waiting on someone, or replaced.\n\n### 5. Launch ready tickets\n\nOne at a time, and only tickets that do not collide with work in flight.\n\n1. `armada lint --ready` lists readability problems in ready tickets and open specs, each with its fix. Fix them on the ticket, then `armada lint <ticket>` to recheck.\n2. Pick a ticket from the frontier in `armada status`. Read it and its parent spec.\n3. **Choose the profile.** A `[[conductor.routing]]` rule matching the ticket's labels wins. Otherwise, when profiles have `when` rules, match them in plain words to the files and work the ticket will change, and pass `--profile <name> --reason \"<why>\"`. Mixed work goes where most of it is; say so in the reason. Override a label rule only when the labels mislead, with the same flags.\n4. **Judge owner validation** when `armada.toml` has `[[policy.validation]]` rules: `--validation none` for most tickets, or `--validation <n> --validation-reason \"<why>\"` when one applies (a design ticket, a new screen's look).\n5. **Pre-approve the plan** when it needs no review: `--pre-approve --reason \"<why>\"`. Otherwise the worker posts its plan and waits for your answer.\n6. **Launch** Conductor and herdr workers with one command:\n\n```sh\narmada launch ABC-12 --runtime conductor --profile backend --pre-approve --reason \"CLI and core only; a small follow-up\" --notes notes.md\n```\n\nOne `--reason` explains both the profile choice and the pre-approval. `--runtime conductor|herdr` may be left out when the profile settles it. `--notes <file|->` adds what only you know (the boundary with a parallel worker, a decision not yet on the ticket), up to 16 KB; notes never approve a plan. `--dry-run` checks everything and creates nothing. The command refuses a ticket already launched or claimed, mints the token, starts the worker and prints its handle and link, never the token. Put conventions every worker needs in `[brief] extra`, not in notes. For a Claude Code profile, run `armada brief <ticket> --prompt` with the same flags and launch through the Agent tool as its runtime guide says.\n\n7. **A ticket blocked by work in flight**: `armada launch <ticket> --when-unblocked [--profile <name>]` remembers the launch. Merging its last blocker with `armada merge` launches it in the same run; when it cannot (a Claude Code profile, no ready label, a launch that fails), the merge prints the command to run and the request stays. A blocker closed elsewhere wakes your inbox with the launch command. Another coordinator's merge that unblocks your ticket arrives as an `unblocked` entry.\n8. **Check the claim** a few minutes later: `armada status` shows the ticket in flight, phase `planning` (then `implementing` once a pre-approved worker posts its plan), with the handle the launch printed. A claim can report the worker `blocked` at once when Git refuses its pushes or commit signing would prompt: fix the access and answer it.\n\nDone when every launched ticket is In Progress with a claim, and a watch runs.\n\n### 6. Merge handed-back pull requests\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`, which 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\n### 7. Keep main healthy\n\n- **Merge holds** pause merges for every coordinator: `armada hold` lists them, `armada hold add \"<reason>\"` opens one. Merge the fix with `armada merge <pr> --through-hold \"<why>\"`, verify the recovery, then `armada hold clear <id> --reason \"<what was verified>\"`. Never clear a hold just to let a merge through.\n- **Main red.** `armada status` says `main red since #N` with the failing checks, and whether a fix is running. Find the cause with `armada ci why --branch <default branch>`, cut a fix ticket, and hold merges when the breakage would spread.\n- **Deploys.** With `[[deploy.target]]`, each merge starts a watcher; a failed deploy or smoke check puts a `deploy` item in your inbox and opens a hold. `armada deploy status` shows the targets. Merge the fix through the hold; the next healthy deploy clears it.\n- **Red checks on a pull request.** `armada ci why <pr>` names the failing tests, first errors and runner problems. `armada ci why <pr> --rerun` reruns once only when every failure is a runner problem or a declared `[[ci.known_failure]]`, and names each flake's root-cause ticket. Anything else is a real failure: send it back to the worker.\n\nDone when no hold is open without a ticket that fixes it.\n\n### 8. Turn findings into tickets\n\nA gap a worker reports or a bug you see becomes a ticket under the right spec, with its blocked-by relations, and is launched when ready. No finding lives only in a transcript. `armada spec add \"<name>\"` creates a spec under the program root with the **In short** template; fill it in before cutting its tickets, then `armada lint <ticket>` each one. Inserting or renumbering specs is in REFERENCE.md.\n\n### 9. Report to the owner\n\nWhen the owner asks where things stand, run `armada digest` and paste its text; `--since 4h` sets the window and `--send` posts it through the organization's channel. Owner validations and questions also reach that channel by themselves (Organization > Notifications). Report in the owner's language (`[tracker] language`): what merged, what runs, what you decided for them, and the one thing they must do, with its exact place. Outcomes and numbers, no process narration.\n\nThen repeat from step 1.\n\n## Rules of thumb\n\n- Never pipe Armada commands through `grep`, `tail` or `head`: their last lines say whether something happened and what to do next.\n- Long runs (an evaluation, a backfill) go through `armada job`, never in your session or a worker's.\n- Parallel workers in one area collide: stagger them, or give each a disjoint area and say the boundary in `--notes`.\n- Evidence for the owner goes through `armada attach <ticket> <files|urls>... --caption \"<what to check>\"`; link the printed URLs. Screenshots stay out of git.\n- Everything that must outlive your session goes to the tracker or the repository.\n- When a command named here is missing from your Armada version (`armada --help`), run `armada upgrade`; if you cannot, do the step by hand with the same protocol and say so in your report.\n"
|
|
11719
|
+
content: "---\nname: armada-coordinator\ndescription: Coordinating an Armada fleet of coding agents on one project. Use when designated coordinator, or asked to launch workers on ready tickets, answer their questions, merge their green pull requests, or resume a fleet in a new local or cloud session. Reads the fleet with armada status and armada inbox and drives workers through the runtime guide skill.\n---\n\nThe coordinator turns the owner's intent into merged pull requests. Each worker owns one ticket and follows the `armada-worker` skill; the coordinator chooses what runs, answers questions, merges and reports. `armada.toml` names the program root, the label groups and the policy. `AGENTS.md` (or `CLAUDE.md`) holds the repository's own rules, and they win where they are stricter.\n\n**Standing authority.** Unless the owner said otherwise, they delegate reversible technical decisions, plan approval and merging to you: act, then report. Escalate only product decisions, irreversible or outward-facing actions, and anything that spends money.\n\n**Armada does the runtime work.** For Conductor and herdr workers, `armada launch`, `armada answer`, `armada peek`, `armada relaunch` and `armada merge` launch, deliver, observe, replace and archive by themselves. Read the runtime guide (`armada skill armada-runtime-conductor`, `-herdr` or `-claude-code`) only when a command reports a limitation, and for every Claude Code subagent: Armada does none of that for them.\n\nThis file is the loop. [MERGE.md](MERGE.md) covers merging; [REFERENCE.md](REFERENCE.md) covers the watch's options, named coordinators, silence rules, upgrades, specs, secrets and long jobs.\n\n## Start\n\n1. **Sign in.** `armada whoami` says whether this terminal is signed in and to which organization. If not: a person runs `armada login` and approves the code in the browser; a headless coordinator (a cloud workspace, CI) sets `ARMADA_API_KEY` to an organization API key an owner created, or runs `armada login --api-key`. Signed in, Armada gives each command the organization's keys and puts a one-time launch token in every brief, so no worker needs a key. Keys set in the environment still win. `armada doctor` checks the repository and the sign-in together.\n2. **Take your name.** One project can have several coordinators, each with a name. Set `ARMADA_COORDINATOR=<name>` (a cloud workspace) or run `armada coordinator use <name>` (this checkout); without either the name is `default`. A named coordinator sees its own workers and unowned items; `default` sees the whole fleet. `armada coordinator list` shows the names, their sessions and tickets. Status names work stranded under a silent role with the `armada coordinator take … --from <name>` command; use it when you resume that work. See REFERENCE.md before sharing a project.\n3. **Find your coordination ticket**, if the owner gave you one. Read its comments, newest first. A last comment `Agent status: released — <text>` is a hand-over: `<text>` is the state the previous coordinator left. Claim the ticket with your own handle, never the previous one: `armada claim <ticket> --runtime <your runtime> --handle <your handle> --branch <default branch>` (in Conductor, `--runtime conductor --handle \"$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID\"`; elsewhere set `ARMADA_COORDINATOR_HANDLE` to the handle you claimed with). Report on it as a worker would, `armada report implementing --ticket <ticket> --message \"<what you found and do next>\"`, and hand over with `armada release --ticket <ticket> --reason \"<state so far and what remains>\"` when you stop before the run ends. Write that reason for a reader with none of your context.\n4. **Run from anywhere.** Commands find the project from the checkout. From another folder, pass `--project <slug>` (this machine's last watched checkout) or set `ARMADA_CONFIG=/path/to/armada.toml`; `--config <path>` wins over both.\n\n## Loop\n\nRepeat these steps in order. Each ends on a \"done when\".\n\n### 1. Read the fleet\n\n`armada status --mine` and `armada inbox --mine`; without `--mine` they show the whole fleet. Never work from memory: a new session resumes from these two commands. Status lists the tickets in flight with their phases, the frontier of ready tickets, pull requests waiting, pending and deferred launches, open jobs, merge holds and the default branch's health. The inbox lists, oldest first, everything that waits for you; each entry says what to run.\n\nDone when you can name every ticket in flight and its phase, every ready ticket, every pull request waiting and every open inbox entry.\n\n### 2. Keep watching\n\nYou only learn of something new when a command you run ends. While a worker is in flight, keep exactly one `armada watch` running in the background (Claude Code: a Bash call with `run_in_background`). It waits until something needs you, prints it and exits, which wakes you. Act on it, then start it again. The last line of `armada inbox`, `watch`, `merge`, `launch` and `brief` says what to do: `2 workers in flight (ABC-1, ABC-2) — keep watching: armada watch`, `armada watch is already running (pid …)`, or `nothing to watch`. Follow it.\n\n- Never write your own polling loop, `sleep` loop or transcript poller: `armada watch`, `armada peek` and `armada inbox` replace them.\n- `armada watch --follow` keeps running and prints a line per event; use it only where every output line reaches you (a terminal, a herdr pane, a harness tool such as Claude Code's Monitor) or in a script. Pass `--for <minutes>` below your harness's command limit; it ends with the command that resumes it.\n- `armada status` and `armada inbox` run fine beside a watch. Stop a watch only with `armada watch --stop`, never `pkill`.\n- A runtime that cannot run a background command calls `armada inbox --wait` again and again instead.\n- In Claude Code, the stop hook `armada init` installs refuses to end your turn while workers are in flight and no watch runs. `ARMADA_STOP_HOOK=off` turns it off; say so in your report.\n\nDone when a watch runs, or the last line says `nothing to watch`.\n\n### 3. Answer what waits for you\n\nWork through the inbox, oldest first.\n\n- **`question` and `plan`.** Decide, then `armada answer <item> \"<answer>\"`. For Conductor and herdr it delivers the text into the worker's session, posts it on the ticket and resolves the item, in one command; never send it a second time by hand. Repeating the same text after a failure is safe: Conductor deduplicates it. For a plan: read all of it, then `armada answer <item> \"approved\"` or concrete amendments with the reason. A plan item lists the worker's declared paths and their overlaps with other workers; a worker proceeds through overlaps on its own and asks only when it must change a contract another ticket relies on. A Claude Code worker: deliver with the runtime guide's *Message* section first, then `armada answer`.\n- **Notes you start.** `armada answer --note <ticket> \"<message>\"` delivers and records a message the worker did not ask for. It also resolves that ticket's open plan without approving it: answer a waiting plan with `armada answer <item>` instead. A live herdr approval prompt (`runtime-blocked`) has no item id: read the pane with `armada peek`, then `armada answer <ticket> \"<input>\"`.\n- **Product decisions** go to the owner: `armada ask-owner <ticket> \"<question>\" --choices \"<a> | <b>\" [--check \"<check>\"]` puts one question, judged in about a minute, on the owner's Validations page and prints the link to send. Never ask the owner to read a diff. Their pick returns as a `decision` item.\n- **The owner's requests** from the dashboard, signed with their name:\n - `answer-request`: `armada answer <request id> \"<the owner's answer>\"`, which delivers and resolves the question or plan it names.\n - `launch-request`: launch the ticket as in step 5 (the claim resolves it), or decline it with `armada answer <request id> \"<why>\"` when it collides with work in flight.\n - Merge pressed on a pull request handed back at its current head goes straight into the merge queue, queued by the owner; no item arrives, so keep `armada merge --drain` running. A press the dashboard could not queue arrives as a `merge-request`.\n - `merge-request`, `release-request`, `plan-changes`: merge, release or relay the plan changes, then answer the item with what you did.\n - `decision`: an approved merge, `armada merge <pr>`; requested changes or a choice, deliver them with `armada answer`; an approved design ticket, `armada done <ticket>`, then cut the ticket that builds it, blocked by this one.\n- **A missing secret.** A worker asks with `armada ask --secret <NAME>`. Run `armada secrets request <NAME> --ticket <id> --reason \"<why>\"` and send the printed link to an owner or admin, who types the value into the vault. Never ask for a value in chat; a pasted value must be rotated. When the inbox says `<NAME> is set`, tell the worker to re-run through `armada run`.\n- **Other entries**: `hand-back` (step 6), `queue-stalled` (queued pull requests with no drain for 2 minutes: run `armada merge --drain`), `queue-refused` and `linear-pending` (MERGE.md), `hold` and `deploy` (step 7), `job` and `job-silent` (REFERENCE.md), `unblocked` (step 5), `stopped`, `silent` and `not-started` (step 4), `version` (CLI too old: run `armada upgrade`).\n\nDecide reversible choices yourself and prefer the option that keeps behaviour observable. Shared numbers and names (migrations, ports, versions) are never yours to hand out: workers take them with `armada reserve`, and `armada reserve --list` shows the holders.\n\nDone when the inbox shows no open question, plan or request.\n\n### 4. Check stopped, silent and unstarted workers\n\nRun `armada peek <ticket>`: the runtime's state, the worker's last reply, its recent commands, its report and heartbeat ages, its PR checks and open questions. It never writes to the worker.\n\n- **`stopped`** (Armada saw the session idle in a working phase) or **`silent`** (no heartbeat, report or answer within its allowance): read the last reply. A worker that is merely idle gets a nudge with `armada answer --note`. A worker that died, failed or whose workspace is gone is replaced with `armada relaunch <ticket> --reason \"<why>\"`: it releases only the old worker, launches a new one on the same branch and pull request, then archives the old one. `--dry-run` shows the plan first.\n- **`not-started`**: a launched worker that has not claimed. The entry says whether it never used its launch token or signed in and stopped before the claim. A worker stuck on a setup choice gets a note to take the safe option; one that is gone is relaunched, or its launch cancelled with `armada launch revoke <ticket>`.\n\nSilence allowances, grace periods and wake-up levels are in REFERENCE.md.\n\nDone when every worker in flight is working, waiting on someone, or replaced.\n\n### 5. Launch ready tickets\n\nOne at a time, and only tickets that do not collide with work in flight.\n\n1. `armada lint --ready` lists readability problems in ready tickets and open specs, each with its fix. Fix them on the ticket, then `armada lint <ticket>` to recheck.\n2. Pick a ticket from the frontier in `armada status`. Read it and its parent spec.\n3. **Choose the profile.** A `[[conductor.routing]]` rule matching the ticket's labels wins. Otherwise, when profiles have `when` rules, match them in plain words to the files and work the ticket will change, and pass `--profile <name> --reason \"<why>\"`. Mixed work goes where most of it is; say so in the reason. Override a label rule only when the labels mislead, with the same flags.\n4. **Judge owner validation** when `armada.toml` has `[[policy.validation]]` rules: `--validation none` for most tickets, or `--validation <n> --validation-reason \"<why>\"` when one applies (a design ticket, a new screen's look).\n5. **Pre-approve the plan** when it needs no review: `--pre-approve --reason \"<why>\"`. Otherwise the worker posts its plan and waits for your answer.\n6. **Launch** Conductor and herdr workers with one command:\n\n```sh\narmada launch ABC-12 --runtime conductor --profile backend --pre-approve --reason \"CLI and core only; a small follow-up\" --notes notes.md\n```\n\nOne `--reason` explains both the profile choice and the pre-approval. `--runtime conductor|herdr` may be left out when the profile settles it. `--notes <file|->` adds what only you know (the boundary with a parallel worker, a decision not yet on the ticket), up to 16 KB; notes never approve a plan. `--dry-run` checks everything and creates nothing. The command refuses a ticket already launched or claimed, mints the token, starts the worker and prints its handle and link, never the token. Put conventions every worker needs in `[brief] extra`, not in notes. For a Claude Code profile, run `armada brief <ticket> --prompt` with the same flags and launch through the Agent tool as its runtime guide says.\n\n7. **A ticket blocked by work in flight**: `armada launch <ticket> --when-unblocked [--profile <name>]` remembers the launch. Merging its last blocker with `armada merge` launches it in the same run; when it cannot (a Claude Code profile, no ready label, a launch that fails), the merge prints the command to run and the request stays. A blocker closed elsewhere wakes your inbox with the launch command. Another coordinator's merge that unblocks your ticket arrives as an `unblocked` entry.\n8. **Check the claim** a few minutes later: `armada status` shows the ticket in flight, phase `planning` (then `implementing` once a pre-approved worker posts its plan), with the handle the launch printed. A claim can report the worker `blocked` at once when Git refuses its pushes or commit signing would prompt: fix the access and answer it.\n\nDone when every launched ticket is In Progress with a claim, and a watch runs.\n\n### 6. Merge handed-back pull requests\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`, which 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\n### 7. Keep main healthy\n\n- **Merge holds** pause merges for every coordinator: `armada hold` lists them, `armada hold add \"<reason>\"` opens one. Merge the fix with `armada merge <pr> --through-hold \"<why>\"`, verify the recovery, then `armada hold clear <id> --reason \"<what was verified>\"`. Never clear a hold just to let a merge through.\n- **Main red.** `armada status` says `main red since #N` with the failing checks, and whether a fix is running. Find the cause with `armada ci why --branch <default branch>`, cut a fix ticket, and hold merges when the breakage would spread.\n- **Deploys.** With `[[deploy.target]]`, each merge starts a watcher; a failed deploy or smoke check puts a `deploy` item in your inbox and opens a hold. `armada deploy status` shows the targets. Merge the fix through the hold; the next healthy deploy clears it.\n- **Red checks on a pull request.** `armada ci why <pr>` names the failing tests, first errors and runner problems. `armada ci why <pr> --rerun` reruns once only when every failure is a runner problem or a declared `[[ci.known_failure]]`, and names each flake's root-cause ticket. Anything else is a real failure: send it back to the worker.\n\nDone when no hold is open without a ticket that fixes it.\n\n### 8. Turn findings into tickets\n\nA gap a worker reports or a bug you see becomes a ticket under the right spec, with its blocked-by relations, and is launched when ready. No finding lives only in a transcript. `armada spec add \"<name>\"` creates a spec under the program root with the **In short** template; fill it in before cutting its tickets, then `armada lint <ticket>` each one. Inserting or renumbering specs is in REFERENCE.md.\n\n### 9. Report to the owner\n\nStatus reminds you once per 24 hours per project to use the digest; a successful merge without deploy targets reminds you to add `[[deploy.target]]` with a smoke command (`armada doctor` lists it). These hints stay out of JSON and worker output. When the owner asks where things stand, run `armada digest` and paste its text; `--since 4h` sets the window and `--send` posts it through the organization's channel. The summary includes deploy target states and long jobs with reported progress and estimated ends; when work spans several specs, it groups merged, waiting and in-progress tickets by spec with done/total counts. Owner validations and questions also reach that channel by themselves (Organization > Notifications). Report in the owner's language (`[tracker] language`): what merged, what runs, what you decided for them, and the one thing they must do, with its exact place. Outcomes and numbers, no process narration.\n\nThen repeat from step 1.\n\n## Rules of thumb\n\n- Never pipe Armada commands through `grep`, `tail` or `head`: their last lines say whether something happened and what to do next.\n- Long runs (an evaluation, a backfill) go through `armada job`, never in your session or a worker's.\n- Parallel workers in one area collide: stagger them, or give each a disjoint area and say the boundary in `--notes`.\n- Evidence for the owner goes through `armada attach <ticket> <files|urls>... --caption \"<what to check>\"`; link the printed URLs. Screenshots stay out of git.\n- Everything that must outlive your session goes to the tracker or the repository.\n- When a command named here is missing from your Armada version (`armada --help`), run `armada upgrade`; if you cannot, do the step by hand with the same protocol and say so in your report.\n"
|
|
11634
11720
|
}
|
|
11635
11721
|
]
|
|
11636
11722
|
},
|
|
@@ -11650,7 +11736,7 @@ var skills_generated_default = [
|
|
|
11650
11736
|
files: [
|
|
11651
11737
|
{
|
|
11652
11738
|
path: "SKILL.md",
|
|
11653
|
-
content: "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada drives Conductor workers by itself, through the `conductor` command line tool:\n\n| Step | Armada command | What it does |\n| --- | --- | --- |\n| Launch | `armada launch` | creates one workspace and session with the brief |\n| Deliver | `armada answer`, `armada answer --note` | sends the text into the session, then records it |\n| Observe | `armada status`, `armada inbox`, `armada watch` | read the session's state before calling a worker silent |\n| Peek | `armada peek` | the last reply, recent commands, checks and questions |\n| Replace | `armada relaunch` | a new session on the same branch and pull request |\n| Archive | `armada merge`, `armada stop` | archive the workspace after a merge or release |\n\nThis guide says how to read what they print, and keeps the raw `conductor` commands for when Armada cannot act: the appendices at the end. The coordinator must be signed in to Armada (`armada login`) and to Conductor.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, not on PATH; `armada doctor` prints the fix. In a Conductor Cloud workspace it reads `CONDUCTOR_API_KEY` and needs no login. `conductor auth whoami` checks the sign-in (exit 0 when it works); `conductor auth status` only looks at the macOS Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`: the claim comment carries it, so `armada status` and the ticket lead back to the session.\n- A worker needs no key in its workspace: its brief carries a one-time launch token, exchanged at its first command for a session limited to its ticket. Never pass keys through Conductor's `--env`.\n\n## Launch\n\n```sh\narmada launch ABC-12 --runtime conductor --profile <name> --reason \"<why>\" --notes notes.md\n```\n\n- `--profile` and `--reason` are needed only when routing does not settle the profile. Add `--pre-approve` (its reason is the same `--reason`) when the plan needs no review.\n- `--notes <file|->`: context only you have, up to 16 KB. Notes never approve a plan; the brief's Plan line decides.\n- `--dry-run` checks the ticket, the profile and the Conductor sign-in, and creates nothing.\n- The command refuses a ticket already launched or claimed, takes a launch lease, mints the token, and creates one workspace with the profile's agent, model, effort and fast mode, the brief passed on stdin. `[conductor] project_id` picks a Conductor project instead of the repository URL; `base_branch` overrides the default branch. It prints the profile, the `<workspaceId>/<sessionId>` handle and the session link, never the token.\n- A known failure revokes that token. A lost answer is recovered by searching for the workspace, never by creating it again; when the search is not conclusive, the launch stays pending and the output names the candidates and the commands to settle it. Never launch the same ticket a second time before reading that output.\n\nThe brief makes the worker start `armada heartbeat --every 5m --parent \"$PPID\" --background` right after its claim: a detached process that pings Armada until the worker's agent process exits or its session ends. A worker waiting on you (`awaiting-approval`, `blocked`, `awaiting-validation`) needs no heartbeat; after your answer it reports its working phase and restarts the heartbeat.\n\n**Check the claim** a few minutes later: `armada status` lists the ticket in flight with runtime `Conductor` and the printed handle. No claim after `[policy] not_started_minutes` (ten by default) gives a `not-started` inbox entry, which says whether the worker never used its token or signed in and stopped before claiming. Read it with `armada peek ABC-12`. A worker stuck on a setup choice gets a note to take the safe option. A refused or expired token needs a new one: run `armada brief ABC-12 --prompt` and send the worker only its `armada login --launch-token …` line (manual message, below). A worker cut off from Armada was revoked or idle for three days: ask the owner before giving it a new token. A worker that is gone: `armada relaunch ABC-12 --reason \"never claimed\"`, or `armada launch revoke ABC-12`.\n\n## Message\n\n```sh\narmada answer <item> \"Plan approved. Go on.\"\narmada answer --note ABC-12 \"<a message the worker did not ask for>\"\narmada answer <item> --message-file /tmp/abc-12-answer.md\n```\n\nOne command delivers the text into the worker's session, posts it on the ticket and records it on Armada; an answer resolves its question or plan. The receipt says `queued` when a turn is still running: accepted is not read, so check the reply with `armada peek`.\n\n- After a failure, run the same command with the same text: Armada reuses the message id and Conductor delivers it once. Changed text is a new message.\n- A question older than the current worker, an ended claim or a replaced launch is refused before anything is sent. An archived workspace cannot receive messages: relaunch the worker.\n- A launch bound to its session can receive notes before its claim.\n- Never follow an `armada answer` with a manual send of the same text, or the other way round: the worker would get it twice.\n\n## Status\n\nArmada reads each worker's session itself, before `armada status`, `armada inbox` and each watch poll, when the heartbeat is older than half of `policy.silence_minutes` (at most every five minutes per session). A session still `working` is called silent only past twice the allowance, and the alert says it is working. A session `idle` in a working phase for five minutes without a report or answer is `stopped`. An archived workspace ends its claim. Without a usable Conductor CLI, the plain silence rule applies.\n\n```sh\narmada peek ABC-12\narmada peek ABC-12 --actions 10 --json\n```\n\nPeek shows the session's state and since when, the worker's last reply, its recent commands and exit codes, its report and heartbeat ages, the pull request's checks and open questions, in your `TZ`, with secrets masked. It reads a bound launch before its claim too, and never writes to the worker. Repeated peeks read only what is new.\n\n- `working`: a turn is running; leave it unless it stays silent past twice the allowance.\n- `idle`: the turn ended. If the worker is not `ready-to-merge` or waiting on someone, it stopped: compare its last report with its reply, then nudge it with `armada answer --note`.\n- `failed`: the last turn failed. Nudge it once; if it fails again, relaunch.\n- `archived`: the workspace ended; its transcript can still be read.\n\n**Relaunch** a dead, failed or stuck worker:\n\n```sh\narmada relaunch ABC-12 --reason \"session failed twice\"\n```\n\nIt stops the old session, releases only that worker's claim, launches a replacement on the same branch and pull request, then archives the old session. A ready workspace is reused in place by default (a new session, uncommitted files kept); a failed or gone one gets a fresh workspace from the pushed branch. `--in-place` or `--fresh` choose; `--keep-old` skips the archive; `--dry-run` shows the plan. The replacement's brief names the pushed head and the pull request: it pushes there, never to a new pull request. On a partial failure, follow the printed state and command.\n\n## Stop and archive\n\n`armada merge` archives the merged worker's workspace once GitHub confirms the merge; never archive before it. For a worker you stop without a merge:\n\n```sh\narmada release --ticket ABC-12 --reason \"<why it stops>\"\narmada stop ABC-12\n```\n\n`armada stop` refuses while the worker holds the ticket. It checks the exact stored claim, waits up to ten minutes for the final turn to end, cancels it if needed, then archives. Run it also when a merge printed it after a failed cleanup (copy that command whole). The branch and the pull request stay on GitHub.\n\n## Without Armada: manual message\n\nFor a worker Armada has no bound launch or claim for (a new login line after a refused token), or a merge note `armada merge` printed because it could not deliver it. Check the current claim, its coordinator and phase first, and send only to the same active worker. If an earlier delivery's outcome was unknown, read the session before sending again.\n\n```sh\nprintf '%s\\n' \"<message>\" | conductor --json message create --session <sessionId> --message-file -\n```\n\nThe answer has `messageId` and `state` (`sent` or `queued`). There is no retry deduplication. Never record a printed merge note with `armada answer --note`: that posts it on the ticket.\n\n## Without Armada: status and transcript\n\n```sh\nconductor --json session status <sessionId> # {\"status\": \"working\" | \"idle\" | \"error\", \"updatedAt\"}\nconductor --json workspace status <workspaceId> # initializing, ready or archived\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\n```\n\nEvents come oldest first, 100 per page; `.hasMore` says when to fetch the next page with `--after <last event id>`. `.content.rawPayload` is the agent's own format:\n\n```sh\n# claude: final replies, then commands\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload.result' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n# codex: messages, then commands with exit codes\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types (`jq -r '.data[].content.rawPayload | .type // .event.type' … | sort | uniq -c`) and adapt.\n\n## Without Armada: manual stop and archive\n\nOnly for a worker Armada holds no claim for:\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\nWait until `session status` is `idle` before archiving: a hand-back runs inside the worker's last turn, which still writes its final reply. Poll every 15 seconds; after ten minutes, cancel, then archive.\n\n## Without Armada: manual launch\n\nOnly for a deliberate manual launch, with a brief and settings you prepared, and no secrets in `--env`:\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> --branch main \\\n --name \"ABC-12 <short title>\" --session-name ABC-12 \\\n --agent claude --model <model-id> --effort high \\\n --message-file - < worker-brief.md\n```\n\nThe answer names `workspaceId`, `sessionId` and `deepLink`. If the launch fails, revoke its token with `armada launch revoke ABC-12`.\n"
|
|
11739
|
+
content: "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada drives Conductor workers by itself, through the `conductor` command line tool:\n\n| Step | Armada command | What it does |\n| --- | --- | --- |\n| Launch | `armada launch` | creates one workspace and session with the brief |\n| Deliver | `armada answer`, `armada answer --note` | sends the text into the session, then records it |\n| Observe | `armada status`, `armada inbox`, `armada watch` | read the session's state before calling a worker silent |\n| Peek | `armada peek` | the last reply, recent commands, checks and questions |\n| Replace | `armada relaunch` | a new session on the same branch and pull request |\n| Archive | `armada merge`, `armada stop` | archive the workspace after a merge or release |\n\nThis guide says how to read what they print, and keeps the raw `conductor` commands for when Armada cannot act: the appendices at the end. The coordinator must be signed in to Armada (`armada login`) and to Conductor.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, not on PATH; `armada doctor` prints the fix. In a Conductor Cloud workspace it reads `CONDUCTOR_API_KEY` and needs no login. `conductor auth whoami` checks the sign-in (exit 0 when it works); `conductor auth status` only looks at the macOS Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`: the claim comment carries it, so `armada status` and the ticket lead back to the session.\n- A worker needs no key in its workspace: its brief carries a one-time launch token, exchanged at its first command for a session limited to its ticket. Never pass keys through Conductor's `--env`.\n\n## Launch\n\n```sh\narmada launch ABC-12 --runtime conductor --profile <name> --reason \"<why>\" --notes notes.md\n```\n\n- `--profile` and `--reason` are needed only when routing does not settle the profile. Add `--pre-approve` (its reason is the same `--reason`) when the plan needs no review.\n- `--notes <file|->`: context only you have, up to 16 KB. Notes never approve a plan; the brief's Plan line decides.\n- `--dry-run` checks the ticket, the profile and the Conductor sign-in, and creates nothing.\n- The command refuses a ticket already launched or claimed, takes a launch lease, mints the token, and creates one workspace with the profile's agent, model, effort and fast mode, the brief passed on stdin. `[conductor] project_id` picks a Conductor project instead of the repository URL; `base_branch` overrides the default branch. It prints the profile, the `<workspaceId>/<sessionId>` handle and the session link, never the token.\n- A known failure revokes that token. A lost answer is recovered by searching for the workspace, never by creating it again; when the search is not conclusive, the launch stays pending and the output names the candidates and the commands to settle it. Never launch the same ticket a second time before reading that output.\n\nThe brief makes the worker start `armada heartbeat --every 5m --parent \"$PPID\" --background` right after its claim: a detached process that pings Armada until the worker's agent process exits or its session ends. A worker waiting on you (`awaiting-approval`, `blocked`, `awaiting-validation`) needs no heartbeat; after your answer it reports its working phase and restarts the heartbeat.\n\n**Check the claim** a few minutes later: `armada status` lists the ticket in flight with runtime `Conductor` and the printed handle. No claim after `[policy] not_started_minutes` (ten by default) gives a `not-started` inbox entry, which says whether the worker never used its token or signed in and stopped before claiming. Read it with `armada peek ABC-12`. A worker stuck on a setup choice gets a note to take the safe option. A refused or expired token needs a new one: run `armada brief ABC-12 --prompt` and send the worker only its `armada login --launch-token …` line (manual message, below). A worker cut off from Armada was revoked or idle for three days: ask the owner before giving it a new token. A worker that is gone: `armada relaunch ABC-12 --reason \"never claimed\"`, or `armada launch revoke ABC-12`.\n\n## Message\n\n```sh\narmada answer <item> \"Plan approved. Go on.\"\narmada answer --note ABC-12 \"<a message the worker did not ask for>\"\narmada answer <item> --message-file /tmp/abc-12-answer.md\n```\n\nOne command delivers the text into the worker's session, posts it on the ticket and records it on Armada; an answer resolves its question or plan. The receipt says `queued` when a turn is still running: accepted is not read, so check the reply with `armada peek`.\n\n- After a failure, run the same command with the same text: Armada reuses the message id and Conductor delivers it once. Changed text is a new message.\n- A question older than the current worker, an ended claim or a replaced launch is refused before anything is sent. An archived workspace cannot receive messages: relaunch the worker.\n- A launch bound to its session can receive notes before its claim.\n- Never follow an `armada answer` with a manual send of the same text, or the other way round: the worker would get it twice.\n\n## Status\n\nArmada retries a read that times out, gets a server error, cannot spawn temporarily or returns truncated JSON up to twice with roughly 1 s and 3 s waits, announcing each retry on stderr and adding at most 14 s per read; missing sign-in, invalid requests and not-found workers are not retried, and create, message, cancel and archive writes are always attempted once.\n\nArmada reads each worker's session itself, before `armada status`, `armada inbox` and each watch poll, when the heartbeat is older than half of `policy.silence_minutes` (at most every five minutes per session). A session still `working` is called silent only past twice the allowance, and the alert says it is working. A session `idle` in a working phase for five minutes without a report or answer is `stopped`. An archived workspace ends its claim. Without a usable Conductor CLI, the plain silence rule applies.\n\n```sh\narmada peek ABC-12\narmada peek ABC-12 --actions 10 --json\n```\n\nPeek shows the session's state and since when, the worker's last reply, its recent commands and exit codes, its report and heartbeat ages, the pull request's checks and open questions, in your `TZ`, with secrets masked. It reads a bound launch before its claim too, and never writes to the worker. Repeated peeks read only what is new.\n\n- `working`: a turn is running; leave it unless it stays silent past twice the allowance.\n- `idle`: the turn ended. If the worker is not `ready-to-merge` or waiting on someone, it stopped: compare its last report with its reply, then nudge it with `armada answer --note`.\n- `failed`: the last turn failed. Nudge it once; if it fails again, relaunch.\n- `archived`: the workspace ended; its transcript can still be read.\n\n**Relaunch** a dead, failed or stuck worker:\n\n```sh\narmada relaunch ABC-12 --reason \"session failed twice\"\n```\n\nIt stops the old session, releases only that worker's claim, launches a replacement on the same branch and pull request, then archives the old session. A ready workspace is reused in place by default (a new session, uncommitted files kept); a failed or gone one gets a fresh workspace from the pushed branch. `--in-place` or `--fresh` choose; `--keep-old` skips the archive; `--dry-run` shows the plan. The replacement's brief names the pushed head and the pull request: it pushes there, never to a new pull request. On a partial failure, follow the printed state and command.\n\n## Stop and archive\n\n`armada merge` archives the merged worker's workspace once GitHub confirms the merge; never archive before it. For a worker you stop without a merge:\n\n```sh\narmada release --ticket ABC-12 --reason \"<why it stops>\"\narmada stop ABC-12\n```\n\n`armada stop` refuses while the worker holds the ticket. It checks the exact stored claim, waits up to ten minutes for the final turn to end, cancels it if needed, then archives. Run it also when a merge printed it after a failed cleanup (copy that command whole). The branch and the pull request stay on GitHub.\n\n## Without Armada: manual message\n\nFor a worker Armada has no bound launch or claim for (a new login line after a refused token), or a merge note `armada merge` printed because it could not deliver it. Check the current claim, its coordinator and phase first, and send only to the same active worker. If an earlier delivery's outcome was unknown, read the session before sending again.\n\n```sh\nprintf '%s\\n' \"<message>\" | conductor --json message create --session <sessionId> --message-file -\n```\n\nThe answer has `messageId` and `state` (`sent` or `queued`). There is no retry deduplication. Never record a printed merge note with `armada answer --note`: that posts it on the ticket.\n\n## Without Armada: status and transcript\n\n```sh\nconductor --json session status <sessionId> # {\"status\": \"working\" | \"idle\" | \"error\", \"updatedAt\"}\nconductor --json workspace status <workspaceId> # initializing, ready or archived\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\n```\n\nEvents come oldest first, 100 per page; `.hasMore` says when to fetch the next page with `--after <last event id>`. `.content.rawPayload` is the agent's own format:\n\n```sh\n# claude: final replies, then commands\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload.result' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n# codex: messages, then commands with exit codes\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types (`jq -r '.data[].content.rawPayload | .type // .event.type' … | sort | uniq -c`) and adapt.\n\n## Without Armada: manual stop and archive\n\nOnly for a worker Armada holds no claim for:\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\nWait until `session status` is `idle` before archiving: a hand-back runs inside the worker's last turn, which still writes its final reply. Poll every 15 seconds; after ten minutes, cancel, then archive.\n\n## Without Armada: manual launch\n\nOnly for a deliberate manual launch, with a brief and settings you prepared, and no secrets in `--env`:\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> --branch main \\\n --name \"ABC-12 <short title>\" --session-name ABC-12 \\\n --agent claude --model <model-id> --effort high \\\n --message-file - < worker-brief.md\n```\n\nThe answer names `workspaceId`, `sessionId` and `deepLink`. If the launch fails, revoke its token with `armada launch revoke ABC-12`.\n"
|
|
11654
11740
|
}
|
|
11655
11741
|
]
|
|
11656
11742
|
},
|
|
@@ -11683,7 +11769,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
11683
11769
|
- **The ticket is the source of truth.** Read it, its parent spec and the hand-back comments of its merged blockers in full before planning.
|
|
11684
11770
|
- **Report at each real step** with \`armada report <phase> --message "<what changed, what is next>"\`: the plan, real implementation progress, blockers, tests, shipping and the hand-back. The same phase again is a status update. Never post an empty report just to look alive: the heartbeat does that.
|
|
11685
11771
|
- **Keep going on setup choices.** When setup needs a choice (an install fallback, a retry, a missing tool), take the safe option, say which in your next report, and go on. Never stop to ask about it.
|
|
11686
|
-
- **Ask instead of guessing** when a choice changes the ticket's outcome: \`armada ask "<question and your recommendation>" --options "<a> | <b>"\`. Your phase becomes \`blocked\` and the question reaches the coordinator. Then **stop and end your turn**: the answer arrives as a message in this session. When it arrives, report the phase you resume, for example \`armada report implementing --message "resumed: <the decision>"\`. Decide reversible technical choices yourself and record each one, with its reason, on the ticket and in the pull request.
|
|
11772
|
+
- **Ask instead of guessing** when a choice changes the ticket's outcome: \`armada ask "<question and your recommendation>" --options "<a> | <b>"\`. Reporting any phase other than \`ready-to-merge\` clears your previous hand-back; once the fix is shipped, report \`ready-to-merge\` again so the coordinator gets a new item. Your phase becomes \`blocked\` and the question reaches the coordinator. Then **stop and end your turn**: the answer arrives as a message in this session. When it arrives, report the phase you resume, for example \`armada report implementing --message "resumed: <the decision>"\`. Decide reversible technical choices yourself and record each one, with its reason, on the ticket and in the pull request.
|
|
11687
11773
|
- **Work only in your own branch and worktree.** Never touch another agent's checkout, and stop only the processes you started.
|
|
11688
11774
|
- **Shared numbers and names come from \`armada reserve\`, never a guess**: a migration number, a port, a fixture name. \`armada reserve db-migration --next --floor <last number used on main>\` prints the next free number; \`--value <name>\` takes a name; a key alone takes an exclusive resource. \`armada reserve --list\` shows the holders. Reservations end when you release, stay used after merge, and \`armada unreserve <key>\` frees yours early. After a lost answer, list before retrying. If Armada is down, ask the coordinator before choosing.
|
|
11689
11775
|
- **Long runs go through \`armada job\`, never in your session**: an evaluation, a backfill, a load test. \`armada job start <name> --ticket <id>\` dispatches one of the project's \`[jobs.<name>]\` on its own runner; \`armada job status\` asks the runner, \`armada job list\` reads stored progress, \`armada job stop <id>\` stops it. You only see your own ticket's jobs. Nothing is stopped for you.
|
|
@@ -15170,7 +15256,6 @@ function skillsBehindFix(b, cli) {
|
|
|
15170
15256
|
const newer = ahead(b, cli);
|
|
15171
15257
|
return newer ? `update the CLI, not the skills: ${installCommand(newer)}` : "run `armada init` and merge its PR (`armada merge <n> --no-ticket`)";
|
|
15172
15258
|
}
|
|
15173
|
-
var skillsBehindLine = (b, cli) => `${skillsBehindMessage(b, cli)}: ${skillsBehindFix(b, cli)}`;
|
|
15174
15259
|
async function skillsBehind(view) {
|
|
15175
15260
|
let lock;
|
|
15176
15261
|
try {
|
|
@@ -15969,7 +16054,7 @@ ${attachments.join(`
|
|
|
15969
16054
|
};
|
|
15970
16055
|
}
|
|
15971
16056
|
// package.json
|
|
15972
|
-
var version = "0.2.
|
|
16057
|
+
var version = "0.2.62";
|
|
15973
16058
|
|
|
15974
16059
|
// src/io.ts
|
|
15975
16060
|
class UsageError extends Error {
|
|
@@ -18411,12 +18496,28 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18411
18496
|
`) : null
|
|
18412
18497
|
};
|
|
18413
18498
|
});
|
|
18499
|
+
for (const target of config.deploy.targets) {
|
|
18500
|
+
if (!target.smoke)
|
|
18501
|
+
checks.push({
|
|
18502
|
+
id: `deploy-smoke:${target.name}`,
|
|
18503
|
+
level: "warning",
|
|
18504
|
+
message: `${target.name}: no smoke command; a live but broken service reads healthy`,
|
|
18505
|
+
fix: `add smoke = "<command that fails when the service is broken>" to [[deploy.target]] ${target.name}`
|
|
18506
|
+
});
|
|
18507
|
+
if (target.liveShaCommand)
|
|
18508
|
+
checks.push({
|
|
18509
|
+
id: `deploy-source:${target.name}`,
|
|
18510
|
+
level: "info",
|
|
18511
|
+
message: `${target.name}: a failed deploy shows only at timeout_minutes and a host skip becomes a pause; switch to check (exit 0 live, 1 failed, 2 pending or skipped)`,
|
|
18512
|
+
fix: null
|
|
18513
|
+
});
|
|
18514
|
+
}
|
|
18414
18515
|
if (local.warning)
|
|
18415
18516
|
checks.unshift({
|
|
18416
18517
|
id: "deploy-machine-settings",
|
|
18417
18518
|
level: "warning",
|
|
18418
18519
|
message: local.warning,
|
|
18419
|
-
fix: checks.find((c) => c.fix)?.fix ?? `armada config set deploy.env.<VAR> <value>${configFlag}`
|
|
18520
|
+
fix: checks.find((c) => c.id.startsWith("deploy-env:") && c.fix)?.fix ?? `armada config set deploy.env.<VAR> <value>${configFlag}`
|
|
18420
18521
|
});
|
|
18421
18522
|
return checks;
|
|
18422
18523
|
})(),
|
|
@@ -18578,6 +18679,14 @@ var safeLink = (v) => {
|
|
|
18578
18679
|
}
|
|
18579
18680
|
};
|
|
18580
18681
|
var timestamp = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) ? new Date(v).toISOString() : null;
|
|
18682
|
+
|
|
18683
|
+
class RetryRead extends Error {
|
|
18684
|
+
failure;
|
|
18685
|
+
constructor(failure) {
|
|
18686
|
+
super(failure.message);
|
|
18687
|
+
this.failure = failure;
|
|
18688
|
+
}
|
|
18689
|
+
}
|
|
18581
18690
|
function conductorLaunchArguments(spec) {
|
|
18582
18691
|
const p = spec.profile;
|
|
18583
18692
|
const base = spec.from.kind === "branch" ? spec.branch : spec.base;
|
|
@@ -18608,6 +18717,7 @@ function conductorLaunchArguments(spec) {
|
|
|
18608
18717
|
class ConductorAdapter {
|
|
18609
18718
|
io;
|
|
18610
18719
|
secretValues;
|
|
18720
|
+
retries;
|
|
18611
18721
|
name = "conductor";
|
|
18612
18722
|
guide = "armada-runtime-conductor";
|
|
18613
18723
|
can = {
|
|
@@ -18620,9 +18730,10 @@ class ConductorAdapter {
|
|
|
18620
18730
|
archive: true
|
|
18621
18731
|
};
|
|
18622
18732
|
binary = "conductor";
|
|
18623
|
-
constructor(io, secretValues = []) {
|
|
18733
|
+
constructor(io, secretValues = [], retries = {}) {
|
|
18624
18734
|
this.io = io;
|
|
18625
18735
|
this.secretValues = secretValues;
|
|
18736
|
+
this.retries = retries;
|
|
18626
18737
|
}
|
|
18627
18738
|
parse(handle) {
|
|
18628
18739
|
const parts = handle.split("/");
|
|
@@ -18653,6 +18764,34 @@ class ConductorAdapter {
|
|
|
18653
18764
|
return new RuntimeError(`Conductor ${operation} returned ${json ? "invalid or truncated JSON" : "an invalid response"}${mutation ? "; inspect the session before retrying" : ""}`, mutation ? "unknown-outcome" : "invalid", "use the armada-runtime-conductor guide");
|
|
18654
18765
|
}
|
|
18655
18766
|
async exec(args, input, mutation = false, timeoutMs = 1e4) {
|
|
18767
|
+
return this.retry(args, mutation, timeoutMs, (limit) => this.execOnce(args, input, mutation, limit));
|
|
18768
|
+
}
|
|
18769
|
+
async retry(args, mutation, timeoutMs, run) {
|
|
18770
|
+
let deadline;
|
|
18771
|
+
let limit = timeoutMs;
|
|
18772
|
+
for (let attempt = 1;; attempt++) {
|
|
18773
|
+
try {
|
|
18774
|
+
return await run(limit);
|
|
18775
|
+
} catch (error) {
|
|
18776
|
+
if (!(error instanceof RetryRead))
|
|
18777
|
+
throw error;
|
|
18778
|
+
if (mutation || attempt === 3)
|
|
18779
|
+
throw error.failure;
|
|
18780
|
+
deadline ??= this.now() + 14000;
|
|
18781
|
+
const base = attempt === 1 ? 1000 : 3000;
|
|
18782
|
+
const random = Math.max(0, Math.min(1, (this.retries.random ?? Math.random)()));
|
|
18783
|
+
const delay = Math.round(base * (0.8 + random * 0.4));
|
|
18784
|
+
if (this.now() + delay >= deadline)
|
|
18785
|
+
throw error.failure;
|
|
18786
|
+
this.retries.onRetry?.(`Conductor ${args.slice(0, 2).join(" ")} did not answer; trying again in ${(delay / 1000).toFixed(1)} s (${attempt + 1}/3)`);
|
|
18787
|
+
await this.sleep(delay);
|
|
18788
|
+
limit = Math.min(timeoutMs, deadline - this.now());
|
|
18789
|
+
if (limit <= 0)
|
|
18790
|
+
throw error.failure;
|
|
18791
|
+
}
|
|
18792
|
+
}
|
|
18793
|
+
}
|
|
18794
|
+
async execOnce(args, input, mutation = false, timeoutMs = 1e4) {
|
|
18656
18795
|
if (!this.io.exec)
|
|
18657
18796
|
throw new RuntimeError("Conductor CLI execution is unavailable on this machine", "unavailable", "armada doctor");
|
|
18658
18797
|
const operation = args.slice(0, 2).join(" ");
|
|
@@ -18668,40 +18807,46 @@ class ConductorAdapter {
|
|
|
18668
18807
|
} catch (e) {
|
|
18669
18808
|
if (this.binary === "conductor" && this.io.platform === "darwin" && e.code === "ENOENT") {
|
|
18670
18809
|
this.binary = BUNDLED_CONDUCTOR;
|
|
18671
|
-
return this.
|
|
18810
|
+
return this.execOnce(args, input, mutation, timeoutMs);
|
|
18672
18811
|
}
|
|
18673
18812
|
if (e.code === "ENOENT")
|
|
18674
18813
|
throw new RuntimeError("Conductor CLI is missing", "unavailable", CONDUCTOR_INSTALL_FIX);
|
|
18675
18814
|
if (mutation)
|
|
18676
18815
|
throw this.error("unknown-outcome");
|
|
18677
|
-
|
|
18816
|
+
const error = new RuntimeError(e.code === "EACCES" ? "Conductor CLI cannot be executed: permission denied" : `Conductor CLI could not execute ${operation}`, "unavailable", "armada doctor");
|
|
18817
|
+
throw e.code === "EACCES" ? error : new RetryRead(error);
|
|
18678
18818
|
}
|
|
18679
18819
|
if (r.timedOut)
|
|
18680
|
-
throw mutation ? this.error("unknown-outcome") : new RuntimeError(`Conductor ${operation} timed out after ${timeoutMs} ms`, "unavailable", "retry once Conductor answers");
|
|
18820
|
+
throw mutation ? this.error("unknown-outcome") : new RetryRead(new RuntimeError(`Conductor ${operation} timed out after ${timeoutMs} ms`, "unavailable", "retry once Conductor answers"));
|
|
18681
18821
|
if (r.outputExceeded)
|
|
18682
18822
|
throw mutation ? this.error("unknown-outcome") : new RuntimeError(`Conductor ${operation} exceeded the 2000000-byte output limit`, "unavailable", "use the armada-runtime-conductor guide");
|
|
18683
18823
|
if (r.code !== 0) {
|
|
18684
18824
|
const code = r.code === 3 ? "auth" : r.code === 4 ? "unavailable" : r.code === 1 && args[1] === "create" ? "unknown-outcome" : r.code === 2 ? "invalid" : r.code === 1 && ["status", "message"].includes(args[1] ?? "") ? "not-found" : "unavailable";
|
|
18685
18825
|
if (code === "unknown-outcome")
|
|
18686
18826
|
throw new RuntimeError("Conductor create failed without confirming whether a worker was created", code, "conductor model");
|
|
18687
|
-
if (code === "unavailable")
|
|
18688
|
-
|
|
18827
|
+
if (code === "unavailable") {
|
|
18828
|
+
const error = new RuntimeError(`Conductor ${r.code === 4 ? "server error" : "CLI failed"} during ${operation} (exit ${r.code})`, code, "use the armada-runtime-conductor guide");
|
|
18829
|
+
throw !mutation && r.code === 4 ? new RetryRead(error) : error;
|
|
18830
|
+
}
|
|
18689
18831
|
throw this.error(code);
|
|
18690
18832
|
}
|
|
18691
18833
|
return r;
|
|
18692
18834
|
}
|
|
18693
18835
|
async call(args, input, mutation = false, timeoutMs = 1e4) {
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18836
|
+
return this.retry(args, mutation, timeoutMs, async (limit) => {
|
|
18837
|
+
const r = await this.execOnce(args, input, mutation, limit);
|
|
18838
|
+
let decoded;
|
|
18839
|
+
try {
|
|
18840
|
+
decoded = JSON.parse(r.stdout);
|
|
18841
|
+
} catch {
|
|
18842
|
+
const error = this.invalidResponse(args.slice(0, 2).join(" "), mutation, true);
|
|
18843
|
+
throw mutation ? error : new RetryRead(error);
|
|
18844
|
+
}
|
|
18845
|
+
const value = object2(decoded);
|
|
18846
|
+
if (!value)
|
|
18847
|
+
throw this.invalidResponse(args.slice(0, 2).join(" "), mutation);
|
|
18848
|
+
return value;
|
|
18849
|
+
});
|
|
18705
18850
|
}
|
|
18706
18851
|
async preflight(input) {
|
|
18707
18852
|
const checks = [];
|
|
@@ -19335,7 +19480,8 @@ function runtimeFor(io, config, runtime, secretValues = []) {
|
|
|
19335
19480
|
];
|
|
19336
19481
|
switch (runtimeNameOf(runtime)) {
|
|
19337
19482
|
case "conductor":
|
|
19338
|
-
return new ConductorAdapter(io, values)
|
|
19483
|
+
return new ConductorAdapter(io, values, { onRetry: (message) => io.stderr(`${message}
|
|
19484
|
+
`) });
|
|
19339
19485
|
case "herdr":
|
|
19340
19486
|
return herdrErrors(new HerdrAdapter(io, config, values));
|
|
19341
19487
|
case "claude-code":
|
|
@@ -19682,6 +19828,7 @@ function statusLive(io, config, credentials) {
|
|
|
19682
19828
|
deferredLaunches: () => fleet.deferredLaunches(),
|
|
19683
19829
|
holds: () => fleet.holds(),
|
|
19684
19830
|
queue: () => fleet.queueList(),
|
|
19831
|
+
coordinators: () => fleet.coordinators(),
|
|
19685
19832
|
runtimeHandles: () => observeRuntimes(io, fleet, config)
|
|
19686
19833
|
} : undefined;
|
|
19687
19834
|
}
|
|
@@ -20216,7 +20363,13 @@ function renderEntries(project, items) {
|
|
|
20216
20363
|
if (!items.length)
|
|
20217
20364
|
return [`Inbox of ${project}: nothing waits for you.`];
|
|
20218
20365
|
const out = [`Inbox of ${project} (${items.length}), oldest first:`];
|
|
20219
|
-
|
|
20366
|
+
const waiting = items.filter((e) => !e.queue);
|
|
20367
|
+
const progressing = items.filter((e) => e.queue);
|
|
20368
|
+
if (progressing.length && waiting.length)
|
|
20369
|
+
out.push("Waiting for you:");
|
|
20370
|
+
for (const e of [...waiting, ...progressing]) {
|
|
20371
|
+
if (e === progressing[0])
|
|
20372
|
+
out.push("In progress:");
|
|
20220
20373
|
const head = [
|
|
20221
20374
|
e.id === null ? e.kind : `#${e.id} ${e.kind}`,
|
|
20222
20375
|
e.ticket,
|
|
@@ -20227,7 +20380,10 @@ function renderEntries(project, items) {
|
|
|
20227
20380
|
e.request?.pr && `PR #${e.request.pr}`,
|
|
20228
20381
|
e.createdAt
|
|
20229
20382
|
].filter(Boolean).join(" · ");
|
|
20230
|
-
out.push(`${e.new ? "* " : " "}${head}
|
|
20383
|
+
out.push(`${e.new ? "* " : " "}${head}`);
|
|
20384
|
+
if (e.queue)
|
|
20385
|
+
out.push(` ${e.queue.state === "queued" ? `queued in the merge queue (position ${e.queue.position})` : `merging: ${e.queue.detail ?? "starting the drain"}`}`);
|
|
20386
|
+
out.push(...e.body.split(`
|
|
20231
20387
|
`).map((l) => l ? ` ${l}` : ""));
|
|
20232
20388
|
if (e.kind === "hand-back" && !/shipped with (?:ship-pr-dev|the fallback:)|shipping path unreported/.test(e.body))
|
|
20233
20389
|
out.push(" shipping path unreported");
|
|
@@ -20284,12 +20440,13 @@ async function inbox2(io, config, credentials, a) {
|
|
|
20284
20440
|
});
|
|
20285
20441
|
const inFlight = name === "default" ? report.inFlight : report.ownedInFlight ?? (scope === "mine" ? report.inFlight : null);
|
|
20286
20442
|
const openJobs = name === "default" ? report.openJobs : report.ownedOpenJobs ?? (scope === "mine" ? report.openJobs : undefined);
|
|
20287
|
-
await remember(io, report.project, shown(io, report.items, inFlight, openJobs));
|
|
20443
|
+
await remember(io, report.project, shown(io, report.items, inFlight, openJobs, scope));
|
|
20444
|
+
const open = report.items.filter((e) => !e.queue && (e.owner == null || e.owner === name)).length;
|
|
20288
20445
|
const next = await rearmFor(io, report.project, {
|
|
20289
20446
|
inFlight,
|
|
20290
|
-
open
|
|
20447
|
+
open,
|
|
20291
20448
|
openJobs,
|
|
20292
|
-
act:
|
|
20449
|
+
act: open > 0
|
|
20293
20450
|
});
|
|
20294
20451
|
const runtimes = (await fleet.runtimeHandles().catch(() => [])).filter((h) => h.runtimeState && (scope === "all" || h.coordinator === name)).map((h) => ({
|
|
20295
20452
|
ticket: h.ticket,
|
|
@@ -20630,16 +20787,19 @@ function refreshingJobsFleet(io, fleet, config, root, signal) {
|
|
|
20630
20787
|
// src/release.ts
|
|
20631
20788
|
var NOTICE_COMMANDS = new Set(["status", "inbox"]);
|
|
20632
20789
|
var NOTICE_MS = 24 * 60 * 60000;
|
|
20633
|
-
async function noticeRelease(io, running, view = fsRepoView(io.cwd)) {
|
|
20790
|
+
async function noticeRelease(io, running, view = fsRepoView(io.cwd), options = {}) {
|
|
20634
20791
|
const server = heard(io).server;
|
|
20635
|
-
if (io.env.ARMADA_TICKET?.trim() ||
|
|
20792
|
+
if (io.env.ARMADA_TICKET?.trim() || server && compareVersions(running, server.minimum) < 0)
|
|
20636
20793
|
return;
|
|
20637
|
-
const latest = newerRelease(running, server.latest);
|
|
20638
20794
|
const paths = machinePaths(io.env);
|
|
20639
|
-
if (!
|
|
20795
|
+
if (!paths)
|
|
20640
20796
|
return;
|
|
20797
|
+
const newer = newerRelease(running, server?.latest);
|
|
20641
20798
|
const setupBehind = await skillsBehind(view) !== null;
|
|
20642
|
-
|
|
20799
|
+
if ((!newer || options.setupOnly) && !setupBehind)
|
|
20800
|
+
return;
|
|
20801
|
+
const latest = newer ?? running;
|
|
20802
|
+
const reserved = await addNoticedRelease(paths, setupBehind ? `setup:${latest}` : latest, (io.now ?? (() => new Date))(), {
|
|
20643
20803
|
intervalMs: NOTICE_MS,
|
|
20644
20804
|
pid: io.pid,
|
|
20645
20805
|
alive: io.processAlive
|
|
@@ -20649,21 +20809,16 @@ async function noticeRelease(io, running, view = fsRepoView(io.cwd)) {
|
|
|
20649
20809
|
io.stderr(`armada: ${releaseLine(running, latest, { setupBehind })}
|
|
20650
20810
|
`);
|
|
20651
20811
|
}
|
|
20652
|
-
function pendingRelease(io, running
|
|
20812
|
+
function pendingRelease(io, running) {
|
|
20653
20813
|
return async () => {
|
|
20654
20814
|
if (io.env.ARMADA_TICKET?.trim())
|
|
20655
20815
|
return null;
|
|
20656
20816
|
const server = heard(io).server;
|
|
20657
|
-
|
|
20658
|
-
const behind = await skillsBehind(view);
|
|
20659
|
-
if (!minimum && !behind)
|
|
20817
|
+
if (!server || compareVersions(running, server.minimum) >= 0)
|
|
20660
20818
|
return null;
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
setupBehind: behind !== null,
|
|
20664
|
-
minimum: minimum && server ? server.minimum : null
|
|
20819
|
+
return releaseEntry(running, versionToInstall(server.minimum, server.latest), (io.now ?? (() => new Date))(), {
|
|
20820
|
+
minimum: server.minimum
|
|
20665
20821
|
});
|
|
20666
|
-
return !minimum && seen.includes(entryKey(entry)) ? null : entry;
|
|
20667
20822
|
};
|
|
20668
20823
|
}
|
|
20669
20824
|
|
|
@@ -20679,7 +20834,21 @@ async function remember(io, project, patch) {
|
|
|
20679
20834
|
if (!paths)
|
|
20680
20835
|
return;
|
|
20681
20836
|
try {
|
|
20682
|
-
|
|
20837
|
+
const name = await coordinatorName(io, project);
|
|
20838
|
+
if (patch.seen && patch.seenScope) {
|
|
20839
|
+
const previous = await readWatchState(paths, project, name);
|
|
20840
|
+
const coversPrevious = !previous?.seen.length || patch.seenScope === "all" || previous?.seenScope === "mine";
|
|
20841
|
+
const open = new Set(patch.seen);
|
|
20842
|
+
const retained = (previous?.seen ?? []).filter((key) => !coversPrevious || key.startsWith("version:") || open.has(key));
|
|
20843
|
+
const keys = [...new Set([...retained, ...patch.seen])];
|
|
20844
|
+
const discarded = new Set(keys.filter((key) => !key.startsWith("version:")).slice(0, Math.max(0, keys.length - 500)));
|
|
20845
|
+
patch = {
|
|
20846
|
+
...patch,
|
|
20847
|
+
seen: keys.filter((key) => !discarded.has(key)).slice(-500),
|
|
20848
|
+
seenScope: coversPrevious ? patch.seenScope : "all"
|
|
20849
|
+
};
|
|
20850
|
+
}
|
|
20851
|
+
await updateWatchState(paths, project, patch, name);
|
|
20683
20852
|
} catch (err) {
|
|
20684
20853
|
io.stderr(`armada: warning: could not keep the watch state (${err instanceof Error ? err.message : String(err)})
|
|
20685
20854
|
`);
|
|
@@ -20703,8 +20872,9 @@ async function rearmFor(io, project, o) {
|
|
|
20703
20872
|
return rearm({ ...o, openJobs: o.openJobs ?? state?.openJobs, running, mode });
|
|
20704
20873
|
}
|
|
20705
20874
|
var now = (io) => (io.now ?? (() => new Date))();
|
|
20706
|
-
var shown = (io, items, inFlight, openJobs = []) => ({
|
|
20875
|
+
var shown = (io, items, inFlight, openJobs = [], scope = "all") => ({
|
|
20707
20876
|
seen: items.map(entryKey),
|
|
20877
|
+
seenScope: scope,
|
|
20708
20878
|
openJobs,
|
|
20709
20879
|
...inFlight ? { inFlight, readAt: now(io).toISOString() } : {},
|
|
20710
20880
|
stopped: null
|
|
@@ -20830,6 +21000,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20830
21000
|
let taken = false;
|
|
20831
21001
|
let timedOut = false;
|
|
20832
21002
|
let cancelDeadline;
|
|
21003
|
+
let noticeIo;
|
|
20833
21004
|
const until = options.minutes === undefined ? undefined : new Date(now(io).getTime() + options.minutes * 60000);
|
|
20834
21005
|
const resume = () => {
|
|
20835
21006
|
const flags = [
|
|
@@ -20883,6 +21054,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20883
21054
|
signal: init?.signal ? AbortSignal.any([init.signal, controller.signal]) : controller.signal
|
|
20884
21055
|
}) : undefined
|
|
20885
21056
|
};
|
|
21057
|
+
noticeIo = watchingIo;
|
|
20886
21058
|
const { fleet, warning } = liveFleet(watchingIo, config, credentials);
|
|
20887
21059
|
if (!fleet)
|
|
20888
21060
|
throw new Refusal(`the inbox is on Armada, which cannot be reached: ${warning ?? "no answer"}`, "armada whoami");
|
|
@@ -20926,7 +21098,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20926
21098
|
},
|
|
20927
21099
|
onRetry: (message) => io.stderr(`armada: warning: ${message}
|
|
20928
21100
|
`),
|
|
20929
|
-
release: pendingRelease(watchingIo, version
|
|
21101
|
+
release: pendingRelease(watchingIo, version)
|
|
20930
21102
|
};
|
|
20931
21103
|
if (options.follow) {
|
|
20932
21104
|
const cursor = options.cursor ?? before?.cursor ?? eventCursor(0, now(io).toISOString());
|
|
@@ -20952,7 +21124,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20952
21124
|
`)
|
|
20953
21125
|
})) {
|
|
20954
21126
|
io.stdout(json ? `${JSON.stringify(line)}
|
|
20955
|
-
` : `${line.at.slice(11, 16)} UTC ${line.kind} ${line.ticket ?? "-"} [#${line.id ?? "-"}] ${line.body.split(/\r?\n/)[0]}${line.new ? "" : " (open)"} cursor: ${line.cursor}
|
|
21127
|
+
` : `${line.at.slice(11, 16)} UTC ${line.kind} ${line.ticket ?? "-"} [#${line.id ?? "-"}] ${line.queue ? line.queue.state === "queued" ? `queued in the merge queue (position ${line.queue.position})` : `merging: ${line.queue.detail ?? "starting the drain"}` : line.body.split(/\r?\n/)[0]}${line.new ? "" : " (open)"} cursor: ${line.cursor}
|
|
20956
21128
|
`);
|
|
20957
21129
|
options.cursor = line.cursor;
|
|
20958
21130
|
}
|
|
@@ -20968,10 +21140,16 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20968
21140
|
}
|
|
20969
21141
|
const inFlight = name === "default" ? report.inFlight : report.ownedInFlight ?? (scope === "mine" ? report.inFlight : null);
|
|
20970
21142
|
const openJobs = name === "default" ? report.openJobs : report.ownedOpenJobs ?? (scope === "mine" ? report.openJobs : undefined);
|
|
20971
|
-
await remember(io, project, shown(io, report.items, inFlight, openJobs));
|
|
21143
|
+
await remember(io, project, shown(io, report.items, inFlight, openJobs, scope));
|
|
20972
21144
|
controller.signal.throwIfAborted();
|
|
20973
|
-
const open = report.items.filter((e) => e.kind !== "version").length;
|
|
20974
|
-
const next = rearm({
|
|
21145
|
+
const open = report.items.filter((e) => e.kind !== "version" && !e.queue && (e.owner == null || e.owner === name)).length;
|
|
21146
|
+
const next = rearm({
|
|
21147
|
+
inFlight,
|
|
21148
|
+
openJobs,
|
|
21149
|
+
open,
|
|
21150
|
+
running: null,
|
|
21151
|
+
act: report.items.some((e) => !e.queue && (e.owner == null || e.owner === name))
|
|
21152
|
+
});
|
|
20975
21153
|
if (json)
|
|
20976
21154
|
io.stdout(`${JSON.stringify({ ...report, watch: next }, null, 2)}
|
|
20977
21155
|
`);
|
|
@@ -20994,6 +21172,8 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20994
21172
|
await releaseWatchLock(paths, project, pid, identity, name).catch(() => {});
|
|
20995
21173
|
unsubscribe?.();
|
|
20996
21174
|
cancelDeadline?.();
|
|
21175
|
+
if (!options.follow && noticeIo)
|
|
21176
|
+
await noticeRelease(noticeIo, version, fsRepoView(dirname6(configPath)), { setupOnly: true }).catch(() => {});
|
|
20997
21177
|
}
|
|
20998
21178
|
if (stoppedBy) {
|
|
20999
21179
|
(options.follow ? io.stderr : io.stdout)(`armada watch for ${project} stopped by ${stoppedBy} (pid ${pid})
|
|
@@ -21522,8 +21702,9 @@ async function startDeploys(io, config, credentials, configPath, sha, targets, j
|
|
|
21522
21702
|
}) : false) ?? false;
|
|
21523
21703
|
} catch {}
|
|
21524
21704
|
results.push({ target: name, started, next: started ? null : next });
|
|
21705
|
+
const note = target.smoke ? "" : " (no smoke command: a live but broken service reads healthy)";
|
|
21525
21706
|
if (!json)
|
|
21526
|
-
io.stdout(started ? `Watching the deploy of ${sha} to ${name}
|
|
21707
|
+
io.stdout(started ? `Watching the deploy of ${sha} to ${name}${note}
|
|
21527
21708
|
` : `Next: ${next}
|
|
21528
21709
|
`);
|
|
21529
21710
|
}
|
|
@@ -21611,7 +21792,9 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21611
21792
|
ancestry.set(key, answer);
|
|
21612
21793
|
return answer;
|
|
21613
21794
|
};
|
|
21795
|
+
let observationDetail = "";
|
|
21614
21796
|
const write = (input) => recordDeploy(io, async (candidate) => {
|
|
21797
|
+
observationDetail = clean(candidate.detail);
|
|
21615
21798
|
if (candidate.state === "healthy" && candidate.liveSha) {
|
|
21616
21799
|
candidate = { ...candidate, coveredShas: [] };
|
|
21617
21800
|
for (const row of await fleet.deployState({ target: target.name })) {
|
|
@@ -21634,7 +21817,7 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21634
21817
|
}).catch((err) => {
|
|
21635
21818
|
if (err.code !== "ENOENT" && err.code !== "ENOTDIR")
|
|
21636
21819
|
throw err;
|
|
21637
|
-
return { code: 127, stdout: "", stderr: err.message, timedOut: false };
|
|
21820
|
+
return { code: 127, stdout: "", stderr: err.message, timedOut: false, outputExceeded: false };
|
|
21638
21821
|
});
|
|
21639
21822
|
const notRunnable = !!result && !result.timedOut && result.code !== 0 && (result.code === 127 || /(?:^|\n)[^\n]*(?:sh|bash|dash|zsh):[^\n]*(?:[A-Za-z_][A-Za-z0-9_]*: (?:set [A-Za-z_][A-Za-z0-9_]*|parameter (?:null or )?not set|unbound variable)|cd:[^\n]*(?:can't cd|cannot|No such file|not a directory))/i.test(result.stderr) || [...command.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*):?\?/g)].some((match) => result.stderr.includes(`${match[1]}:`)));
|
|
21640
21823
|
const detail = deployDetail(clean(`${result?.stdout ?? ""}
|
|
@@ -21643,6 +21826,9 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
|
21643
21826
|
if (notRunnable)
|
|
21644
21827
|
configurationDetail = detail;
|
|
21645
21828
|
return {
|
|
21829
|
+
code: result?.code ?? 1,
|
|
21830
|
+
timedOut: result?.timedOut ?? false,
|
|
21831
|
+
outputExceeded: result?.outputExceeded ?? false,
|
|
21646
21832
|
ok: result?.code === 0 && !result.timedOut,
|
|
21647
21833
|
detail,
|
|
21648
21834
|
notRunnable,
|
|
@@ -21691,7 +21877,7 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
|
21691
21877
|
};
|
|
21692
21878
|
try {
|
|
21693
21879
|
const prior = (await fleet.deployState({ target: target.name, sha }))[0];
|
|
21694
|
-
if (prior && !["waiting", "live", "skipped", "not-runnable"].includes(prior.state)) {
|
|
21880
|
+
if (prior && !["waiting", "live", "skipped", "not-runnable", "not-deployed"].includes(prior.state)) {
|
|
21695
21881
|
io.backgroundReady?.(true);
|
|
21696
21882
|
io.stdout(`${target.name}: ${prior.state}
|
|
21697
21883
|
`);
|
|
@@ -21708,7 +21894,7 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
|
21708
21894
|
const result = await watchDeploy({
|
|
21709
21895
|
target,
|
|
21710
21896
|
sha,
|
|
21711
|
-
...prior && !["skipped", "not-runnable"].includes(prior.state) ? { startedAt: new Date(prior.startedAt) } : {},
|
|
21897
|
+
...prior && !["skipped", "not-runnable", "not-deployed"].includes(prior.state) ? { startedAt: new Date(prior.startedAt) } : {},
|
|
21712
21898
|
now,
|
|
21713
21899
|
sleep: sleepOf2(io),
|
|
21714
21900
|
record: write,
|
|
@@ -21724,6 +21910,8 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
|
21724
21910
|
live: async (remainingMs) => {
|
|
21725
21911
|
if (target.githubEnvironment)
|
|
21726
21912
|
return fetchLiveDeploy({ ...gh, environment: target.githubEnvironment });
|
|
21913
|
+
if (target.check)
|
|
21914
|
+
return checkReading(await command(target.check, sha, remainingMs), sha);
|
|
21727
21915
|
const result = await command(target.liveShaCommand, sha, remainingMs);
|
|
21728
21916
|
const liveSha = result.stdout.trim();
|
|
21729
21917
|
return {
|
|
@@ -21738,9 +21926,9 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
|
21738
21926
|
io.stderr(`armada: warning: ${target.name}: deploy check not runnable on this machine (configuration)
|
|
21739
21927
|
${configurationDetail}
|
|
21740
21928
|
`);
|
|
21741
|
-
io.stdout(`${target.name}: ${result === "not-runnable" ? "not runnable (configuration)" : result}
|
|
21929
|
+
io.stdout(`${target.name}: ${result === "not-deployed" ? `not deployed (host skipped: ${observationDetail})` : result === "not-runnable" ? "not runnable (configuration)" : result}
|
|
21742
21930
|
`);
|
|
21743
|
-
return result === "healthy" || result === "not-runnable" ? 0 : 1;
|
|
21931
|
+
return result === "healthy" || result === "not-runnable" || result === "not-deployed" ? 0 : 1;
|
|
21744
21932
|
} catch (err) {
|
|
21745
21933
|
io.backgroundReady?.(false);
|
|
21746
21934
|
io.stderr(`armada: deploy watcher failed: ${clean(err instanceof Error ? err.message : "unexpected failure")}
|
|
@@ -22804,6 +22992,29 @@ async function archiveWorker(io, config, credentials, outcome, opts) {
|
|
|
22804
22992
|
}
|
|
22805
22993
|
}
|
|
22806
22994
|
|
|
22995
|
+
// src/notices.ts
|
|
22996
|
+
function coordinatorHintsAllowed(io, credentials) {
|
|
22997
|
+
return !io.env.ARMADA_TICKET?.trim() && credentials.armadaSignIn?.kind !== "worker" && !(!credentials.armadaSignIn && credentials.workerTickets.length > 0);
|
|
22998
|
+
}
|
|
22999
|
+
async function dailyHint(io, credentials, key) {
|
|
23000
|
+
if (!coordinatorHintsAllowed(io, credentials))
|
|
23001
|
+
return false;
|
|
23002
|
+
const paths = machinePaths(io.env);
|
|
23003
|
+
return paths ? reserveNotice(paths, key, (io.now ?? (() => new Date))(), 24 * 60 * 60000, {
|
|
23004
|
+
pid: io.pid,
|
|
23005
|
+
alive: io.processAlive
|
|
23006
|
+
}) : false;
|
|
23007
|
+
}
|
|
23008
|
+
async function statusHints(io, config, credentials, coordinators) {
|
|
23009
|
+
if (!coordinatorHintsAllowed(io, credentials))
|
|
23010
|
+
return {};
|
|
23011
|
+
const records = await coordinators?.().catch(() => []);
|
|
23012
|
+
return {
|
|
23013
|
+
stranded: strandedOwners(records ?? [], await coordinatorName(io, config.project.slug), config.policy.silentAfterMinutes, (io.now ?? (() => new Date))()),
|
|
23014
|
+
digest: await dailyHint(io, credentials, `hint:digest:${config.project.slug}`)
|
|
23015
|
+
};
|
|
23016
|
+
}
|
|
23017
|
+
|
|
22807
23018
|
// src/render.ts
|
|
22808
23019
|
var MIN3 = 60000;
|
|
22809
23020
|
function relative2(iso, now) {
|
|
@@ -22841,7 +23052,7 @@ function queueLines(entries) {
|
|
|
22841
23052
|
let position = 0;
|
|
22842
23053
|
return entries.map((e) => `${queueOpen(e) ? `${++position}.` : " "} #${e.pr} ${e.state}${e.ticket ? ` ${e.ticket}` : ""} · queued by ${e.queuedBy}${e.detail ? ` — ${e.detail}` : ""}`);
|
|
22843
23054
|
}
|
|
22844
|
-
function renderStatus(r) {
|
|
23055
|
+
function renderStatus(r, hints = {}) {
|
|
22845
23056
|
const now = Date.parse(r.generatedAt);
|
|
22846
23057
|
const out = [];
|
|
22847
23058
|
const idWidth = Math.max(6, ...r.inFlight.map((t) => t.id.length), ...r.notStarted.map((l) => l.ticket.length), ...r.frontier.map((t) => t.id.length), ...(r.pullRequests ?? []).map((p) => `#${p.number}`.length));
|
|
@@ -22937,6 +23148,10 @@ function renderStatus(r) {
|
|
|
22937
23148
|
if (p.failingChecks.length)
|
|
22938
23149
|
out.push(`${indent}! failing: ${p.failingChecks.join(", ")}`);
|
|
22939
23150
|
}
|
|
23151
|
+
for (const role of hints.stranded ?? [])
|
|
23152
|
+
out.push("", `${role.tickets.join(", ")} belong to coordinator ${role.name}, last seen ${relative2(role.seenAt, now)}: armada coordinator take ${role.tickets.join(" ")} --from ${role.name}`);
|
|
23153
|
+
if (hints.digest)
|
|
23154
|
+
out.push("", "The owner's status: armada digest (paste it) · armada digest --send posts it to their channel");
|
|
22940
23155
|
if (r.warnings.length) {
|
|
22941
23156
|
out.push("", `Warnings (${r.warnings.length})`);
|
|
22942
23157
|
for (const w of r.warnings)
|
|
@@ -22968,7 +23183,7 @@ function fencedIo(io, tick, exec) {
|
|
|
22968
23183
|
...io.writeFile ? { writeFile: before(io.writeFile) } : {}
|
|
22969
23184
|
};
|
|
22970
23185
|
}
|
|
22971
|
-
var TRANSIENT = /\bHTTP 5\d\d\b|\b5\d\d (?:Bad Gateway|Service Unavailable|Gateway Time-?out|Internal Server Error)\b|Bad Gateway|Service Unavailable|Gateway Time-?out|ECONNRESET|ETIMEDOUT|connection reset|i\/o timeout|TLS handshake timeout/i;
|
|
23186
|
+
var TRANSIENT = /\bHTTP 5\d\d\b|\b5\d\d (?:Bad Gateway|Service Unavailable|Gateway Time-?out|Internal Server Error)\b|Bad Gateway|Service Unavailable|Gateway Time-?out|ECONNRESET|ETIMEDOUT|connection reset|i\/o timeout|TLS handshake timeout|unexpected end of JSON input|invalid character '<' looking for beginning of value/i;
|
|
22972
23187
|
var tail = (text, lines = 30) => text.trimEnd().split(`
|
|
22973
23188
|
`).slice(-lines).join(`
|
|
22974
23189
|
`);
|
|
@@ -23553,9 +23768,17 @@ ${watch.line}
|
|
|
23553
23768
|
if (o.merged)
|
|
23554
23769
|
await remember(io, project, { inFlight, readAt: (io.now ?? (() => new Date))().toISOString() });
|
|
23555
23770
|
next = await rearmFor(io, project, { inFlight, open: null });
|
|
23771
|
+
let hint = "";
|
|
23772
|
+
if (!a.json && o.merged && !config.deploy?.targets.length && await dailyHint(io, credentials, `hint:deploy:${project}`)) {
|
|
23773
|
+
hint = "No deploy check after merges: add [[deploy.target]] with a smoke command (armada doctor lists it)";
|
|
23774
|
+
if (!Object.keys(config.jobs).length && o.ticket && (await live.fleet?.listJobs({ ticket: o.ticket.id }).catch(() => []) ?? []).length)
|
|
23775
|
+
hint += "; long runs: configure [jobs.<name>] and use armada job";
|
|
23776
|
+
hint += `
|
|
23777
|
+
`;
|
|
23778
|
+
}
|
|
23556
23779
|
if (!a.json)
|
|
23557
23780
|
io.stdout(`${render(o, !!a.options["no-notify"])}${deferredLaunches.map((l) => l.output ?? `${l.ticket}: ${l.status}; ${l.command}
|
|
23558
|
-
`).join("")}${next.line}
|
|
23781
|
+
`).join("")}${hint}${next.line}
|
|
23559
23782
|
`);
|
|
23560
23783
|
for (const w of o.warnings)
|
|
23561
23784
|
io.stderr(`armada: warning: ${w}
|
|
@@ -23687,7 +23910,7 @@ function mergeResult(o) {
|
|
|
23687
23910
|
if (!o.merged)
|
|
23688
23911
|
return `Result: not merged (${o.lines.some((line) => line.startsWith("Dry run:")) ? "dry run" : "owner approval requested"}; nothing was merged)`;
|
|
23689
23912
|
const pending = [o.armadaPending ? "Armada" : "", o.linearPending ? "Linear" : ""].filter(Boolean).join(" and ");
|
|
23690
|
-
return `Result: merged #${o.pr.number}${pending ? `, ${pending} pending (armada merge --finish ${o.pr.number})` : ""}`;
|
|
23913
|
+
return `Result: merged #${o.pr.number}${o.lines.find((line) => line.startsWith("cleared:")) ? `, ${o.lines.find((line) => line.startsWith("cleared:"))}` : ""}${pending ? `, ${pending} pending (armada merge --finish ${o.pr.number})` : ""}`;
|
|
23691
23914
|
}
|
|
23692
23915
|
|
|
23693
23916
|
// src/init.ts
|
|
@@ -25629,7 +25852,9 @@ var COMMAND_HELP = {
|
|
|
25629
25852
|
`,
|
|
25630
25853
|
inbox: ` inbox [--mine|--all] [--wait [--timeout <seconds>]]
|
|
25631
25854
|
Coordinator: open questions, plans, requests, hand-backs and silent workers,
|
|
25632
|
-
oldest first;
|
|
25855
|
+
oldest first; queued hand-backs show as in progress, needing no action.
|
|
25856
|
+
Merged PR notices and resumed workers' hand-backs clear automatically.
|
|
25857
|
+
Records that the coordinator is at work. --wait returns
|
|
25633
25858
|
when a new item arrives or after --timeout (default 300 s); \`armada watch\`
|
|
25634
25859
|
is the way to keep listening. Needs a sign-in to Armada
|
|
25635
25860
|
`,
|
|
@@ -25637,14 +25862,16 @@ var COMMAND_HELP = {
|
|
|
25637
25862
|
until something needs you (a question, plan, request, hand-back or silent
|
|
25638
25863
|
worker you have not seen), prints it and exits; exits "nothing to watch"
|
|
25639
25864
|
when no worker is in flight and nothing is open. An Armada
|
|
25640
|
-
outage does not end it: it keeps asking.
|
|
25641
|
-
|
|
25865
|
+
outage does not end it: it keeps asking. Only a CLI below the server minimum
|
|
25866
|
+
stops it for an upgrade; setup behind is a daily notice. One per named
|
|
25867
|
+
coordinator on this machine. Needs a sign-in to Armada
|
|
25642
25868
|
watch --follow Stream lines without exiting on new items; --json prints NDJSON.
|
|
25643
25869
|
--since <cursor> resumes events; defaults to this machine's cursor.
|
|
25644
25870
|
--tickets A-1,B-2 and --kinds question,hand-back filter the stream.
|
|
25645
25871
|
--kinds all also prints claims, reports, releases and merges.
|
|
25646
25872
|
--mine filters events and inbox by coordinator ownership, including unowned entries.
|
|
25647
25873
|
Named watches default to --mine; --all sees the whole fleet.
|
|
25874
|
+
Plain watch wakes only for your own and unowned items, even with --all.
|
|
25648
25875
|
--for <minutes> ends either watch cleanly with a resume command.
|
|
25649
25876
|
watch --stop [--name <name>] Stop only this project's verified watch and release its lock. Local,
|
|
25650
25877
|
no sign-in needed. Never stop a watch just to read inbox or status
|
|
@@ -25900,8 +26127,8 @@ Files:
|
|
|
25900
26127
|
projects/<slug>.json non-secret deploy settings for this project and machine
|
|
25901
26128
|
coordinators.json coordinator role per project and checkout
|
|
25902
26129
|
watch/<project>[@<name>].* the coordinator's watch: its lock, what you were shown, who is in flight
|
|
25903
|
-
|
|
25904
|
-
Only
|
|
26130
|
+
notices.json reserved release and command hints, with keys and times.
|
|
26131
|
+
Only a CLI below the server minimum interrupts armada watch
|
|
25905
26132
|
`;
|
|
25906
26133
|
function commandHelp(command) {
|
|
25907
26134
|
const block = Object.hasOwn(COMMAND_HELP, command) ? COMMAND_HELP[command] : undefined;
|
|
@@ -26221,9 +26448,6 @@ async function status2(io, args) {
|
|
|
26221
26448
|
...httpOptions(io),
|
|
26222
26449
|
...io.now ? { now: io.now } : {}
|
|
26223
26450
|
});
|
|
26224
|
-
const behind = await skillsBehind(fsRepoView(dirname14(path))).catch(() => null);
|
|
26225
|
-
if (behind)
|
|
26226
|
-
report.warnings.push(skillsBehindLine(behind, version));
|
|
26227
26451
|
let deploys = null;
|
|
26228
26452
|
if (config.deploy?.targets.length) {
|
|
26229
26453
|
try {
|
|
@@ -26233,7 +26457,7 @@ async function status2(io, args) {
|
|
|
26233
26457
|
}
|
|
26234
26458
|
}
|
|
26235
26459
|
io.stdout(args.json ? `${JSON.stringify({ ...report, ...deploys ? { deploys } : {} }, null, 2)}
|
|
26236
|
-
` : renderStatus(report));
|
|
26460
|
+
` : renderStatus(report, await statusHints(io, config, credentials, live?.coordinators)));
|
|
26237
26461
|
if (!args.json && deploys)
|
|
26238
26462
|
for (const row of deploys.rows)
|
|
26239
26463
|
io.stdout(`Deploy ${deployLine(row, (io.now ?? (() => new Date))())}
|
|
@@ -26278,7 +26502,7 @@ async function run(argv, io) {
|
|
|
26278
26502
|
if (command && NOTICE_COMMANDS.has(command))
|
|
26279
26503
|
await (async () => {
|
|
26280
26504
|
const args = parseArgs(argv);
|
|
26281
|
-
if (args.all)
|
|
26505
|
+
if (args.all && command === "status")
|
|
26282
26506
|
return await noticeRelease(io, version);
|
|
26283
26507
|
const { path } = await findConfig(io, args.config, command, args.project);
|
|
26284
26508
|
await noticeRelease(io, version, fsRepoView(dirname14(path)));
|