@the-vibe-company/armada 0.2.60 → 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 +554 -194
- package/package.json +1 -1
package/dist/armada.js
CHANGED
|
@@ -1488,12 +1488,29 @@ import { hostname as hostname2 } from "node:os";
|
|
|
1488
1488
|
import { isatty } from "node:tty";
|
|
1489
1489
|
|
|
1490
1490
|
// src/cli.ts
|
|
1491
|
-
import { basename as basename4, dirname as
|
|
1491
|
+
import { basename as basename4, dirname as dirname14, join as join11, resolve as resolve8 } from "node:path";
|
|
1492
1492
|
|
|
1493
1493
|
// ../core/src/merge.ts
|
|
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: o.target.pauseOnFailure,
|
|
2113
|
+
pauseOnFailure: state !== "not-runnable" && state !== "not-deployed" && o.target.pauseOnFailure,
|
|
2078
2114
|
liveSha
|
|
2079
2115
|
});
|
|
2080
2116
|
await record("waiting");
|
|
@@ -2102,6 +2138,14 @@ async function watchDeploy(o) {
|
|
|
2102
2138
|
if (live) {
|
|
2103
2139
|
detail = live.detail;
|
|
2104
2140
|
liveSha = live.sha;
|
|
2141
|
+
if (live.notRunnable) {
|
|
2142
|
+
await record("not-runnable");
|
|
2143
|
+
return "not-runnable";
|
|
2144
|
+
}
|
|
2145
|
+
if (live.state === "skipped") {
|
|
2146
|
+
await record("not-deployed");
|
|
2147
|
+
return "not-deployed";
|
|
2148
|
+
}
|
|
2105
2149
|
let includes = live.sha === o.sha;
|
|
2106
2150
|
if (live.sha && !includes) {
|
|
2107
2151
|
try {
|
|
@@ -2111,6 +2155,8 @@ async function watchDeploy(o) {
|
|
|
2111
2155
|
could not compare the live commit; retrying`;
|
|
2112
2156
|
}
|
|
2113
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}`;
|
|
2114
2160
|
if (includes && (live.state === "failure" || live.state === "error")) {
|
|
2115
2161
|
await record("deploy-failed");
|
|
2116
2162
|
return "deploy-failed";
|
|
@@ -2124,6 +2170,10 @@ could not compare the live commit; retrying`;
|
|
|
2124
2170
|
result = { ok: null, detail: "could not read or record shared smoke state; retrying" };
|
|
2125
2171
|
}
|
|
2126
2172
|
detail = result.detail;
|
|
2173
|
+
if (result.notRunnable) {
|
|
2174
|
+
await record("not-runnable");
|
|
2175
|
+
return "not-runnable";
|
|
2176
|
+
}
|
|
2127
2177
|
if (result.ok !== null) {
|
|
2128
2178
|
const state = result.ok ? "healthy" : "smoke-failed";
|
|
2129
2179
|
await record(state);
|
|
@@ -2141,7 +2191,7 @@ ${detail}`;
|
|
|
2141
2191
|
}
|
|
2142
2192
|
function deployLine(row, now) {
|
|
2143
2193
|
const age = Math.max(0, Math.floor((now.getTime() - Date.parse(row.updatedAt)) / 60000));
|
|
2144
|
-
return `${row.target}: ${row.state === "skipped" ? "skipped (not configured on this machine)" : 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" : ""}` : ""}`;
|
|
2145
2195
|
}
|
|
2146
2196
|
|
|
2147
2197
|
// ../../node_modules/.bun/smol-toml@1.9.0/node_modules/smol-toml/dist/error.js
|
|
@@ -3146,10 +3196,53 @@ var RUNNER = /No space left on device|The runner has received a shutdown signal|
|
|
|
3146
3196
|
function ciLine(line) {
|
|
3147
3197
|
return line.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z\s?/, "").replace(/\r$/, "").slice(0, 1000);
|
|
3148
3198
|
}
|
|
3199
|
+
function summaryDependencies(check, log) {
|
|
3200
|
+
if (!log || log.warnings.length || check.conclusion !== "FAILURE" || !check.steps?.length)
|
|
3201
|
+
return [];
|
|
3202
|
+
const exitError = "##[error]Process completed with exit code 1.";
|
|
3203
|
+
const gateNotice = (text) => !text?.trim() || [exitError, "Process completed with exit code 1."].includes(text.trim());
|
|
3204
|
+
if (!gateNotice(check.summary) || check.annotations.some((a) => !gateNotice(a.title) || !gateNotice(a.message)))
|
|
3205
|
+
return [];
|
|
3206
|
+
if (log.lines.some((line) => line.length > 1000))
|
|
3207
|
+
return [];
|
|
3208
|
+
if (check.steps.filter((s) => s.conclusion === "failure").length !== 1)
|
|
3209
|
+
return [];
|
|
3210
|
+
const setup = check.steps[0];
|
|
3211
|
+
const complete = check.steps.at(-1);
|
|
3212
|
+
if (setup?.name !== "Set up job" || setup.number !== 1 || setup.conclusion !== "success" || complete?.name !== "Complete job" || complete.conclusion !== "success" || complete.number !== Math.max(...check.steps.map((s) => s.number)))
|
|
3213
|
+
return [];
|
|
3214
|
+
const userSteps = check.steps.slice(1, -1);
|
|
3215
|
+
if (userSteps.filter((s) => s.conclusion === "failure").length !== 1 || userSteps.some((s) => s.conclusion !== "failure" && s.conclusion !== "skipped"))
|
|
3216
|
+
return [];
|
|
3217
|
+
const lines = log.lines.map(ciLine).map((l) => l.trim()).filter(Boolean);
|
|
3218
|
+
if (lines.filter((l) => l.includes("##[error]")).join(`
|
|
3219
|
+
`) !== exitError)
|
|
3220
|
+
return [];
|
|
3221
|
+
if (lines.filter((l) => l.startsWith("##[group]Run ")).length !== 1)
|
|
3222
|
+
return [];
|
|
3223
|
+
const start = lines.findIndex((l) => l.startsWith('##[group]Run echo "Dependency failed: '));
|
|
3224
|
+
const end = lines.indexOf("##[endgroup]", start);
|
|
3225
|
+
const failed = lines.indexOf(exitError, end);
|
|
3226
|
+
if (start < 0 || end < 0 || failed < 0)
|
|
3227
|
+
return [];
|
|
3228
|
+
const script = lines.slice(start + 1, end).filter((l) => !l.startsWith("shell: "));
|
|
3229
|
+
if (script.pop() !== "exit 1" || !script.length)
|
|
3230
|
+
return [];
|
|
3231
|
+
const commands = script.map((l) => l.match(/^echo "Dependency failed: ([^"$`\\]+)"$/)?.[1]);
|
|
3232
|
+
if (commands.some((name) => !name))
|
|
3233
|
+
return [];
|
|
3234
|
+
if (lines[start] !== `##[group]Run ${script[0]}`)
|
|
3235
|
+
return [];
|
|
3236
|
+
const output = lines.slice(end + 1, failed);
|
|
3237
|
+
if (output.length !== commands.length || output.some((l, i) => l !== `Dependency failed: ${commands[i]}`))
|
|
3238
|
+
return [];
|
|
3239
|
+
return [...new Set(commands)];
|
|
3240
|
+
}
|
|
3149
3241
|
function explainChecks(checks, logs, config) {
|
|
3150
3242
|
const patterns = [...(config?.failurePatterns ?? []).map(failurePattern), ...TEST_PATTERNS];
|
|
3151
|
-
|
|
3243
|
+
const explanations = checks.map((check) => {
|
|
3152
3244
|
const log = check.id === null ? [] : (logs.get(check.id)?.lines ?? []).map(ciLine);
|
|
3245
|
+
const dependencyCandidate = log.some((line) => line.trim().startsWith('##[group]Run echo "Dependency failed: '));
|
|
3153
3246
|
const annotations = check.annotations.flatMap((a) => [a.title ?? "", ...a.message.split(`
|
|
3154
3247
|
`)]).map(ciLine);
|
|
3155
3248
|
const summary = (check.summary ?? "").split(`
|
|
@@ -3178,9 +3271,9 @@ function explainChecks(checks, logs, config) {
|
|
|
3178
3271
|
`))) : [];
|
|
3179
3272
|
const unknownNames = names.filter((name) => !matches(name).length && !blockMatches.length);
|
|
3180
3273
|
const matched = [...new Set([...names.flatMap(matches), ...blockMatches])];
|
|
3181
|
-
const known = !unknownNames.length ? matched[0] : undefined;
|
|
3274
|
+
const known = !dependencyCandidate && !unknownNames.length ? matched[0] : undefined;
|
|
3182
3275
|
const knownMatches = matched.map(({ ticket, pattern }) => ({ ticket, pattern }));
|
|
3183
|
-
const runnerOnly = runner && !unknownNames.length;
|
|
3276
|
+
const runnerOnly = !dependencyCandidate && runner && !unknownNames.length;
|
|
3184
3277
|
return {
|
|
3185
3278
|
check: check.name,
|
|
3186
3279
|
conclusion: check.conclusion,
|
|
@@ -3196,6 +3289,28 @@ function explainChecks(checks, logs, config) {
|
|
|
3196
3289
|
...check.superseded ? { superseded: true } : {}
|
|
3197
3290
|
};
|
|
3198
3291
|
});
|
|
3292
|
+
let changed = true;
|
|
3293
|
+
while (changed) {
|
|
3294
|
+
changed = false;
|
|
3295
|
+
for (const [i, check] of checks.entries()) {
|
|
3296
|
+
const explanation = explanations[i];
|
|
3297
|
+
if (explanation?.class !== "failure" || explanation.tests.length || check.runId === null || check.superseded)
|
|
3298
|
+
continue;
|
|
3299
|
+
const dependencies = summaryDependencies(check, check.id === null ? undefined : logs.get(check.id));
|
|
3300
|
+
if (!dependencies.length)
|
|
3301
|
+
continue;
|
|
3302
|
+
const covered = dependencies.every((name) => {
|
|
3303
|
+
const peers = checks.flatMap((c, j) => j !== i && c.name === name && c.runId === check.runId && c.headSha === check.headSha && !c.superseded ? [explanations[j]] : []);
|
|
3304
|
+
return peers.length > 0 && peers.every((e) => e && ["known", "runner", "dependent"].includes(e.class));
|
|
3305
|
+
});
|
|
3306
|
+
if (covered) {
|
|
3307
|
+
explanation.class = "dependent";
|
|
3308
|
+
explanation.dependencies = dependencies;
|
|
3309
|
+
changed = true;
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
return explanations;
|
|
3199
3314
|
}
|
|
3200
3315
|
function rerunDecision(explanations, attempt) {
|
|
3201
3316
|
const refuse = (reason) => ({ allowed: false, reason, tickets: [] });
|
|
@@ -3206,9 +3321,11 @@ function rerunDecision(explanations, attempt) {
|
|
|
3206
3321
|
const failures = explanations.filter((e) => !e.superseded);
|
|
3207
3322
|
if (!failures.length)
|
|
3208
3323
|
return refuse("No failing checks to rerun");
|
|
3209
|
-
const unknown = failures.filter((e) =>
|
|
3324
|
+
const unknown = failures.filter((e) => !["known", "runner", "dependent"].includes(e.class));
|
|
3210
3325
|
if (unknown.length)
|
|
3211
3326
|
return refuse(`unknown or external failures: ${unknown.map((e) => e.check).join("; ")}`);
|
|
3327
|
+
if (!failures.some((e) => e.class === "known" || e.class === "runner"))
|
|
3328
|
+
return refuse("No real failing checks to rerun");
|
|
3212
3329
|
if (failures.some((e) => e.class === "known" && !e.known))
|
|
3213
3330
|
return refuse("known failure has no root-cause ticket");
|
|
3214
3331
|
return {
|
|
@@ -3930,6 +4047,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
3930
4047
|
"requires_env",
|
|
3931
4048
|
"github_environment",
|
|
3932
4049
|
"live_sha_command",
|
|
4050
|
+
"check",
|
|
3933
4051
|
"smoke",
|
|
3934
4052
|
"timeout_minutes",
|
|
3935
4053
|
"pause_on_failure"
|
|
@@ -3943,8 +4061,9 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
3943
4061
|
const optional = (key) => row[key] === undefined ? null : str(row, path, key);
|
|
3944
4062
|
const githubEnvironment = optional("github_environment");
|
|
3945
4063
|
const liveShaCommand = optional("live_sha_command");
|
|
3946
|
-
|
|
3947
|
-
|
|
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`);
|
|
3948
4067
|
const timeoutMinutes = row.timeout_minutes ?? 20;
|
|
3949
4068
|
if (typeof timeoutMinutes !== "number" || !Number.isFinite(timeoutMinutes) || timeoutMinutes < 1 || timeoutMinutes > 120)
|
|
3950
4069
|
problems.push(`"${path}.timeout_minutes" must be from 1 to 120`);
|
|
@@ -3964,6 +4083,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
3964
4083
|
branch: optional("branch"),
|
|
3965
4084
|
githubEnvironment,
|
|
3966
4085
|
liveShaCommand,
|
|
4086
|
+
check,
|
|
3967
4087
|
smoke: optional("smoke"),
|
|
3968
4088
|
timeoutMinutes: typeof timeoutMinutes === "number" ? timeoutMinutes : 20,
|
|
3969
4089
|
pauseOnFailure: row.pause_on_failure !== false
|
|
@@ -4319,12 +4439,16 @@ repository = ${q(p.repository)}
|
|
|
4319
4439
|
# branch = "main" # omit to watch any merged base branch
|
|
4320
4440
|
# paths = ["cmd/**", "internal/**"] # optional: only watch merges touching these globs
|
|
4321
4441
|
# github_environment = "production"
|
|
4322
|
-
##
|
|
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):
|
|
4323
4447
|
## live_sha_command = 'cd "$DEPLOY_LINK_DIR" && hosting-cli live-sha'
|
|
4324
4448
|
## requires_env = ["DEPLOY_LINK_DIR"]
|
|
4325
4449
|
## On each coordinator machine: armada config set deploy.env.DEPLOY_LINK_DIR /path/to/linked-service
|
|
4326
4450
|
## Machine settings win over the process environment; missing settings skip without a hold.
|
|
4327
|
-
# smoke = "curl -fsS https://example.test/health"
|
|
4451
|
+
# smoke = "curl -fsS https://example.test/health" # without smoke, a live but broken service reads healthy
|
|
4328
4452
|
# timeout_minutes = 20 # 1–120; smoke shares this deadline
|
|
4329
4453
|
# pause_on_failure = true
|
|
4330
4454
|
|
|
@@ -6995,7 +7119,7 @@ async function githubQuery(opts, query, variables) {
|
|
|
6995
7119
|
}, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
6996
7120
|
if (!res.ok)
|
|
6997
7121
|
throw new GithubError(`GitHub API HTTP ${res.status}`, retryStatus(res.status));
|
|
6998
|
-
const json = await res
|
|
7122
|
+
const json = await readJson(res);
|
|
6999
7123
|
if (json.errors?.length)
|
|
7000
7124
|
throw new GithubError(`GitHub API: ${json.errors.map((e) => e.message).join("; ")}`);
|
|
7001
7125
|
return json;
|
|
@@ -7101,7 +7225,7 @@ async function fetchDefaultBranchFile(opts) {
|
|
|
7101
7225
|
}, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7102
7226
|
if (!res.ok)
|
|
7103
7227
|
throw new GithubError(`GitHub API HTTP ${res.status}`, retryStatus(res.status));
|
|
7104
|
-
const json = await res
|
|
7228
|
+
const json = await readJson(res);
|
|
7105
7229
|
if (json.errors?.length)
|
|
7106
7230
|
throw new GithubError(`GitHub API: ${json.errors.map((e) => e.message).join("; ")}`);
|
|
7107
7231
|
if (!json.data?.repository)
|
|
@@ -7229,7 +7353,7 @@ async function fetchRepository(opts) {
|
|
|
7229
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) => {
|
|
7230
7354
|
if (!response.ok)
|
|
7231
7355
|
throw new GithubError(`GitHub API HTTP ${response.status}`);
|
|
7232
|
-
const body = await response
|
|
7356
|
+
const body = await readJson(response);
|
|
7233
7357
|
if (typeof body.full_name !== "string" || !/^[a-z0-9-]+\/[a-z0-9_.-]+$/i.test(body.full_name))
|
|
7234
7358
|
throw new GithubError("GitHub API returned no valid repository full_name");
|
|
7235
7359
|
return { fullName: body.full_name };
|
|
@@ -7346,7 +7470,7 @@ async function fetchBranchRules(opts) {
|
|
|
7346
7470
|
return null;
|
|
7347
7471
|
if (!res.ok)
|
|
7348
7472
|
throw new GithubError(`GitHub API HTTP ${res.status} reading branch rules`);
|
|
7349
|
-
return await res
|
|
7473
|
+
return await readJson(res);
|
|
7350
7474
|
});
|
|
7351
7475
|
const repo = await get("");
|
|
7352
7476
|
if (!repo?.default_branch || typeof repo.allow_squash_merge !== "boolean" || typeof repo.delete_branch_on_merge !== "boolean")
|
|
@@ -7475,6 +7599,22 @@ async function fetchJobLog(opts) {
|
|
|
7475
7599
|
return { lines: [], warnings };
|
|
7476
7600
|
}
|
|
7477
7601
|
}
|
|
7602
|
+
async function fetchJobSteps(opts) {
|
|
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) => {
|
|
7604
|
+
if (!res.ok)
|
|
7605
|
+
throw new GithubError(`GitHub Actions HTTP ${res.status} reading job steps`);
|
|
7606
|
+
const job = await readJson(res);
|
|
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))
|
|
7608
|
+
throw new GithubError("GitHub Actions returned incomplete or mismatched job steps");
|
|
7609
|
+
if (new Set(job.steps.map((s) => s.number)).size !== job.steps.length)
|
|
7610
|
+
throw new GithubError("GitHub Actions returned duplicate step numbers");
|
|
7611
|
+
return job.steps.map((s) => ({
|
|
7612
|
+
name: s.name,
|
|
7613
|
+
conclusion: s.conclusion,
|
|
7614
|
+
number: s.number
|
|
7615
|
+
}));
|
|
7616
|
+
});
|
|
7617
|
+
}
|
|
7478
7618
|
async function fetchRunAttempt(opts) {
|
|
7479
7619
|
return (await fetchWorkflowRun(opts)).attempt;
|
|
7480
7620
|
}
|
|
@@ -7484,7 +7624,7 @@ async function fetchWorkflowRun(opts) {
|
|
|
7484
7624
|
}, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7485
7625
|
if (!res.ok)
|
|
7486
7626
|
throw new GithubError(`GitHub Actions HTTP ${res.status}; token needs Actions repository permission (read)`);
|
|
7487
|
-
const json = await res
|
|
7627
|
+
const json = await readJson(res);
|
|
7488
7628
|
if (!Number.isSafeInteger(json.run_attempt) || (json.run_attempt ?? 0) < 1)
|
|
7489
7629
|
throw new GithubError("GitHub Actions returned no run attempt");
|
|
7490
7630
|
return { attempt: json.run_attempt, status: typeof json.status === "string" ? json.status : null };
|
|
@@ -7494,7 +7634,7 @@ async function fetchShaComparison(opts) {
|
|
|
7494
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) => {
|
|
7495
7635
|
if (!res.ok)
|
|
7496
7636
|
throw new GithubError(`GitHub API HTTP ${res.status} comparing deploy commits`);
|
|
7497
|
-
const comparison = await res
|
|
7637
|
+
const comparison = await readJson(res);
|
|
7498
7638
|
return comparison.status === "ahead" || comparison.status === "identical";
|
|
7499
7639
|
});
|
|
7500
7640
|
}
|
|
@@ -8793,6 +8933,10 @@ async function after(ctx, c, merged, lines, handBackId, keepOpen, more, unlocked
|
|
|
8793
8933
|
await ctx.sleep(wait);
|
|
8794
8934
|
}
|
|
8795
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(", ")}`);
|
|
8796
8940
|
if (live$?.resolved)
|
|
8797
8941
|
lines.push(`Hand-back resolved in the coordinator's inbox.`);
|
|
8798
8942
|
let linearPending = false;
|
|
@@ -9192,6 +9336,10 @@ function checkAttachment(input) {
|
|
|
9192
9336
|
return "attachment link type limit: a valid HTTPS URL is required";
|
|
9193
9337
|
}
|
|
9194
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
|
+
}
|
|
9195
9343
|
// ../core/src/credentials.ts
|
|
9196
9344
|
var DEFAULT_ARMADA_API_URL = "https://armada.thevibecompany.co";
|
|
9197
9345
|
var SESSION_TOKEN_VARIABLE = "ARMADA_SESSION_TOKEN";
|
|
@@ -9905,7 +10053,7 @@ async function checkInbox(fleet, o) {
|
|
|
9905
10053
|
ownedOpenJobs = read.ownedOpenJobs;
|
|
9906
10054
|
etag = read.etag;
|
|
9907
10055
|
warnings.push(...read.warnings);
|
|
9908
|
-
if (items.some((e) => e.new))
|
|
10056
|
+
if (items.some((e) => e.new && !e.queue))
|
|
9909
10057
|
return report(false);
|
|
9910
10058
|
}
|
|
9911
10059
|
}
|
|
@@ -10491,8 +10639,11 @@ async function watchInbox(fleet, o) {
|
|
|
10491
10639
|
if (err instanceof ArmadaApiError && err.upgrade) {
|
|
10492
10640
|
const release = await untilAborted(o.signal, () => o.release?.());
|
|
10493
10641
|
if (release) {
|
|
10494
|
-
items = [...items, { ...release, new:
|
|
10495
|
-
|
|
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;
|
|
10496
10647
|
}
|
|
10497
10648
|
}
|
|
10498
10649
|
if (!transientFailure(err))
|
|
@@ -10511,7 +10662,7 @@ async function watchInbox(fleet, o) {
|
|
|
10511
10662
|
openJobs = read.openJobs ?? [];
|
|
10512
10663
|
ownedOpenJobs = read.ownedOpenJobs;
|
|
10513
10664
|
etag = read.etag;
|
|
10514
|
-
known = new Set(items.map(entryKey));
|
|
10665
|
+
known = new Set([...known].filter((key) => key.startsWith("version:")).concat(items.map(entryKey)));
|
|
10515
10666
|
for (const w of read.warnings)
|
|
10516
10667
|
warnings.add(w);
|
|
10517
10668
|
await untilAborted(o.signal, () => o.onRead?.({
|
|
@@ -10523,9 +10674,10 @@ async function watchInbox(fleet, o) {
|
|
|
10523
10674
|
}));
|
|
10524
10675
|
}
|
|
10525
10676
|
const release = await untilAborted(o.signal, () => o.release?.()) ?? null;
|
|
10677
|
+
items = items.filter((e) => e.kind !== "version");
|
|
10526
10678
|
if (release)
|
|
10527
|
-
items
|
|
10528
|
-
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"))))
|
|
10529
10681
|
return report("items");
|
|
10530
10682
|
if (read && inFlight !== null && !inFlight.length && !openJobs.length && !items.length)
|
|
10531
10683
|
return report("nothing");
|
|
@@ -10634,6 +10786,7 @@ async function* followFleet(fleet, o) {
|
|
|
10634
10786
|
owner: item.author,
|
|
10635
10787
|
at: item.createdAt,
|
|
10636
10788
|
body: item.body,
|
|
10789
|
+
...item.queue ? { queue: item.queue } : {},
|
|
10637
10790
|
new: !first
|
|
10638
10791
|
};
|
|
10639
10792
|
seen.add(key);
|
|
@@ -10744,7 +10897,7 @@ async function* followFleet(fleet, o) {
|
|
|
10744
10897
|
}
|
|
10745
10898
|
}
|
|
10746
10899
|
}
|
|
10747
|
-
function releaseEntry(running, latest, at, options = {
|
|
10900
|
+
function releaseEntry(running, latest, at, options = { minimum: null }) {
|
|
10748
10901
|
return {
|
|
10749
10902
|
id: null,
|
|
10750
10903
|
kind: "version",
|
|
@@ -10752,11 +10905,8 @@ function releaseEntry(running, latest, at, options = { setupBehind: false, minim
|
|
|
10752
10905
|
author: null,
|
|
10753
10906
|
version: latest,
|
|
10754
10907
|
body: [
|
|
10755
|
-
`Armada ${latest} required (you run ${running}). Changes: ${releaseNotesUrl(latest)}`,
|
|
10908
|
+
`Armada ${options.minimum ?? latest} required (you run ${running}). Changes: ${releaseNotesUrl(latest)}`,
|
|
10756
10909
|
...options.minimum ? [`The server requires Armada ${options.minimum} or newer.`] : [],
|
|
10757
|
-
...options.setupBehind ? [
|
|
10758
|
-
"This project's Armada setup is behind: armada upgrade checks it, then runs armada init --merge only if still needed."
|
|
10759
|
-
] : [],
|
|
10760
10910
|
`Run armada upgrade (${installCommand(latest)} if upgrading by hand).`,
|
|
10761
10911
|
"Workers in flight keep the version their brief pinned: tell them nothing unless the notes say otherwise."
|
|
10762
10912
|
].join(`
|
|
@@ -11069,6 +11219,7 @@ async function readWatchState(paths, project, name = "default") {
|
|
|
11069
11219
|
...typeof r.peekTail === "object" && r.peekTail !== null && !Array.isArray(r.peekTail) ? { peekTail: peekTails(r.peekTail) } : {},
|
|
11070
11220
|
root: stringOr(r.root),
|
|
11071
11221
|
seen: strings(r.seen) ?? [],
|
|
11222
|
+
...r.seenScope === "mine" || r.seenScope === "all" ? { seenScope: r.seenScope } : {},
|
|
11072
11223
|
inFlight: strings(r.inFlight),
|
|
11073
11224
|
...Array.isArray(r.openJobs) ? { openJobs: r.openJobs.filter((id) => Number.isSafeInteger(id) && Number(id) > 0) } : {},
|
|
11074
11225
|
readAt: stringOr(r.readAt),
|
|
@@ -11200,24 +11351,49 @@ async function runningWatch(paths, project, alive = processAlive, name = "defaul
|
|
|
11200
11351
|
return pid !== null && alive(pid) ? pid : null;
|
|
11201
11352
|
}
|
|
11202
11353
|
var NOTICED_KEPT = 50;
|
|
11354
|
+
var noticesFile = (paths) => join(paths.dir, "notices.json");
|
|
11203
11355
|
var releasesFile = (paths) => join(paths.dir, "releases.json");
|
|
11204
|
-
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;
|
|
11205
11371
|
try {
|
|
11206
|
-
|
|
11207
|
-
|
|
11372
|
+
text = await readFile(path, "utf8");
|
|
11373
|
+
} catch (err) {
|
|
11374
|
+
if (err.code === "ENOENT")
|
|
11208
11375
|
return [];
|
|
11209
|
-
|
|
11210
|
-
if (typeof entry === "string")
|
|
11211
|
-
return [{ version: entry, at: null }];
|
|
11212
|
-
if (!entry || typeof entry.version !== "string" || typeof entry.at !== "string" || !Number.isFinite(Date.parse(entry.at)))
|
|
11213
|
-
return [];
|
|
11214
|
-
return [{ version: entry.version, at: entry.at }];
|
|
11215
|
-
});
|
|
11216
|
-
} catch {
|
|
11217
|
-
return [];
|
|
11376
|
+
throw err;
|
|
11218
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);
|
|
11219
11392
|
}
|
|
11220
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) {
|
|
11221
11397
|
const pid = options.pid ?? process.pid;
|
|
11222
11398
|
const alive = options.alive ?? processAlive;
|
|
11223
11399
|
await mkdir(paths.dir, { recursive: true, mode: 448 });
|
|
@@ -11266,19 +11442,20 @@ async function addNoticedRelease(paths, version, at = new Date, options = {}) {
|
|
|
11266
11442
|
}
|
|
11267
11443
|
if (!taken)
|
|
11268
11444
|
return false;
|
|
11269
|
-
const previous = await
|
|
11270
|
-
if (previous.some((entry) =>
|
|
11271
|
-
if (entry.at === null)
|
|
11272
|
-
return false;
|
|
11273
|
-
const age = at.getTime() - Date.parse(entry.at);
|
|
11274
|
-
return age >= 0 && age < (options.intervalMs ?? 0);
|
|
11275
|
-
}))
|
|
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)))
|
|
11276
11447
|
return false;
|
|
11277
|
-
const noticed = previous.filter((entry) => entry.
|
|
11278
|
-
noticed.push({
|
|
11279
|
-
const
|
|
11280
|
-
|
|
11281
|
-
|
|
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);
|
|
11282
11459
|
return true;
|
|
11283
11460
|
} finally {
|
|
11284
11461
|
if (taken && await readFile(lock, "utf8").catch(() => null) === holder)
|
|
@@ -11531,15 +11708,15 @@ var skills_generated_default = [
|
|
|
11531
11708
|
files: [
|
|
11532
11709
|
{
|
|
11533
11710
|
path: "MERGE.md",
|
|
11534
|
-
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"
|
|
11535
11712
|
},
|
|
11536
11713
|
{
|
|
11537
11714
|
path: "REFERENCE.md",
|
|
11538
|
-
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"
|
|
11539
11716
|
},
|
|
11540
11717
|
{
|
|
11541
11718
|
path: "SKILL.md",
|
|
11542
|
-
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"
|
|
11543
11720
|
}
|
|
11544
11721
|
]
|
|
11545
11722
|
},
|
|
@@ -11559,7 +11736,7 @@ var skills_generated_default = [
|
|
|
11559
11736
|
files: [
|
|
11560
11737
|
{
|
|
11561
11738
|
path: "SKILL.md",
|
|
11562
|
-
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"
|
|
11563
11740
|
}
|
|
11564
11741
|
]
|
|
11565
11742
|
},
|
|
@@ -11592,7 +11769,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
11592
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.
|
|
11593
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.
|
|
11594
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.
|
|
11595
|
-
- **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.
|
|
11596
11773
|
- **Work only in your own branch and worktree.** Never touch another agent's checkout, and stop only the processes you started.
|
|
11597
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.
|
|
11598
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.
|
|
@@ -15079,7 +15256,6 @@ function skillsBehindFix(b, cli) {
|
|
|
15079
15256
|
const newer = ahead(b, cli);
|
|
15080
15257
|
return newer ? `update the CLI, not the skills: ${installCommand(newer)}` : "run `armada init` and merge its PR (`armada merge <n> --no-ticket`)";
|
|
15081
15258
|
}
|
|
15082
|
-
var skillsBehindLine = (b, cli) => `${skillsBehindMessage(b, cli)}: ${skillsBehindFix(b, cli)}`;
|
|
15083
15259
|
async function skillsBehind(view) {
|
|
15084
15260
|
let lock;
|
|
15085
15261
|
try {
|
|
@@ -15878,7 +16054,7 @@ ${attachments.join(`
|
|
|
15878
16054
|
};
|
|
15879
16055
|
}
|
|
15880
16056
|
// package.json
|
|
15881
|
-
var version = "0.2.
|
|
16057
|
+
var version = "0.2.62";
|
|
15882
16058
|
|
|
15883
16059
|
// src/io.ts
|
|
15884
16060
|
class UsageError extends Error {
|
|
@@ -17428,7 +17604,7 @@ class ClaudeCodeAdapter {
|
|
|
17428
17604
|
}
|
|
17429
17605
|
|
|
17430
17606
|
// src/doctor.ts
|
|
17431
|
-
import { join as join4 } from "node:path";
|
|
17607
|
+
import { dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
|
|
17432
17608
|
|
|
17433
17609
|
// src/local-tools.ts
|
|
17434
17610
|
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
@@ -17897,8 +18073,8 @@ function keyFileChecks(machine, credentials) {
|
|
|
17897
18073
|
}
|
|
17898
18074
|
];
|
|
17899
18075
|
}
|
|
17900
|
-
async function projectConfig(
|
|
17901
|
-
const text = await
|
|
18076
|
+
async function projectConfig(view) {
|
|
18077
|
+
const text = await view.readFile(CONFIG_FILE);
|
|
17902
18078
|
if (text === null)
|
|
17903
18079
|
return null;
|
|
17904
18080
|
try {
|
|
@@ -18267,11 +18443,20 @@ async function localRuntimeChecks(io, config, options = { readOnly: true }) {
|
|
|
18267
18443
|
];
|
|
18268
18444
|
}
|
|
18269
18445
|
async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
18270
|
-
const
|
|
18446
|
+
const selected = options.configPath || io.env.ARMADA_CONFIG?.trim();
|
|
18447
|
+
const configPath = selected ? resolve2(io.cwd, selected) : null;
|
|
18448
|
+
const checkout = configPath ? dirname4(configPath) : io.cwd;
|
|
18449
|
+
const root = (io.exec ? await gitRoot(io.exec, checkout) : null) ?? checkout;
|
|
18450
|
+
const repository = fsRepoView(root);
|
|
18451
|
+
const view = configPath ? {
|
|
18452
|
+
...repository,
|
|
18453
|
+
readFile: (path) => path === CONFIG_FILE ? io.readFile(configPath) : repository.readFile(path)
|
|
18454
|
+
} : repository;
|
|
18455
|
+
const configFlag = configPath ? ` --config ${shellWord(configPath)}` : "";
|
|
18271
18456
|
const upgrade = (err) => err instanceof ArmadaApiError && err.upgrade ? err : null;
|
|
18272
18457
|
let outdated = null;
|
|
18273
18458
|
let loaded;
|
|
18274
|
-
const config = await projectConfig(
|
|
18459
|
+
const config = await projectConfig(view);
|
|
18275
18460
|
try {
|
|
18276
18461
|
loaded = await loadCredentials(io, config ? { project: config.project.slug } : {});
|
|
18277
18462
|
} catch (err) {
|
|
@@ -18292,7 +18477,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18292
18477
|
}
|
|
18293
18478
|
const signing = await readSigning(io, root);
|
|
18294
18479
|
const checks = [
|
|
18295
|
-
...await checkRepository(
|
|
18480
|
+
...await checkRepository(view, armadaVersion),
|
|
18296
18481
|
...config ? optionalFeatures(config) : [],
|
|
18297
18482
|
...signIn,
|
|
18298
18483
|
...versionChecks(hostOf(credentials.armadaApi.url), api, armadaVersion, outdated),
|
|
@@ -18307,16 +18492,32 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18307
18492
|
id: `deploy-env:${target.name}`,
|
|
18308
18493
|
level: missing.length ? "warning" : "ok",
|
|
18309
18494
|
message: missing.length ? `${target.name}: ${missing.join(", ")} not set on this machine; deploy check will be skipped` : `${target.name}: required deploy settings are configured`,
|
|
18310
|
-
fix: missing.length ? missing.map((name) => `armada config set deploy.env.${name} <value
|
|
18495
|
+
fix: missing.length ? missing.map((name) => `armada config set deploy.env.${name} <value>${configFlag}`).join(`
|
|
18311
18496
|
`) : null
|
|
18312
18497
|
};
|
|
18313
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
|
+
}
|
|
18314
18515
|
if (local.warning)
|
|
18315
18516
|
checks.unshift({
|
|
18316
18517
|
id: "deploy-machine-settings",
|
|
18317
18518
|
level: "warning",
|
|
18318
18519
|
message: local.warning,
|
|
18319
|
-
fix: checks.find((c) => c.fix)?.fix ??
|
|
18520
|
+
fix: checks.find((c) => c.id.startsWith("deploy-env:") && c.fix)?.fix ?? `armada config set deploy.env.<VAR> <value>${configFlag}`
|
|
18320
18521
|
});
|
|
18321
18522
|
return checks;
|
|
18322
18523
|
})(),
|
|
@@ -18349,7 +18550,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18349
18550
|
fix: null
|
|
18350
18551
|
}
|
|
18351
18552
|
] : [],
|
|
18352
|
-
...await localRuntimeChecks(io, config, { ...options, configPath: join4(root, CONFIG_FILE) }),
|
|
18553
|
+
...await localRuntimeChecks(io, config, { ...options, configPath: configPath ?? join4(root, CONFIG_FILE) }),
|
|
18353
18554
|
...config ? await reviewRuntimeChecks(io, root) : [],
|
|
18354
18555
|
...await secretChecks(api, config, credentials)
|
|
18355
18556
|
];
|
|
@@ -18388,8 +18589,8 @@ function renderDoctor(r) {
|
|
|
18388
18589
|
`)}
|
|
18389
18590
|
`;
|
|
18390
18591
|
}
|
|
18391
|
-
async function doctor(io, json, armadaVersion, deep = false) {
|
|
18392
|
-
const report = await buildDoctor(io, armadaVersion, { readOnly: json, deep });
|
|
18592
|
+
async function doctor(io, json, armadaVersion, deep = false, configPath) {
|
|
18593
|
+
const report = await buildDoctor(io, armadaVersion, { readOnly: json, deep, configPath });
|
|
18393
18594
|
io.stdout(json ? `${JSON.stringify(report, null, 2)}
|
|
18394
18595
|
` : renderDoctor(report));
|
|
18395
18596
|
return report.errors ? 1 : 0;
|
|
@@ -18478,6 +18679,14 @@ var safeLink = (v) => {
|
|
|
18478
18679
|
}
|
|
18479
18680
|
};
|
|
18480
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
|
+
}
|
|
18481
18690
|
function conductorLaunchArguments(spec) {
|
|
18482
18691
|
const p = spec.profile;
|
|
18483
18692
|
const base = spec.from.kind === "branch" ? spec.branch : spec.base;
|
|
@@ -18508,6 +18717,7 @@ function conductorLaunchArguments(spec) {
|
|
|
18508
18717
|
class ConductorAdapter {
|
|
18509
18718
|
io;
|
|
18510
18719
|
secretValues;
|
|
18720
|
+
retries;
|
|
18511
18721
|
name = "conductor";
|
|
18512
18722
|
guide = "armada-runtime-conductor";
|
|
18513
18723
|
can = {
|
|
@@ -18520,9 +18730,10 @@ class ConductorAdapter {
|
|
|
18520
18730
|
archive: true
|
|
18521
18731
|
};
|
|
18522
18732
|
binary = "conductor";
|
|
18523
|
-
constructor(io, secretValues = []) {
|
|
18733
|
+
constructor(io, secretValues = [], retries = {}) {
|
|
18524
18734
|
this.io = io;
|
|
18525
18735
|
this.secretValues = secretValues;
|
|
18736
|
+
this.retries = retries;
|
|
18526
18737
|
}
|
|
18527
18738
|
parse(handle) {
|
|
18528
18739
|
const parts = handle.split("/");
|
|
@@ -18553,6 +18764,34 @@ class ConductorAdapter {
|
|
|
18553
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");
|
|
18554
18765
|
}
|
|
18555
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) {
|
|
18556
18795
|
if (!this.io.exec)
|
|
18557
18796
|
throw new RuntimeError("Conductor CLI execution is unavailable on this machine", "unavailable", "armada doctor");
|
|
18558
18797
|
const operation = args.slice(0, 2).join(" ");
|
|
@@ -18568,40 +18807,46 @@ class ConductorAdapter {
|
|
|
18568
18807
|
} catch (e) {
|
|
18569
18808
|
if (this.binary === "conductor" && this.io.platform === "darwin" && e.code === "ENOENT") {
|
|
18570
18809
|
this.binary = BUNDLED_CONDUCTOR;
|
|
18571
|
-
return this.
|
|
18810
|
+
return this.execOnce(args, input, mutation, timeoutMs);
|
|
18572
18811
|
}
|
|
18573
18812
|
if (e.code === "ENOENT")
|
|
18574
18813
|
throw new RuntimeError("Conductor CLI is missing", "unavailable", CONDUCTOR_INSTALL_FIX);
|
|
18575
18814
|
if (mutation)
|
|
18576
18815
|
throw this.error("unknown-outcome");
|
|
18577
|
-
|
|
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);
|
|
18578
18818
|
}
|
|
18579
18819
|
if (r.timedOut)
|
|
18580
|
-
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"));
|
|
18581
18821
|
if (r.outputExceeded)
|
|
18582
18822
|
throw mutation ? this.error("unknown-outcome") : new RuntimeError(`Conductor ${operation} exceeded the 2000000-byte output limit`, "unavailable", "use the armada-runtime-conductor guide");
|
|
18583
18823
|
if (r.code !== 0) {
|
|
18584
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";
|
|
18585
18825
|
if (code === "unknown-outcome")
|
|
18586
18826
|
throw new RuntimeError("Conductor create failed without confirming whether a worker was created", code, "conductor model");
|
|
18587
|
-
if (code === "unavailable")
|
|
18588
|
-
|
|
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
|
+
}
|
|
18589
18831
|
throw this.error(code);
|
|
18590
18832
|
}
|
|
18591
18833
|
return r;
|
|
18592
18834
|
}
|
|
18593
18835
|
async call(args, input, mutation = false, timeoutMs = 1e4) {
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
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
|
+
});
|
|
18605
18850
|
}
|
|
18606
18851
|
async preflight(input) {
|
|
18607
18852
|
const checks = [];
|
|
@@ -19235,7 +19480,8 @@ function runtimeFor(io, config, runtime, secretValues = []) {
|
|
|
19235
19480
|
];
|
|
19236
19481
|
switch (runtimeNameOf(runtime)) {
|
|
19237
19482
|
case "conductor":
|
|
19238
|
-
return new ConductorAdapter(io, values)
|
|
19483
|
+
return new ConductorAdapter(io, values, { onRetry: (message) => io.stderr(`${message}
|
|
19484
|
+
`) });
|
|
19239
19485
|
case "herdr":
|
|
19240
19486
|
return herdrErrors(new HerdrAdapter(io, config, values));
|
|
19241
19487
|
case "claude-code":
|
|
@@ -19582,6 +19828,7 @@ function statusLive(io, config, credentials) {
|
|
|
19582
19828
|
deferredLaunches: () => fleet.deferredLaunches(),
|
|
19583
19829
|
holds: () => fleet.holds(),
|
|
19584
19830
|
queue: () => fleet.queueList(),
|
|
19831
|
+
coordinators: () => fleet.coordinators(),
|
|
19585
19832
|
runtimeHandles: () => observeRuntimes(io, fleet, config)
|
|
19586
19833
|
} : undefined;
|
|
19587
19834
|
}
|
|
@@ -19930,7 +20177,7 @@ ${result.stderr}`, secrets) + detail : `Command failed; diagnostics withheld bec
|
|
|
19930
20177
|
}
|
|
19931
20178
|
|
|
19932
20179
|
// src/attach.ts
|
|
19933
|
-
import { resolve as
|
|
20180
|
+
import { resolve as resolve3 } from "node:path";
|
|
19934
20181
|
async function attachItems(io, config, credentials, target) {
|
|
19935
20182
|
const ticket = target.ticket.toUpperCase();
|
|
19936
20183
|
if (!/^[A-Z][A-Z0-9]*-\d+$/.test(ticket))
|
|
@@ -19956,7 +20203,7 @@ async function attachItems(io, config, credentials, target) {
|
|
|
19956
20203
|
} else {
|
|
19957
20204
|
if (!io.readBinaryFile)
|
|
19958
20205
|
throw new UsageError("this CLI cannot read attachment files");
|
|
19959
|
-
const bytes = await io.readBinaryFile(
|
|
20206
|
+
const bytes = await io.readBinaryFile(resolve3(io.cwd, item), MAX_ATTACHMENT_BYTES);
|
|
19960
20207
|
if (!bytes)
|
|
19961
20208
|
throw new UsageError(`attachment file not found: ${item}`);
|
|
19962
20209
|
const contentType = attachmentImageType(bytes) ?? "";
|
|
@@ -19993,7 +20240,7 @@ async function attachCommand(io, config, credentials, args) {
|
|
|
19993
20240
|
}
|
|
19994
20241
|
|
|
19995
20242
|
// src/brief.ts
|
|
19996
|
-
import { dirname as
|
|
20243
|
+
import { dirname as dirname7, join as join5 } from "node:path";
|
|
19997
20244
|
|
|
19998
20245
|
// src/plan-approval.ts
|
|
19999
20246
|
function preApprovalReason(options) {
|
|
@@ -20038,7 +20285,7 @@ async function preparePreApproval(io, config, credentials, briefTicket, reason)
|
|
|
20038
20285
|
}
|
|
20039
20286
|
|
|
20040
20287
|
// src/watch.ts
|
|
20041
|
-
import { dirname as
|
|
20288
|
+
import { dirname as dirname6 } from "node:path";
|
|
20042
20289
|
|
|
20043
20290
|
// src/inbox.ts
|
|
20044
20291
|
var DEFAULT_WAIT_SECONDS = 300;
|
|
@@ -20116,7 +20363,13 @@ function renderEntries(project, items) {
|
|
|
20116
20363
|
if (!items.length)
|
|
20117
20364
|
return [`Inbox of ${project}: nothing waits for you.`];
|
|
20118
20365
|
const out = [`Inbox of ${project} (${items.length}), oldest first:`];
|
|
20119
|
-
|
|
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:");
|
|
20120
20373
|
const head = [
|
|
20121
20374
|
e.id === null ? e.kind : `#${e.id} ${e.kind}`,
|
|
20122
20375
|
e.ticket,
|
|
@@ -20127,7 +20380,10 @@ function renderEntries(project, items) {
|
|
|
20127
20380
|
e.request?.pr && `PR #${e.request.pr}`,
|
|
20128
20381
|
e.createdAt
|
|
20129
20382
|
].filter(Boolean).join(" · ");
|
|
20130
|
-
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(`
|
|
20131
20387
|
`).map((l) => l ? ` ${l}` : ""));
|
|
20132
20388
|
if (e.kind === "hand-back" && !/shipped with (?:ship-pr-dev|the fallback:)|shipping path unreported/.test(e.body))
|
|
20133
20389
|
out.push(" shipping path unreported");
|
|
@@ -20184,12 +20440,13 @@ async function inbox2(io, config, credentials, a) {
|
|
|
20184
20440
|
});
|
|
20185
20441
|
const inFlight = name === "default" ? report.inFlight : report.ownedInFlight ?? (scope === "mine" ? report.inFlight : null);
|
|
20186
20442
|
const openJobs = name === "default" ? report.openJobs : report.ownedOpenJobs ?? (scope === "mine" ? report.openJobs : undefined);
|
|
20187
|
-
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;
|
|
20188
20445
|
const next = await rearmFor(io, report.project, {
|
|
20189
20446
|
inFlight,
|
|
20190
|
-
open
|
|
20447
|
+
open,
|
|
20191
20448
|
openJobs,
|
|
20192
|
-
act:
|
|
20449
|
+
act: open > 0
|
|
20193
20450
|
});
|
|
20194
20451
|
const runtimes = (await fleet.runtimeHandles().catch(() => [])).filter((h) => h.runtimeState && (scope === "all" || h.coordinator === name)).map((h) => ({
|
|
20195
20452
|
ticket: h.ticket,
|
|
@@ -20207,7 +20464,7 @@ async function inbox2(io, config, credentials, a) {
|
|
|
20207
20464
|
}
|
|
20208
20465
|
|
|
20209
20466
|
// src/job.ts
|
|
20210
|
-
import { dirname as
|
|
20467
|
+
import { dirname as dirname5 } from "node:path";
|
|
20211
20468
|
function definition(config, name) {
|
|
20212
20469
|
const job = Object.hasOwn(config.jobs ?? {}, name) ? config.jobs[name] : undefined;
|
|
20213
20470
|
if (!job)
|
|
@@ -20272,7 +20529,7 @@ async function jobCommand(io, config, credentials, args, configPath) {
|
|
|
20272
20529
|
if (!fleet)
|
|
20273
20530
|
throw new UsageError("jobs need a sign-in to Armada", "armada login");
|
|
20274
20531
|
const now = () => io.now?.() ?? new Date;
|
|
20275
|
-
const root =
|
|
20532
|
+
const root = dirname5(configPath);
|
|
20276
20533
|
const print = (jobs) => io.stdout(args.json ? `${JSON.stringify(jobs, null, 2)}
|
|
20277
20534
|
` : jobs.length ? jobs.map((j) => renderJob(j, config, now())).join("") : `No jobs.
|
|
20278
20535
|
`);
|
|
@@ -20530,16 +20787,19 @@ function refreshingJobsFleet(io, fleet, config, root, signal) {
|
|
|
20530
20787
|
// src/release.ts
|
|
20531
20788
|
var NOTICE_COMMANDS = new Set(["status", "inbox"]);
|
|
20532
20789
|
var NOTICE_MS = 24 * 60 * 60000;
|
|
20533
|
-
async function noticeRelease(io, running, view = fsRepoView(io.cwd)) {
|
|
20790
|
+
async function noticeRelease(io, running, view = fsRepoView(io.cwd), options = {}) {
|
|
20534
20791
|
const server = heard(io).server;
|
|
20535
|
-
if (io.env.ARMADA_TICKET?.trim() ||
|
|
20792
|
+
if (io.env.ARMADA_TICKET?.trim() || server && compareVersions(running, server.minimum) < 0)
|
|
20536
20793
|
return;
|
|
20537
|
-
const latest = newerRelease(running, server.latest);
|
|
20538
20794
|
const paths = machinePaths(io.env);
|
|
20539
|
-
if (!
|
|
20795
|
+
if (!paths)
|
|
20540
20796
|
return;
|
|
20797
|
+
const newer = newerRelease(running, server?.latest);
|
|
20541
20798
|
const setupBehind = await skillsBehind(view) !== null;
|
|
20542
|
-
|
|
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))(), {
|
|
20543
20803
|
intervalMs: NOTICE_MS,
|
|
20544
20804
|
pid: io.pid,
|
|
20545
20805
|
alive: io.processAlive
|
|
@@ -20549,21 +20809,16 @@ async function noticeRelease(io, running, view = fsRepoView(io.cwd)) {
|
|
|
20549
20809
|
io.stderr(`armada: ${releaseLine(running, latest, { setupBehind })}
|
|
20550
20810
|
`);
|
|
20551
20811
|
}
|
|
20552
|
-
function pendingRelease(io, running
|
|
20812
|
+
function pendingRelease(io, running) {
|
|
20553
20813
|
return async () => {
|
|
20554
20814
|
if (io.env.ARMADA_TICKET?.trim())
|
|
20555
20815
|
return null;
|
|
20556
20816
|
const server = heard(io).server;
|
|
20557
|
-
|
|
20558
|
-
const behind = await skillsBehind(view);
|
|
20559
|
-
if (!minimum && !behind)
|
|
20817
|
+
if (!server || compareVersions(running, server.minimum) >= 0)
|
|
20560
20818
|
return null;
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
setupBehind: behind !== null,
|
|
20564
|
-
minimum: minimum && server ? server.minimum : null
|
|
20819
|
+
return releaseEntry(running, versionToInstall(server.minimum, server.latest), (io.now ?? (() => new Date))(), {
|
|
20820
|
+
minimum: server.minimum
|
|
20565
20821
|
});
|
|
20566
|
-
return !minimum && seen.includes(entryKey(entry)) ? null : entry;
|
|
20567
20822
|
};
|
|
20568
20823
|
}
|
|
20569
20824
|
|
|
@@ -20579,7 +20834,21 @@ async function remember(io, project, patch) {
|
|
|
20579
20834
|
if (!paths)
|
|
20580
20835
|
return;
|
|
20581
20836
|
try {
|
|
20582
|
-
|
|
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);
|
|
20583
20852
|
} catch (err) {
|
|
20584
20853
|
io.stderr(`armada: warning: could not keep the watch state (${err instanceof Error ? err.message : String(err)})
|
|
20585
20854
|
`);
|
|
@@ -20603,8 +20872,9 @@ async function rearmFor(io, project, o) {
|
|
|
20603
20872
|
return rearm({ ...o, openJobs: o.openJobs ?? state?.openJobs, running, mode });
|
|
20604
20873
|
}
|
|
20605
20874
|
var now = (io) => (io.now ?? (() => new Date))();
|
|
20606
|
-
var shown = (io, items, inFlight, openJobs = []) => ({
|
|
20875
|
+
var shown = (io, items, inFlight, openJobs = [], scope = "all") => ({
|
|
20607
20876
|
seen: items.map(entryKey),
|
|
20877
|
+
seenScope: scope,
|
|
20608
20878
|
openJobs,
|
|
20609
20879
|
...inFlight ? { inFlight, readAt: now(io).toISOString() } : {},
|
|
20610
20880
|
stopped: null
|
|
@@ -20718,9 +20988,9 @@ function watchDeadline(until, clock, expire, schedule = (run, ms) => {
|
|
|
20718
20988
|
async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
20719
20989
|
requireSignIn(credentials);
|
|
20720
20990
|
const project = config.project.slug;
|
|
20721
|
-
const name = await coordinatorName(io, project,
|
|
20991
|
+
const name = await coordinatorName(io, project, dirname6(configPath));
|
|
20722
20992
|
const scope = options.scope ?? (name === "default" ? "all" : "mine");
|
|
20723
|
-
io = { ...io, coordinatorRoot:
|
|
20993
|
+
io = { ...io, coordinatorRoot: dirname6(configPath), env: { ...io.env, ARMADA_COORDINATOR: name } };
|
|
20724
20994
|
const paths = machinePaths(io.env);
|
|
20725
20995
|
const pid = io.pid ?? process.pid;
|
|
20726
20996
|
const controller = new AbortController;
|
|
@@ -20730,6 +21000,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20730
21000
|
let taken = false;
|
|
20731
21001
|
let timedOut = false;
|
|
20732
21002
|
let cancelDeadline;
|
|
21003
|
+
let noticeIo;
|
|
20733
21004
|
const until = options.minutes === undefined ? undefined : new Date(now(io).getTime() + options.minutes * 60000);
|
|
20734
21005
|
const resume = () => {
|
|
20735
21006
|
const flags = [
|
|
@@ -20783,17 +21054,18 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20783
21054
|
signal: init?.signal ? AbortSignal.any([init.signal, controller.signal]) : controller.signal
|
|
20784
21055
|
}) : undefined
|
|
20785
21056
|
};
|
|
21057
|
+
noticeIo = watchingIo;
|
|
20786
21058
|
const { fleet, warning } = liveFleet(watchingIo, config, credentials);
|
|
20787
21059
|
if (!fleet)
|
|
20788
21060
|
throw new Refusal(`the inbox is on Armada, which cannot be reached: ${warning ?? "no answer"}`, "armada whoami");
|
|
20789
21061
|
const before = paths ? await readWatchState(paths, project, name) : null;
|
|
20790
|
-
await remember(io, project, { root:
|
|
21062
|
+
await remember(io, project, { root: dirname6(configPath), stopped: null });
|
|
20791
21063
|
if (until && !io.sleep)
|
|
20792
21064
|
cancelDeadline = watchDeadline(until, () => now(io), () => {
|
|
20793
21065
|
timedOut = true;
|
|
20794
21066
|
controller.abort(new Error("watch duration ended"));
|
|
20795
21067
|
});
|
|
20796
|
-
const watchingFleet = refreshingJobsFleet(watchingIo, observingFleet(watchingIo, fleet, config), config,
|
|
21068
|
+
const watchingFleet = refreshingJobsFleet(watchingIo, observingFleet(watchingIo, fleet, config), config, dirname6(configPath), controller.signal);
|
|
20797
21069
|
const common = {
|
|
20798
21070
|
until,
|
|
20799
21071
|
project,
|
|
@@ -20826,7 +21098,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20826
21098
|
},
|
|
20827
21099
|
onRetry: (message) => io.stderr(`armada: warning: ${message}
|
|
20828
21100
|
`),
|
|
20829
|
-
release: pendingRelease(watchingIo, version
|
|
21101
|
+
release: pendingRelease(watchingIo, version)
|
|
20830
21102
|
};
|
|
20831
21103
|
if (options.follow) {
|
|
20832
21104
|
const cursor = options.cursor ?? before?.cursor ?? eventCursor(0, now(io).toISOString());
|
|
@@ -20852,7 +21124,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20852
21124
|
`)
|
|
20853
21125
|
})) {
|
|
20854
21126
|
io.stdout(json ? `${JSON.stringify(line)}
|
|
20855
|
-
` : `${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}
|
|
20856
21128
|
`);
|
|
20857
21129
|
options.cursor = line.cursor;
|
|
20858
21130
|
}
|
|
@@ -20868,10 +21140,16 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20868
21140
|
}
|
|
20869
21141
|
const inFlight = name === "default" ? report.inFlight : report.ownedInFlight ?? (scope === "mine" ? report.inFlight : null);
|
|
20870
21142
|
const openJobs = name === "default" ? report.openJobs : report.ownedOpenJobs ?? (scope === "mine" ? report.openJobs : undefined);
|
|
20871
|
-
await remember(io, project, shown(io, report.items, inFlight, openJobs));
|
|
21143
|
+
await remember(io, project, shown(io, report.items, inFlight, openJobs, scope));
|
|
20872
21144
|
controller.signal.throwIfAborted();
|
|
20873
|
-
const open = report.items.filter((e) => e.kind !== "version").length;
|
|
20874
|
-
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
|
+
});
|
|
20875
21153
|
if (json)
|
|
20876
21154
|
io.stdout(`${JSON.stringify({ ...report, watch: next }, null, 2)}
|
|
20877
21155
|
`);
|
|
@@ -20894,6 +21172,8 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20894
21172
|
await releaseWatchLock(paths, project, pid, identity, name).catch(() => {});
|
|
20895
21173
|
unsubscribe?.();
|
|
20896
21174
|
cancelDeadline?.();
|
|
21175
|
+
if (!options.follow && noticeIo)
|
|
21176
|
+
await noticeRelease(noticeIo, version, fsRepoView(dirname6(configPath)), { setupOnly: true }).catch(() => {});
|
|
20897
21177
|
}
|
|
20898
21178
|
if (stoppedBy) {
|
|
20899
21179
|
(options.follow ? io.stderr : io.stdout)(`armada watch for ${project} stopped by ${stoppedBy} (pid ${pid})
|
|
@@ -20913,8 +21193,8 @@ async function hookStop(io, rest, findConfig) {
|
|
|
20913
21193
|
const cwd = typeof input.cwd === "string" && input.cwd ? input.cwd : io.cwd;
|
|
20914
21194
|
const { path, text } = await findConfig({ ...io, cwd });
|
|
20915
21195
|
const project = parseConfig(text, path).project.slug;
|
|
20916
|
-
const { state, running } = await watchOf({ ...io, coordinatorRoot:
|
|
20917
|
-
const d = stopHookDecision({ project, root:
|
|
21196
|
+
const { state, running } = await watchOf({ ...io, coordinatorRoot: dirname6(path) }, project);
|
|
21197
|
+
const d = stopHookDecision({ project, root: dirname6(path), state, watching: running, env: io.env });
|
|
20918
21198
|
if (d.block)
|
|
20919
21199
|
io.stdout(`${JSON.stringify({ decision: "block", reason: d.reason })}
|
|
20920
21200
|
`);
|
|
@@ -21046,7 +21326,7 @@ async function brief2(io, config, credentials, a, version, configPath) {
|
|
|
21046
21326
|
if (!credentials.linearApiKey)
|
|
21047
21327
|
throw missingKey(LINEAR_KEY);
|
|
21048
21328
|
const extraPath = config.brief.extra;
|
|
21049
|
-
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join5(
|
|
21329
|
+
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join5(dirname7(configPath), extraPath)).catch(() => null) } : null;
|
|
21050
21330
|
const { fleet } = liveFleet(io, config, credentials);
|
|
21051
21331
|
let b;
|
|
21052
21332
|
try {
|
|
@@ -21129,6 +21409,7 @@ ${next.line}
|
|
|
21129
21409
|
var LABELS = {
|
|
21130
21410
|
known: "known flaky test",
|
|
21131
21411
|
runner: "runner problem",
|
|
21412
|
+
dependent: "ignored as a dependent summary",
|
|
21132
21413
|
failure: "failure",
|
|
21133
21414
|
external: "external check"
|
|
21134
21415
|
};
|
|
@@ -21140,6 +21421,8 @@ function renderCiWhy(sha, explanations) {
|
|
|
21140
21421
|
lines.push("", `${e.check}: ${e.superseded ? "superseded by a newer head" : LABELS[e.class]} (${e.conclusion.toLowerCase()}${e.attempt ? `, workflow attempt ${e.attempt}` : ""})`);
|
|
21141
21422
|
if (e.tests.length)
|
|
21142
21423
|
lines.push(` Tests: ${e.tests.join("; ")}`);
|
|
21424
|
+
if (e.dependencies?.length)
|
|
21425
|
+
lines.push(` Dependencies: ${e.dependencies.join("; ")}`);
|
|
21143
21426
|
lines.push(...e.error.map((l) => ` ${l}`));
|
|
21144
21427
|
if (!e.error.length && !e.superseded)
|
|
21145
21428
|
lines.push(" No error details available; open the check link.");
|
|
@@ -21214,11 +21497,26 @@ async function ciWhy(io, config, credentials, args) {
|
|
|
21214
21497
|
check.attempt = attempts.get(check.runId);
|
|
21215
21498
|
}
|
|
21216
21499
|
}
|
|
21500
|
+
for (const check of reading.checks) {
|
|
21501
|
+
if (check.app !== "github-actions" || check.superseded || check.id === null || check.runId === null || !logs.get(check.id)?.lines.some((l) => l.includes('##[group]Run echo "Dependency failed: ')))
|
|
21502
|
+
continue;
|
|
21503
|
+
try {
|
|
21504
|
+
check.steps = await fetchJobSteps({
|
|
21505
|
+
...opts,
|
|
21506
|
+
jobId: check.id,
|
|
21507
|
+
runId: check.runId,
|
|
21508
|
+
sha: check.headSha,
|
|
21509
|
+
name: check.name
|
|
21510
|
+
});
|
|
21511
|
+
} catch {
|
|
21512
|
+
warnings.push(`job ${check.id}: dependency step evidence unavailable; treating summary as an unknown failure`);
|
|
21513
|
+
}
|
|
21514
|
+
}
|
|
21217
21515
|
const original = explainChecks(reading.checks, logs, config.ci);
|
|
21218
21516
|
const explanations = [...original];
|
|
21219
21517
|
const reruns = [];
|
|
21220
21518
|
if (args.options.rerun) {
|
|
21221
|
-
explanations.sort((a, b) => Number(
|
|
21519
|
+
explanations.sort((a, b) => Number(["known", "runner", "dependent"].includes(a.class)) - Number(["known", "runner", "dependent"].includes(b.class)));
|
|
21222
21520
|
const groups = new Map;
|
|
21223
21521
|
for (const id of reading.runIds)
|
|
21224
21522
|
groups.set(id, []);
|
|
@@ -21334,7 +21632,7 @@ async function configCommand(io, config, args) {
|
|
|
21334
21632
|
|
|
21335
21633
|
// src/deploy.ts
|
|
21336
21634
|
import { createHash as createHash7, randomUUID } from "node:crypto";
|
|
21337
|
-
import { dirname as
|
|
21635
|
+
import { dirname as dirname8, join as join6 } from "node:path";
|
|
21338
21636
|
var hash = (s) => createHash7("sha256").update(s).digest("base64url");
|
|
21339
21637
|
var sleepOf2 = (io) => io.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
21340
21638
|
async function recordDeploy(io, write, input) {
|
|
@@ -21387,7 +21685,7 @@ async function startDeploys(io, config, credentials, configPath, sha, targets, j
|
|
|
21387
21685
|
const target = config.deploy?.targets.find((t) => t.name === name);
|
|
21388
21686
|
if (!target)
|
|
21389
21687
|
continue;
|
|
21390
|
-
const { missing } = resolveDeployEnv(target, local.env, io.env);
|
|
21688
|
+
const { missing, env } = resolveDeployEnv(target, local.env, io.env);
|
|
21391
21689
|
if (missing.length) {
|
|
21392
21690
|
await skipUnconfigured(io, config, credentials, target, sha, missing);
|
|
21393
21691
|
results.push({ target: name, started: false, next: null, skipped: true });
|
|
@@ -21398,11 +21696,15 @@ async function startDeploys(io, config, credentials, configPath, sha, targets, j
|
|
|
21398
21696
|
let started = false;
|
|
21399
21697
|
try {
|
|
21400
21698
|
const paths = machinePaths(io.env);
|
|
21401
|
-
started = (sha ? await io.startBackground?.(args,
|
|
21699
|
+
started = (sha ? await io.startBackground?.(args, {
|
|
21700
|
+
env: { ...io.env, ...env },
|
|
21701
|
+
...paths ? { logPath: join6(paths.dir, "watch", `deploy-${hash(`${config.project.slug}/${name}/${sha}`)}.log`) } : {}
|
|
21702
|
+
}) : false) ?? false;
|
|
21402
21703
|
} catch {}
|
|
21403
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)";
|
|
21404
21706
|
if (!json)
|
|
21405
|
-
io.stdout(started ? `Watching the deploy of ${sha} to ${name}
|
|
21707
|
+
io.stdout(started ? `Watching the deploy of ${sha} to ${name}${note}
|
|
21406
21708
|
` : `Next: ${next}
|
|
21407
21709
|
`);
|
|
21408
21710
|
}
|
|
@@ -21483,14 +21785,16 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21483
21785
|
base,
|
|
21484
21786
|
head
|
|
21485
21787
|
}) : (await io.exec?.("git", ["merge-base", "--is-ancestor", base, head], {
|
|
21486
|
-
cwd:
|
|
21788
|
+
cwd: dirname8(configPath),
|
|
21487
21789
|
timeoutMs: 1e4
|
|
21488
21790
|
}))?.code === 0;
|
|
21489
21791
|
if (credentials.githubToken || answer)
|
|
21490
21792
|
ancestry.set(key, answer);
|
|
21491
21793
|
return answer;
|
|
21492
21794
|
};
|
|
21795
|
+
let observationDetail = "";
|
|
21493
21796
|
const write = (input) => recordDeploy(io, async (candidate) => {
|
|
21797
|
+
observationDetail = clean(candidate.detail);
|
|
21494
21798
|
if (candidate.state === "healthy" && candidate.liveSha) {
|
|
21495
21799
|
candidate = { ...candidate, coveredShas: [] };
|
|
21496
21800
|
for (const row of await fleet.deployState({ target: target.name })) {
|
|
@@ -21501,7 +21805,8 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21501
21805
|
return fleet.recordDeploy({ ...candidate, detail: clean(candidate.detail) });
|
|
21502
21806
|
}, input);
|
|
21503
21807
|
const holder = `deploy-${randomUUID()}`;
|
|
21504
|
-
const cwd =
|
|
21808
|
+
const cwd = dirname8(configPath);
|
|
21809
|
+
let configurationDetail = "";
|
|
21505
21810
|
const command = async (command, liveSha, remainingMs) => {
|
|
21506
21811
|
const result = await io.exec?.("sh", ["-c", command], {
|
|
21507
21812
|
cwd,
|
|
@@ -21509,12 +21814,24 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21509
21814
|
maxOutputBytes: 64 * 1024,
|
|
21510
21815
|
processGroup: true,
|
|
21511
21816
|
env: { ...io.env, ...settings.env, ARMADA_DEPLOY_SHA: liveSha, ARMADA_DEPLOY_TARGET: target.name }
|
|
21817
|
+
}).catch((err) => {
|
|
21818
|
+
if (err.code !== "ENOENT" && err.code !== "ENOTDIR")
|
|
21819
|
+
throw err;
|
|
21820
|
+
return { code: 127, stdout: "", stderr: err.message, timedOut: false, outputExceeded: false };
|
|
21512
21821
|
});
|
|
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]}:`)));
|
|
21823
|
+
const detail = deployDetail(clean(`${result?.stdout ?? ""}
|
|
21824
|
+
${result?.stderr ?? ""}
|
|
21825
|
+
${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
21826
|
+
if (notRunnable)
|
|
21827
|
+
configurationDetail = detail;
|
|
21513
21828
|
return {
|
|
21829
|
+
code: result?.code ?? 1,
|
|
21830
|
+
timedOut: result?.timedOut ?? false,
|
|
21831
|
+
outputExceeded: result?.outputExceeded ?? false,
|
|
21514
21832
|
ok: result?.code === 0 && !result.timedOut,
|
|
21515
|
-
detail
|
|
21516
|
-
|
|
21517
|
-
${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
21833
|
+
detail,
|
|
21834
|
+
notRunnable,
|
|
21518
21835
|
stdout: result?.stdout ?? ""
|
|
21519
21836
|
};
|
|
21520
21837
|
};
|
|
@@ -21544,9 +21861,9 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21544
21861
|
target: target.name,
|
|
21545
21862
|
sha: liveSha,
|
|
21546
21863
|
liveSha,
|
|
21547
|
-
state: result.ok ? "healthy" : "smoke-failed",
|
|
21864
|
+
state: result.notRunnable ? "not-runnable" : result.ok ? "healthy" : "smoke-failed",
|
|
21548
21865
|
detail: result.detail,
|
|
21549
|
-
pauseOnFailure: target.pauseOnFailure
|
|
21866
|
+
pauseOnFailure: !result.notRunnable && target.pauseOnFailure
|
|
21550
21867
|
});
|
|
21551
21868
|
return result;
|
|
21552
21869
|
} finally {
|
|
@@ -21560,7 +21877,7 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21560
21877
|
};
|
|
21561
21878
|
try {
|
|
21562
21879
|
const prior = (await fleet.deployState({ target: target.name, sha }))[0];
|
|
21563
|
-
if (prior && !["waiting", "live", "skipped"].includes(prior.state)) {
|
|
21880
|
+
if (prior && !["waiting", "live", "skipped", "not-runnable", "not-deployed"].includes(prior.state)) {
|
|
21564
21881
|
io.backgroundReady?.(true);
|
|
21565
21882
|
io.stdout(`${target.name}: ${prior.state}
|
|
21566
21883
|
`);
|
|
@@ -21577,7 +21894,7 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21577
21894
|
const result = await watchDeploy({
|
|
21578
21895
|
target,
|
|
21579
21896
|
sha,
|
|
21580
|
-
...prior &&
|
|
21897
|
+
...prior && !["skipped", "not-runnable", "not-deployed"].includes(prior.state) ? { startedAt: new Date(prior.startedAt) } : {},
|
|
21581
21898
|
now,
|
|
21582
21899
|
sleep: sleepOf2(io),
|
|
21583
21900
|
record: write,
|
|
@@ -21593,18 +21910,25 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21593
21910
|
live: async (remainingMs) => {
|
|
21594
21911
|
if (target.githubEnvironment)
|
|
21595
21912
|
return fetchLiveDeploy({ ...gh, environment: target.githubEnvironment });
|
|
21913
|
+
if (target.check)
|
|
21914
|
+
return checkReading(await command(target.check, sha, remainingMs), sha);
|
|
21596
21915
|
const result = await command(target.liveShaCommand, sha, remainingMs);
|
|
21597
21916
|
const liveSha = result.stdout.trim();
|
|
21598
21917
|
return {
|
|
21599
21918
|
sha: result.ok && /^[0-9a-f]{40}$/.test(liveSha) ? liveSha : null,
|
|
21600
21919
|
state: result.ok && /^[0-9a-f]{40}$/.test(liveSha) ? "success" : "pending",
|
|
21601
|
-
detail: result.detail
|
|
21920
|
+
detail: result.detail,
|
|
21921
|
+
notRunnable: result.notRunnable
|
|
21602
21922
|
};
|
|
21603
21923
|
}
|
|
21604
21924
|
});
|
|
21605
|
-
|
|
21925
|
+
if (result === "not-runnable")
|
|
21926
|
+
io.stderr(`armada: warning: ${target.name}: deploy check not runnable on this machine (configuration)
|
|
21927
|
+
${configurationDetail}
|
|
21928
|
+
`);
|
|
21929
|
+
io.stdout(`${target.name}: ${result === "not-deployed" ? `not deployed (host skipped: ${observationDetail})` : result === "not-runnable" ? "not runnable (configuration)" : result}
|
|
21606
21930
|
`);
|
|
21607
|
-
return result === "healthy" ? 0 : 1;
|
|
21931
|
+
return result === "healthy" || result === "not-runnable" || result === "not-deployed" ? 0 : 1;
|
|
21608
21932
|
} catch (err) {
|
|
21609
21933
|
io.backgroundReady?.(false);
|
|
21610
21934
|
io.stderr(`armada: deploy watcher failed: ${clean(err instanceof Error ? err.message : "unexpected failure")}
|
|
@@ -21790,10 +22114,10 @@ import { join as join9 } from "node:path";
|
|
|
21790
22114
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
21791
22115
|
import { rm as rm3 } from "node:fs/promises";
|
|
21792
22116
|
import { hostname, tmpdir } from "node:os";
|
|
21793
|
-
import { dirname as
|
|
22117
|
+
import { dirname as dirname11, join as join8 } from "node:path";
|
|
21794
22118
|
|
|
21795
22119
|
// src/after-merge.ts
|
|
21796
|
-
import { dirname as
|
|
22120
|
+
import { dirname as dirname10, resolve as resolve5 } from "node:path";
|
|
21797
22121
|
|
|
21798
22122
|
// src/deferred-launch.ts
|
|
21799
22123
|
async function launchDeferredAfterMerge(outcome, config, fleet, launch) {
|
|
@@ -21841,7 +22165,7 @@ async function launchDeferredAfterMerge(outcome, config, fleet, launch) {
|
|
|
21841
22165
|
|
|
21842
22166
|
// src/launch.ts
|
|
21843
22167
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
21844
|
-
import { basename, dirname as
|
|
22168
|
+
import { basename, dirname as dirname9, join as join7, resolve as resolve4 } from "node:path";
|
|
21845
22169
|
async function launch(io, config, credentials, args, version, configPath) {
|
|
21846
22170
|
if (args.options["when-unblocked"] || args.options.after !== undefined)
|
|
21847
22171
|
return deferLaunch(io, config, credentials, args);
|
|
@@ -22039,7 +22363,7 @@ async function prepareLaunch(io, config, credentials, args, version, configPath,
|
|
|
22039
22363
|
gaps.push(error instanceof UsageError ? error.message : "could not read the repository state");
|
|
22040
22364
|
}
|
|
22041
22365
|
runtime = runtimeFor({ ...io, cwd: repo }, config, runtimeName);
|
|
22042
|
-
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join7(
|
|
22366
|
+
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join7(dirname9(configPath), config.brief.extra)) } : null;
|
|
22043
22367
|
const sharedResources = await reservationsForBrief(() => fleet.reservations(), config.reservations.length > 0);
|
|
22044
22368
|
const npm = await checkPublished(version, io.fetch ?? fetch);
|
|
22045
22369
|
if (npm.state === "missing") {
|
|
@@ -22363,7 +22687,7 @@ async function readNotes(io, path) {
|
|
|
22363
22687
|
throw new UsageError("--notes - needs standard input");
|
|
22364
22688
|
text = await io.readStdin();
|
|
22365
22689
|
} else
|
|
22366
|
-
text = await io.readFile(
|
|
22690
|
+
text = await io.readFile(resolve4(io.cwd, path));
|
|
22367
22691
|
} catch {
|
|
22368
22692
|
throw new UsageError("could not read --notes; supply a readable file or - for standard input");
|
|
22369
22693
|
}
|
|
@@ -22398,7 +22722,7 @@ async function launchPlan(io, json, input) {
|
|
|
22398
22722
|
cwd: repo,
|
|
22399
22723
|
timeoutMs: 1e4
|
|
22400
22724
|
});
|
|
22401
|
-
const mainRoot = common.code === 0 && common.stdout.trim().startsWith("/") ?
|
|
22725
|
+
const mainRoot = common.code === 0 && common.stdout.trim().startsWith("/") ? dirname9(common.stdout.trim()) : repo;
|
|
22402
22726
|
const remote = await execute("git", ["ls-remote", "--symref", "origin", "HEAD"], { cwd: repo, timeoutMs: 20000 });
|
|
22403
22727
|
base = remote.code === 0 ? remote.stdout.match(/^ref:\s+refs\/heads\/(\S+)\s+HEAD/m)?.[1] ?? null : null;
|
|
22404
22728
|
if (!base)
|
|
@@ -22598,7 +22922,7 @@ async function afterMerge(io, config, credentials, outcome, opts) {
|
|
|
22598
22922
|
rest: [request.ticket],
|
|
22599
22923
|
json: false,
|
|
22600
22924
|
options: request.profile ? { profile: request.profile, reason: "deferred launch requested by the coordinator" } : {}
|
|
22601
|
-
}, version, opts.configPath ??
|
|
22925
|
+
}, version, opts.configPath ?? resolve5(io.cwd, "armada.toml"));
|
|
22602
22926
|
if (code !== 0)
|
|
22603
22927
|
throw new UsageError("the launcher did not start a worker");
|
|
22604
22928
|
return printed.join("");
|
|
@@ -22626,7 +22950,7 @@ async function archiveWorker(io, config, credentials, outcome, opts) {
|
|
|
22626
22950
|
const who = `${outcome.ticket.id} (${[a.runtime, a.handle].filter(Boolean).join(" · ") || "session unknown"})`;
|
|
22627
22951
|
return result(false, `No runtime guide is installed for ${a.runtime ?? "the worker's runtime"}, so Armada has nothing to archive for ${who}: a local session or subagent ends with its task; stop it yourself if it still runs.`);
|
|
22628
22952
|
}
|
|
22629
|
-
const configPath = opts.configPath ?
|
|
22953
|
+
const configPath = opts.configPath ? resolve5(io.cwd, opts.configPath) : null;
|
|
22630
22954
|
const recovery = `armada stop ${shellWord(outcome.ticket.id)} --merged-pr ${shellWord(outcome.pr.url)}${a.source === "armada" && a.claim?.releasedAt ? ` --claim-key ${archiveClaimKey(claimRef(a.claim))}` : ""}${configPath ? ` --config ${shellWord(configPath)}` : ""}`;
|
|
22631
22955
|
const failure = (detail) => {
|
|
22632
22956
|
const safe = redactRuntimeText(detail).replace(/\s+/g, " ").trim();
|
|
@@ -22650,7 +22974,7 @@ async function archiveWorker(io, config, credentials, outcome, opts) {
|
|
|
22650
22974
|
if (!fleet)
|
|
22651
22975
|
return failure("Armada is unavailable");
|
|
22652
22976
|
const ref = claimRef(h);
|
|
22653
|
-
const adapter = runtimeFor(configPath ? { ...io, cwd:
|
|
22977
|
+
const adapter = runtimeFor(configPath ? { ...io, cwd: dirname10(configPath) } : io, config, h.runtime);
|
|
22654
22978
|
const archived = await guarded(fleet, ref, "ended", () => adapter.archive(ref, { reason: "merged", whenWorking: "wait", waitMs: 600000 }));
|
|
22655
22979
|
if (!archived.archived && !archived.alreadyGone)
|
|
22656
22980
|
return failure("the runtime did not confirm archive");
|
|
@@ -22668,6 +22992,29 @@ async function archiveWorker(io, config, credentials, outcome, opts) {
|
|
|
22668
22992
|
}
|
|
22669
22993
|
}
|
|
22670
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
|
+
|
|
22671
23018
|
// src/render.ts
|
|
22672
23019
|
var MIN3 = 60000;
|
|
22673
23020
|
function relative2(iso, now) {
|
|
@@ -22705,7 +23052,7 @@ function queueLines(entries) {
|
|
|
22705
23052
|
let position = 0;
|
|
22706
23053
|
return entries.map((e) => `${queueOpen(e) ? `${++position}.` : " "} #${e.pr} ${e.state}${e.ticket ? ` ${e.ticket}` : ""} · queued by ${e.queuedBy}${e.detail ? ` — ${e.detail}` : ""}`);
|
|
22707
23054
|
}
|
|
22708
|
-
function renderStatus(r) {
|
|
23055
|
+
function renderStatus(r, hints = {}) {
|
|
22709
23056
|
const now = Date.parse(r.generatedAt);
|
|
22710
23057
|
const out = [];
|
|
22711
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));
|
|
@@ -22801,6 +23148,10 @@ function renderStatus(r) {
|
|
|
22801
23148
|
if (p.failingChecks.length)
|
|
22802
23149
|
out.push(`${indent}! failing: ${p.failingChecks.join(", ")}`);
|
|
22803
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");
|
|
22804
23155
|
if (r.warnings.length) {
|
|
22805
23156
|
out.push("", `Warnings (${r.warnings.length})`);
|
|
22806
23157
|
for (const w of r.warnings)
|
|
@@ -22832,7 +23183,7 @@ function fencedIo(io, tick, exec) {
|
|
|
22832
23183
|
...io.writeFile ? { writeFile: before(io.writeFile) } : {}
|
|
22833
23184
|
};
|
|
22834
23185
|
}
|
|
22835
|
-
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;
|
|
22836
23187
|
var tail = (text, lines = 30) => text.trimEnd().split(`
|
|
22837
23188
|
`).slice(-lines).join(`
|
|
22838
23189
|
`);
|
|
@@ -23101,7 +23452,7 @@ async function merge2(io, config, credentials, a, configPath, guards) {
|
|
|
23101
23452
|
if (!exec)
|
|
23102
23453
|
throw new UsageError("armada merge needs to run git and gh");
|
|
23103
23454
|
const linearApiKey = credentials.linearApiKey;
|
|
23104
|
-
const repoDir =
|
|
23455
|
+
const repoDir = dirname11(configPath);
|
|
23105
23456
|
const fetchOpt = httpOptions(io);
|
|
23106
23457
|
const gh = { token, repository: config.github.repository, ...fetchOpt };
|
|
23107
23458
|
const linearOpts = { apiKey: linearApiKey, labels: config.tracker.labels, ...fetchOpt };
|
|
@@ -23417,9 +23768,17 @@ ${watch.line}
|
|
|
23417
23768
|
if (o.merged)
|
|
23418
23769
|
await remember(io, project, { inFlight, readAt: (io.now ?? (() => new Date))().toISOString() });
|
|
23419
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
|
+
}
|
|
23420
23779
|
if (!a.json)
|
|
23421
23780
|
io.stdout(`${render(o, !!a.options["no-notify"])}${deferredLaunches.map((l) => l.output ?? `${l.ticket}: ${l.status}; ${l.command}
|
|
23422
|
-
`).join("")}${next.line}
|
|
23781
|
+
`).join("")}${hint}${next.line}
|
|
23423
23782
|
`);
|
|
23424
23783
|
for (const w of o.warnings)
|
|
23425
23784
|
io.stderr(`armada: warning: ${w}
|
|
@@ -23551,7 +23910,7 @@ function mergeResult(o) {
|
|
|
23551
23910
|
if (!o.merged)
|
|
23552
23911
|
return `Result: not merged (${o.lines.some((line) => line.startsWith("Dry run:")) ? "dry run" : "owner approval requested"}; nothing was merged)`;
|
|
23553
23912
|
const pending = [o.armadaPending ? "Armada" : "", o.linearPending ? "Linear" : ""].filter(Boolean).join(" and ");
|
|
23554
|
-
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})` : ""}`;
|
|
23555
23914
|
}
|
|
23556
23915
|
|
|
23557
23916
|
// src/init.ts
|
|
@@ -24327,7 +24686,7 @@ ${"─".repeat(60)}
|
|
|
24327
24686
|
|
|
24328
24687
|
// src/relaunch.ts
|
|
24329
24688
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
24330
|
-
import { basename as basename2, dirname as
|
|
24689
|
+
import { basename as basename2, dirname as dirname12, join as join10 } from "node:path";
|
|
24331
24690
|
async function relaunch(io, config, credentials, args, version, configPath) {
|
|
24332
24691
|
const [input, ...extra] = args.rest;
|
|
24333
24692
|
const o = args.options;
|
|
@@ -24466,7 +24825,7 @@ async function relaunch(io, config, credentials, args, version, configPath) {
|
|
|
24466
24825
|
const configHome = io.env.XDG_CONFIG_HOME ?? (io.env.HOME ? join10(io.env.HOME, ".config") : null);
|
|
24467
24826
|
const path = io.env.HERDR_CONFIG_PATH ?? (configHome ? join10(configHome, "herdr", "config.toml") : null);
|
|
24468
24827
|
const text = path ? await io.readFile(path).catch(() => null) : null;
|
|
24469
|
-
const directory = workspace?.path && old.runtime === "herdr" ?
|
|
24828
|
+
const directory = workspace?.path && old.runtime === "herdr" ? dirname12(workspace.path) : dirname12(herdrWorktreePath(herdrWorktreesDirectory(io.env, text), basename2(prepared.repo), prepared.spec.branch));
|
|
24470
24829
|
prepared.spec.herdrTarget = {
|
|
24471
24830
|
path: join10(directory, `armada-relaunch-${ticket.toLowerCase()}-${suffix}`),
|
|
24472
24831
|
agent: `relaunch-${ticket.toLowerCase()}-${suffix}`.slice(0, 31)
|
|
@@ -24717,7 +25076,7 @@ async function unreserveCommand(io, config, credentials, args) {
|
|
|
24717
25076
|
}
|
|
24718
25077
|
|
|
24719
25078
|
// src/secrets.ts
|
|
24720
|
-
import { dirname as
|
|
25079
|
+
import { dirname as dirname13, relative as relative3, resolve as resolve6 } from "node:path";
|
|
24721
25080
|
var NAME_HINT = "upper snake case, e.g. OPENAI_API_KEY";
|
|
24722
25081
|
var hhmm2 = (iso) => `${iso.slice(0, 16).replace("T", " ")} UTC`;
|
|
24723
25082
|
function signInOf(config, credentials) {
|
|
@@ -24797,7 +25156,7 @@ Next: armada secrets set <NAME> (an owner or admin), or the Keys page of Armada
|
|
|
24797
25156
|
async function exportRefusal(io, path) {
|
|
24798
25157
|
if (!io.exec)
|
|
24799
25158
|
return "git cannot be run here to check that the file is ignored";
|
|
24800
|
-
const cwd =
|
|
25159
|
+
const cwd = dirname13(path);
|
|
24801
25160
|
const tracked = await io.exec("git", ["ls-files", "--error-unmatch", "--", path], { cwd }).catch(() => null);
|
|
24802
25161
|
if (tracked?.code === 0)
|
|
24803
25162
|
return `git tracks ${path}: secrets written there would be committed`;
|
|
@@ -24904,7 +25263,7 @@ When set, re-run with armada run -- <command>. Never paste a key into chat.
|
|
|
24904
25263
|
const file = args.options.file;
|
|
24905
25264
|
if (!file)
|
|
24906
25265
|
throw new UsageError("secrets export needs --file <path>, a file git ignores (e.g. .env.local)");
|
|
24907
|
-
const path =
|
|
25266
|
+
const path = resolve6(io.cwd, file);
|
|
24908
25267
|
const refusal = await exportRefusal(io, path);
|
|
24909
25268
|
if (refusal)
|
|
24910
25269
|
throw new UsageError(refusal, "a path git ignores, e.g. .env.local listed in .gitignore");
|
|
@@ -25194,7 +25553,7 @@ async function upgrade(io, running, root) {
|
|
|
25194
25553
|
}
|
|
25195
25554
|
|
|
25196
25555
|
// src/validate.ts
|
|
25197
|
-
import { basename as basename3, resolve as
|
|
25556
|
+
import { basename as basename3, resolve as resolve7 } from "node:path";
|
|
25198
25557
|
async function readExcerpt(io, raw) {
|
|
25199
25558
|
const match = /^(.*):(\d+)-(\d+)$/.exec(raw);
|
|
25200
25559
|
const file = match?.[1] ?? raw;
|
|
@@ -25203,7 +25562,7 @@ async function readExcerpt(io, raw) {
|
|
|
25203
25562
|
const usage = `armada validate "<headline>" --excerpt '${file.replaceAll("'", "'\\''")}':1-40`;
|
|
25204
25563
|
if (!file || !Number.isSafeInteger(from) || from < 1 || to !== null && (!Number.isSafeInteger(to) || to < from))
|
|
25205
25564
|
throw new UsageError(`--excerpt needs <file>[:from-to], with a one-based inclusive range: ${usage}`);
|
|
25206
|
-
const text = await io.readFile(
|
|
25565
|
+
const text = await io.readFile(resolve7(io.cwd, file));
|
|
25207
25566
|
if (text === null)
|
|
25208
25567
|
throw new UsageError(`cannot read excerpt file: ${file}`);
|
|
25209
25568
|
const lines = excerptLines(text);
|
|
@@ -25218,7 +25577,7 @@ async function readExcerpt(io, raw) {
|
|
|
25218
25577
|
async function validationFiles(io, options) {
|
|
25219
25578
|
const excerpts = await Promise.all(attachList(options.excerpt).map((raw) => readExcerpt(io, raw)));
|
|
25220
25579
|
const file = options["details-file"];
|
|
25221
|
-
const details = file ? await io.readFile(
|
|
25580
|
+
const details = file ? await io.readFile(resolve7(io.cwd, file)) : null;
|
|
25222
25581
|
if (file && details === null)
|
|
25223
25582
|
throw new UsageError(`cannot read details file: ${file}`);
|
|
25224
25583
|
return { excerpts, details };
|
|
@@ -25493,7 +25852,9 @@ var COMMAND_HELP = {
|
|
|
25493
25852
|
`,
|
|
25494
25853
|
inbox: ` inbox [--mine|--all] [--wait [--timeout <seconds>]]
|
|
25495
25854
|
Coordinator: open questions, plans, requests, hand-backs and silent workers,
|
|
25496
|
-
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
|
|
25497
25858
|
when a new item arrives or after --timeout (default 300 s); \`armada watch\`
|
|
25498
25859
|
is the way to keep listening. Needs a sign-in to Armada
|
|
25499
25860
|
`,
|
|
@@ -25501,14 +25862,16 @@ var COMMAND_HELP = {
|
|
|
25501
25862
|
until something needs you (a question, plan, request, hand-back or silent
|
|
25502
25863
|
worker you have not seen), prints it and exits; exits "nothing to watch"
|
|
25503
25864
|
when no worker is in flight and nothing is open. An Armada
|
|
25504
|
-
outage does not end it: it keeps asking.
|
|
25505
|
-
|
|
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
|
|
25506
25868
|
watch --follow Stream lines without exiting on new items; --json prints NDJSON.
|
|
25507
25869
|
--since <cursor> resumes events; defaults to this machine's cursor.
|
|
25508
25870
|
--tickets A-1,B-2 and --kinds question,hand-back filter the stream.
|
|
25509
25871
|
--kinds all also prints claims, reports, releases and merges.
|
|
25510
25872
|
--mine filters events and inbox by coordinator ownership, including unowned entries.
|
|
25511
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.
|
|
25512
25875
|
--for <minutes> ends either watch cleanly with a resume command.
|
|
25513
25876
|
watch --stop [--name <name>] Stop only this project's verified watch and release its lock. Local,
|
|
25514
25877
|
no sign-in needed. Never stop a watch just to read inbox or status
|
|
@@ -25764,8 +26127,8 @@ Files:
|
|
|
25764
26127
|
projects/<slug>.json non-secret deploy settings for this project and machine
|
|
25765
26128
|
coordinators.json coordinator role per project and checkout
|
|
25766
26129
|
watch/<project>[@<name>].* the coordinator's watch: its lock, what you were shown, who is in flight
|
|
25767
|
-
|
|
25768
|
-
Only
|
|
26130
|
+
notices.json reserved release and command hints, with keys and times.
|
|
26131
|
+
Only a CLI below the server minimum interrupts armada watch
|
|
25769
26132
|
`;
|
|
25770
26133
|
function commandHelp(command) {
|
|
25771
26134
|
const block = Object.hasOwn(COMMAND_HELP, command) ? COMMAND_HELP[command] : undefined;
|
|
@@ -26047,21 +26410,21 @@ async function findConfig(io, explicit, command = "status", project = null) {
|
|
|
26047
26410
|
selected = join11(checkout.root, CONFIG_FILE);
|
|
26048
26411
|
}
|
|
26049
26412
|
if (selected) {
|
|
26050
|
-
const path =
|
|
26413
|
+
const path = resolve8(io.cwd, selected);
|
|
26051
26414
|
const text = await io.readFile(path);
|
|
26052
26415
|
if (text === null)
|
|
26053
26416
|
throw new UsageError(`${path} does not exist`, `armada ${command} --config <file>, with the path of an ${CONFIG_FILE}`);
|
|
26054
|
-
io.coordinatorRoot =
|
|
26417
|
+
io.coordinatorRoot = dirname14(path);
|
|
26055
26418
|
return { path, text };
|
|
26056
26419
|
}
|
|
26057
|
-
for (let dir =
|
|
26420
|
+
for (let dir = resolve8(io.cwd);; dir = dirname14(dir)) {
|
|
26058
26421
|
const path = join11(dir, CONFIG_FILE);
|
|
26059
26422
|
const text = await io.readFile(path);
|
|
26060
26423
|
if (text !== null) {
|
|
26061
|
-
io.coordinatorRoot =
|
|
26424
|
+
io.coordinatorRoot = dirname14(path);
|
|
26062
26425
|
return { path, text };
|
|
26063
26426
|
}
|
|
26064
|
-
if (
|
|
26427
|
+
if (dirname14(dir) === dir)
|
|
26065
26428
|
break;
|
|
26066
26429
|
}
|
|
26067
26430
|
throw new UsageError(`no ${CONFIG_FILE} found in ${io.cwd} or any parent directory, so this is not a repository Armada runs`, `armada init to set this repository up, armada ${command} --config <file> to use another ${CONFIG_FILE}, or armada status --all to see the registered projects`);
|
|
@@ -26085,9 +26448,6 @@ async function status2(io, args) {
|
|
|
26085
26448
|
...httpOptions(io),
|
|
26086
26449
|
...io.now ? { now: io.now } : {}
|
|
26087
26450
|
});
|
|
26088
|
-
const behind = await skillsBehind(fsRepoView(dirname13(path))).catch(() => null);
|
|
26089
|
-
if (behind)
|
|
26090
|
-
report.warnings.push(skillsBehindLine(behind, version));
|
|
26091
26451
|
let deploys = null;
|
|
26092
26452
|
if (config.deploy?.targets.length) {
|
|
26093
26453
|
try {
|
|
@@ -26097,7 +26457,7 @@ async function status2(io, args) {
|
|
|
26097
26457
|
}
|
|
26098
26458
|
}
|
|
26099
26459
|
io.stdout(args.json ? `${JSON.stringify({ ...report, ...deploys ? { deploys } : {} }, null, 2)}
|
|
26100
|
-
` : renderStatus(report));
|
|
26460
|
+
` : renderStatus(report, await statusHints(io, config, credentials, live?.coordinators)));
|
|
26101
26461
|
if (!args.json && deploys)
|
|
26102
26462
|
for (const row of deploys.rows)
|
|
26103
26463
|
io.stdout(`Deploy ${deployLine(row, (io.now ?? (() => new Date))())}
|
|
@@ -26142,10 +26502,10 @@ async function run(argv, io) {
|
|
|
26142
26502
|
if (command && NOTICE_COMMANDS.has(command))
|
|
26143
26503
|
await (async () => {
|
|
26144
26504
|
const args = parseArgs(argv);
|
|
26145
|
-
if (args.all)
|
|
26505
|
+
if (args.all && command === "status")
|
|
26146
26506
|
return await noticeRelease(io, version);
|
|
26147
26507
|
const { path } = await findConfig(io, args.config, command, args.project);
|
|
26148
|
-
await noticeRelease(io, version, fsRepoView(
|
|
26508
|
+
await noticeRelease(io, version, fsRepoView(dirname14(path)));
|
|
26149
26509
|
})().catch(() => {});
|
|
26150
26510
|
return code;
|
|
26151
26511
|
}
|
|
@@ -26306,7 +26666,7 @@ async function dispatch(argv, io) {
|
|
|
26306
26666
|
const { credentials } = await loadCredentials(io, scope ? { worker: scope } : { project: config.project.slug });
|
|
26307
26667
|
if (command === "inbox")
|
|
26308
26668
|
await recordPresence(io, config, credentials);
|
|
26309
|
-
return await worker(command === "stop" ? { ...io, cwd:
|
|
26669
|
+
return await worker(command === "stop" ? { ...io, cwd: dirname14(path) } : io, config, credentials, args);
|
|
26310
26670
|
}
|
|
26311
26671
|
if (args.command === "coordinator") {
|
|
26312
26672
|
const { text } = await findConfig(io, args.config, "coordinator", args.project);
|
|
@@ -26317,7 +26677,7 @@ async function dispatch(argv, io) {
|
|
|
26317
26677
|
if (args.command === "peek") {
|
|
26318
26678
|
const { path, text } = await findConfig(io, args.config, "peek", args.project);
|
|
26319
26679
|
const config = parseConfig(text, path);
|
|
26320
|
-
const selectedIo = { ...io, cwd:
|
|
26680
|
+
const selectedIo = { ...io, cwd: dirname14(path) };
|
|
26321
26681
|
const local = await loadCredentials(selectedIo, {
|
|
26322
26682
|
armada: false,
|
|
26323
26683
|
worker: {
|
|
@@ -26403,7 +26763,7 @@ async function dispatch(argv, io) {
|
|
|
26403
26763
|
}
|
|
26404
26764
|
if (args.command === "doctor") {
|
|
26405
26765
|
noExtra(args.rest);
|
|
26406
|
-
return await doctor(io, args.json, version, args.options.deep === "true");
|
|
26766
|
+
return await doctor(io, args.json, version, args.options.deep === "true", args.config ?? undefined);
|
|
26407
26767
|
}
|
|
26408
26768
|
if (args.command === "upgrade") {
|
|
26409
26769
|
noExtra(args.rest);
|
|
@@ -26413,8 +26773,8 @@ async function dispatch(argv, io) {
|
|
|
26413
26773
|
const { credentials } = await loadCredentials(io, { armada: false });
|
|
26414
26774
|
if (credentials.armadaSignIn?.kind === "worker" || !credentials.armadaSignIn && credentials.workerTickets.length || io.env.ARMADA_TICKET?.trim())
|
|
26415
26775
|
throw new UsageError("workers keep their launch's pinned version; the coordinator runs armada upgrade");
|
|
26416
|
-
const root = await gitRoot(requireExec(io),
|
|
26417
|
-
if (basename4(path) !== CONFIG_FILE || root !==
|
|
26776
|
+
const root = await gitRoot(requireExec(io), dirname14(path));
|
|
26777
|
+
if (basename4(path) !== CONFIG_FILE || root !== dirname14(path))
|
|
26418
26778
|
throw new UsageError("armada upgrade needs armada.toml at the selected repository's Git root; use that checkout's armada.toml");
|
|
26419
26779
|
if (credentials.armadaSignIn)
|
|
26420
26780
|
try {
|
|
@@ -26681,7 +27041,7 @@ async function inspectProcess(exec, pid, system = {
|
|
|
26681
27041
|
import { spawn as spawn2 } from "node:child_process";
|
|
26682
27042
|
import { closeSync, fstatSync, mkdirSync, mkdtempSync, openSync, readSync, rmSync } from "node:fs";
|
|
26683
27043
|
import { constants, tmpdir as tmpdir3 } from "node:os";
|
|
26684
|
-
import { dirname as
|
|
27044
|
+
import { dirname as dirname15, join as join12 } from "node:path";
|
|
26685
27045
|
var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
26686
27046
|
var spawnInherited = (command, args, { cwd, env, output }) => new Promise((done, fail) => {
|
|
26687
27047
|
const child = spawn2(command, args, { cwd, env, stdio: output ? ["inherit", "pipe", "pipe"] : "inherit" });
|
|
@@ -26719,7 +27079,7 @@ var startBackground = (args, options) => new Promise((resolve) => {
|
|
|
26719
27079
|
let log;
|
|
26720
27080
|
try {
|
|
26721
27081
|
if (options?.logPath) {
|
|
26722
|
-
mkdirSync(
|
|
27082
|
+
mkdirSync(dirname15(options.logPath), { recursive: true, mode: 448 });
|
|
26723
27083
|
log = openSync(options.logPath, "a", 384);
|
|
26724
27084
|
}
|
|
26725
27085
|
} catch {
|
|
@@ -26727,7 +27087,7 @@ var startBackground = (args, options) => new Promise((resolve) => {
|
|
|
26727
27087
|
}
|
|
26728
27088
|
const child = spawn2(process.execPath, [...process.execArgv, process.argv[1], ...args], {
|
|
26729
27089
|
cwd: process.cwd(),
|
|
26730
|
-
env: process.env,
|
|
27090
|
+
env: options?.env ?? process.env,
|
|
26731
27091
|
detached: true,
|
|
26732
27092
|
stdio: ["ignore", log ?? "ignore", log ?? "ignore", "ipc"]
|
|
26733
27093
|
});
|