@codyswann/lisa 2.254.0 → 2.256.0
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/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-automation-status/SKILL.md +11 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-exploratory-qa/SKILL.md +30 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-intake/SKILL.md +40 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-learnings-audit/SKILL.md +46 -10
- package/plugins/lisa/.codex-plugin/skills/lisa-monitor/SKILL.md +36 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-project-ideation/SKILL.md +36 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-repair-intake/SKILL.md +34 -0
- package/plugins/lisa/scripts/automation-run-record.mjs +110 -0
- package/plugins/lisa/scripts/automation-status-claude-adapter.mjs +64 -8
- package/plugins/lisa/scripts/automation-status-codex-adapter.mjs +61 -5
- package/plugins/lisa/scripts/automation-status-report.mjs +30 -0
- package/plugins/lisa/scripts/automation-status-run-history.mjs +185 -0
- package/plugins/lisa/skills/lisa-automation-status/SKILL.md +11 -3
- package/plugins/lisa/skills/lisa-exploratory-qa/SKILL.md +30 -0
- package/plugins/lisa/skills/lisa-intake/SKILL.md +40 -0
- package/plugins/lisa/skills/lisa-learnings-audit/SKILL.md +46 -10
- package/plugins/lisa/skills/lisa-monitor/SKILL.md +36 -0
- package/plugins/lisa/skills/lisa-project-ideation/SKILL.md +36 -0
- package/plugins/lisa/skills/lisa-repair-intake/SKILL.md +34 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/automation-run-record.mjs +110 -0
- package/plugins/lisa-agy/scripts/automation-status-claude-adapter.mjs +64 -8
- package/plugins/lisa-agy/scripts/automation-status-codex-adapter.mjs +61 -5
- package/plugins/lisa-agy/scripts/automation-status-report.mjs +30 -0
- package/plugins/lisa-agy/scripts/automation-status-run-history.mjs +185 -0
- package/plugins/lisa-agy/skills/lisa-automation-status/SKILL.md +11 -3
- package/plugins/lisa-agy/skills/lisa-exploratory-qa/SKILL.md +30 -0
- package/plugins/lisa-agy/skills/lisa-intake/SKILL.md +40 -0
- package/plugins/lisa-agy/skills/lisa-learnings-audit/SKILL.md +46 -10
- package/plugins/lisa-agy/skills/lisa-monitor/SKILL.md +36 -0
- package/plugins/lisa-agy/skills/lisa-project-ideation/SKILL.md +36 -0
- package/plugins/lisa-agy/skills/lisa-repair-intake/SKILL.md +34 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/scripts/automation-run-record.mjs +110 -0
- package/plugins/lisa-copilot/scripts/automation-status-claude-adapter.mjs +64 -8
- package/plugins/lisa-copilot/scripts/automation-status-codex-adapter.mjs +61 -5
- package/plugins/lisa-copilot/scripts/automation-status-report.mjs +30 -0
- package/plugins/lisa-copilot/scripts/automation-status-run-history.mjs +185 -0
- package/plugins/lisa-copilot/skills/lisa-automation-status/SKILL.md +11 -3
- package/plugins/lisa-copilot/skills/lisa-exploratory-qa/SKILL.md +30 -0
- package/plugins/lisa-copilot/skills/lisa-intake/SKILL.md +40 -0
- package/plugins/lisa-copilot/skills/lisa-learnings-audit/SKILL.md +46 -10
- package/plugins/lisa-copilot/skills/lisa-monitor/SKILL.md +36 -0
- package/plugins/lisa-copilot/skills/lisa-project-ideation/SKILL.md +36 -0
- package/plugins/lisa-copilot/skills/lisa-repair-intake/SKILL.md +34 -0
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/scripts/automation-run-record.mjs +110 -0
- package/plugins/lisa-cursor/scripts/automation-status-claude-adapter.mjs +64 -8
- package/plugins/lisa-cursor/scripts/automation-status-codex-adapter.mjs +61 -5
- package/plugins/lisa-cursor/scripts/automation-status-report.mjs +30 -0
- package/plugins/lisa-cursor/scripts/automation-status-run-history.mjs +185 -0
- package/plugins/lisa-cursor/skills/lisa-automation-status/SKILL.md +11 -3
- package/plugins/lisa-cursor/skills/lisa-exploratory-qa/SKILL.md +30 -0
- package/plugins/lisa-cursor/skills/lisa-intake/SKILL.md +40 -0
- package/plugins/lisa-cursor/skills/lisa-learnings-audit/SKILL.md +46 -10
- package/plugins/lisa-cursor/skills/lisa-monitor/SKILL.md +36 -0
- package/plugins/lisa-cursor/skills/lisa-project-ideation/SKILL.md +36 -0
- package/plugins/lisa-cursor/skills/lisa-repair-intake/SKILL.md +34 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/scripts/automation-run-record.mjs +110 -0
- package/plugins/src/base/scripts/automation-status-claude-adapter.mjs +64 -8
- package/plugins/src/base/scripts/automation-status-codex-adapter.mjs +61 -5
- package/plugins/src/base/scripts/automation-status-report.mjs +30 -0
- package/plugins/src/base/scripts/automation-status-run-history.mjs +185 -0
- package/plugins/src/base/skills/lisa-automation-status/SKILL.md +11 -3
- package/plugins/src/base/skills/lisa-exploratory-qa/SKILL.md +30 -0
- package/plugins/src/base/skills/lisa-intake/SKILL.md +40 -0
- package/plugins/src/base/skills/lisa-learnings-audit/SKILL.md +46 -10
- package/plugins/src/base/skills/lisa-monitor/SKILL.md +36 -0
- package/plugins/src/base/skills/lisa-project-ideation/SKILL.md +36 -0
- package/plugins/src/base/skills/lisa-repair-intake/SKILL.md +34 -0
|
@@ -975,6 +975,40 @@ Report outcomes in these buckets:
|
|
|
975
975
|
State every item repaired this cycle and the action taken. If the output would be long, group by
|
|
976
976
|
bucket and show compact refs plus counts.
|
|
977
977
|
|
|
978
|
+
## Run outcome
|
|
979
|
+
|
|
980
|
+
As the registered `intake-repair` automation loop, each cycle conforms to the
|
|
981
|
+
`automation-runbook-contract` rule: it ends in **exactly one** of the six run outcomes and records it,
|
|
982
|
+
so a cycle that found nothing stuck and a cycle where the repair machinery itself broke never look
|
|
983
|
+
alike. A run outcome describes this *cycle*; the Summary-report buckets above describe *what happened
|
|
984
|
+
to each item* — the two never merge in the one-line summary.
|
|
985
|
+
|
|
986
|
+
| This cycle's exit path | Run outcome |
|
|
987
|
+
|---|---|
|
|
988
|
+
| Nothing actionable — the idle case (walk step 5): examined N, all active or in backoff | `nothing-needed` |
|
|
989
|
+
| Repairs applied **and confirmed** this cycle — `resumed` / `resynced` / `recovered` / `unblocked` / `closed_out` / `rolled_up` / `relinked` / `normalized_ready` | `change-proved` |
|
|
990
|
+
| Repair produced new work for a human to pick up — e.g. an unmergeable PR or failed deploy filed as a **build-ready fix ticket** and left `blocked` | `candidate-proposed` |
|
|
991
|
+
| A repair reached an autonomy boundary needing a human (a protected-deploy approval before it can proceed) | `approval-requested` |
|
|
992
|
+
| The loop itself could not run — the queue is unreadable or tracker credentials are revoked | `recovery-required` |
|
|
993
|
+
|
|
994
|
+
Record **exactly one** outcome per invocation through the run-record CLI, naming this loop's runbook
|
|
995
|
+
(the `--summary` is the operator-readable one-liner in the contract's exemplar voice — plain,
|
|
996
|
+
specific, actionable, e.g. `Examined 14 items; all active or in backoff — nothing to repair.` for
|
|
997
|
+
`nothing-needed`):
|
|
998
|
+
|
|
999
|
+
```bash
|
|
1000
|
+
node "${CLAUDE_PLUGIN_ROOT}/scripts/automation-run-record.mjs" \
|
|
1001
|
+
--loop-id intake-repair --outcome change-proved \
|
|
1002
|
+
--summary "Recovered 3 stalled builds and closed out 2 rollups; all confirmed." \
|
|
1003
|
+
--runbook .lisa/automations/intake-repair.runbook.md [--ref <item-url>]...
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
If `${CLAUDE_PLUGIN_ROOT}` is unset, resolve the plugin scripts directory directly — the built copy
|
|
1007
|
+
`plugins/lisa/scripts/automation-run-record.mjs` or the source
|
|
1008
|
+
`plugins/src/base/scripts/automation-run-record.mjs`. If recording still fails, **degrade, never
|
|
1009
|
+
abort** (per `automation-runbook-contract`): note the recording failure in the run output and finish
|
|
1010
|
+
the cycle — a recording failure is a degradation to report, never a reason to block the loop.
|
|
1011
|
+
|
|
978
1012
|
## Schedule examples
|
|
979
1013
|
|
|
980
1014
|
```text
|
|
@@ -260,3 +260,113 @@ async function writeJsonlAtomically(filePath, records) {
|
|
|
260
260
|
await writeFile(tempPath, content, "utf8");
|
|
261
261
|
await rename(tempPath, filePath);
|
|
262
262
|
}
|
|
263
|
+
|
|
264
|
+
const CLI_USAGE = `Usage: node automation-run-record.mjs \\
|
|
265
|
+
--loop-id <slug> --outcome <${AUTOMATION_RUN_OUTCOMES.join("|")}> \\
|
|
266
|
+
--summary "<operator-readable one-liner>" --runbook <path> \\
|
|
267
|
+
[--ref <url>]... [--run-id <id>] [--project-root <dir>]`;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Translate a repeatable-flag argv into a {@link RecordAutomationRunInput}.
|
|
271
|
+
*
|
|
272
|
+
* Every flag takes a following value; `--ref` may repeat and accumulates into
|
|
273
|
+
* `refs`. Unknown flags and value-less flags throw so a typo never silently
|
|
274
|
+
* records the wrong thing.
|
|
275
|
+
*
|
|
276
|
+
* @param {readonly string[]} argv
|
|
277
|
+
* @returns {RecordAutomationRunInput}
|
|
278
|
+
*/
|
|
279
|
+
function parseAutomationRunRecordArgv(argv) {
|
|
280
|
+
/** @type {Record<string, string>} */
|
|
281
|
+
const single = {};
|
|
282
|
+
/** @type {string[]} */
|
|
283
|
+
const refs = [];
|
|
284
|
+
const flags = {
|
|
285
|
+
"--loop-id": "loopId",
|
|
286
|
+
"--outcome": "outcome",
|
|
287
|
+
"--summary": "summary",
|
|
288
|
+
"--runbook": "runbook",
|
|
289
|
+
"--run-id": "runId",
|
|
290
|
+
"--project-root": "projectRoot",
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
294
|
+
const token = argv[index];
|
|
295
|
+
const eq = token.indexOf("=");
|
|
296
|
+
const flag = eq === -1 ? token : token.slice(0, eq);
|
|
297
|
+
const inlineValue = eq === -1 ? undefined : token.slice(eq + 1);
|
|
298
|
+
const takeValue = () => {
|
|
299
|
+
if (inlineValue !== undefined) {
|
|
300
|
+
return inlineValue;
|
|
301
|
+
}
|
|
302
|
+
index += 1;
|
|
303
|
+
if (index >= argv.length) {
|
|
304
|
+
throw new Error(`Missing value for ${flag}.`);
|
|
305
|
+
}
|
|
306
|
+
return argv[index];
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
if (flag === "--ref") {
|
|
310
|
+
refs.push(takeValue());
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
const key = flags[flag];
|
|
314
|
+
if (!key) {
|
|
315
|
+
throw new Error(`Unknown flag "${flag}".`);
|
|
316
|
+
}
|
|
317
|
+
single[key] = takeValue();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return { ...single, refs };
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Argv-driven CLI wrapper so registered loop skills can record an outcome with
|
|
325
|
+
* one portable `node …/automation-run-record.mjs --outcome …` call. Delegates
|
|
326
|
+
* validation to {@link recordAutomationRun}; surfaces its errors verbatim.
|
|
327
|
+
*
|
|
328
|
+
* @param {readonly string[]} argv
|
|
329
|
+
* @returns {Promise<number>} process exit code
|
|
330
|
+
*/
|
|
331
|
+
export async function runAutomationRunRecordCli(argv) {
|
|
332
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
333
|
+
process.stdout.write(`${CLI_USAGE}\n`);
|
|
334
|
+
return 0;
|
|
335
|
+
}
|
|
336
|
+
let input;
|
|
337
|
+
try {
|
|
338
|
+
input = parseAutomationRunRecordArgv(argv);
|
|
339
|
+
} catch (error) {
|
|
340
|
+
process.stderr.write(`${error.message}\n\n${CLI_USAGE}\n`);
|
|
341
|
+
return 2;
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const result = await recordAutomationRun(input);
|
|
345
|
+
process.stdout.write(
|
|
346
|
+
`${JSON.stringify({
|
|
347
|
+
path: result.path,
|
|
348
|
+
appended: result.appended,
|
|
349
|
+
outcome: result.record.outcome,
|
|
350
|
+
loop_id: result.record.loop_id,
|
|
351
|
+
run_id: result.record.run_id,
|
|
352
|
+
})}\n`
|
|
353
|
+
);
|
|
354
|
+
return 0;
|
|
355
|
+
} catch (error) {
|
|
356
|
+
process.stderr.write(`${error.message}\n`);
|
|
357
|
+
return 1;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// CLI entrypoint.
|
|
362
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
363
|
+
runAutomationRunRecordCli(process.argv.slice(2)).then(
|
|
364
|
+
code => {
|
|
365
|
+
process.exitCode = code;
|
|
366
|
+
},
|
|
367
|
+
error => {
|
|
368
|
+
process.stderr.write(`${error?.message ?? error}\n`);
|
|
369
|
+
process.exitCode = 1;
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
@@ -15,6 +15,10 @@ import {
|
|
|
15
15
|
createAutomationGroupBins,
|
|
16
16
|
renderAutomationGroups,
|
|
17
17
|
} from "./automation-status-expected-fleet.mjs";
|
|
18
|
+
import {
|
|
19
|
+
resolveAutomationRunDisplay,
|
|
20
|
+
resolveRecoveryEscalation,
|
|
21
|
+
} from "./automation-status-run-history.mjs";
|
|
18
22
|
|
|
19
23
|
const CLAUDE_RUNTIME_LABEL = "Claude /schedule";
|
|
20
24
|
const CLAUDE_ACTIVE_STATUSES = new Set([
|
|
@@ -51,9 +55,10 @@ const NEGATED_FAILURE_PATTERN =
|
|
|
51
55
|
* @param {{
|
|
52
56
|
* readonly expectedFleet: ExpectedFleet
|
|
53
57
|
* readonly scheduleListing?: string | readonly unknown[] | Record<string, unknown> | null
|
|
58
|
+
* readonly projectRoot?: string
|
|
54
59
|
* readonly now?: string | Date
|
|
55
60
|
* }} input
|
|
56
|
-
* @returns {{
|
|
61
|
+
* @returns {Promise<{
|
|
57
62
|
* readonly runtime: string
|
|
58
63
|
* readonly generatedAt: string
|
|
59
64
|
* readonly groups: readonly {
|
|
@@ -66,20 +71,27 @@ const NEGATED_FAILURE_PATTERN =
|
|
|
66
71
|
* readonly expectedCadence?: string
|
|
67
72
|
* readonly expectedCommand?: string
|
|
68
73
|
* readonly observed?: string
|
|
74
|
+
* readonly runbook?: string
|
|
75
|
+
* readonly lastOutcome?: { readonly ts: string, readonly outcome: string, readonly summary: string }
|
|
76
|
+
* readonly outcomeHistory?: readonly string[]
|
|
77
|
+
* readonly olderRecordCount?: number
|
|
69
78
|
* readonly remediation?: string
|
|
70
79
|
* }[]
|
|
71
80
|
* }[]
|
|
72
81
|
* readonly observedAutomations: readonly ObservedClaudeAutomation[]
|
|
73
|
-
* }}
|
|
82
|
+
* }>}
|
|
74
83
|
*/
|
|
75
|
-
export function inspectClaudeAutomationFleet(input) {
|
|
84
|
+
export async function inspectClaudeAutomationFleet(input) {
|
|
76
85
|
const expectedFleet = input.expectedFleet;
|
|
77
86
|
const now = normalizeDate(input.now);
|
|
87
|
+
const projectRoot = input.projectRoot ?? process.cwd();
|
|
78
88
|
const observedAutomations = listClaudeAutomations({
|
|
79
89
|
scheduleListing: input.scheduleListing,
|
|
80
90
|
automationPrefix: expectedFleet.automationPrefix,
|
|
81
91
|
});
|
|
82
92
|
|
|
93
|
+
const runDisplays = await resolveFleetRunDisplays(projectRoot, expectedFleet);
|
|
94
|
+
|
|
83
95
|
const expectedGroups = createAutomationGroupBins();
|
|
84
96
|
|
|
85
97
|
const comparisons = compareAutomationFleet({
|
|
@@ -96,17 +108,23 @@ export function inspectClaudeAutomationFleet(input) {
|
|
|
96
108
|
expected,
|
|
97
109
|
comparison,
|
|
98
110
|
now,
|
|
111
|
+
runDisplay: runDisplays.get(expected.id),
|
|
99
112
|
})
|
|
100
113
|
);
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
for (const unsupported of expectedFleet.unsupported) {
|
|
117
|
+
const runDisplay = runDisplays.get(unsupported.id);
|
|
104
118
|
assignToAutomationGroup(expectedGroups, unsupported.group, {
|
|
105
119
|
id: unsupported.automationId,
|
|
106
120
|
status: "UNSUPPORTED",
|
|
107
121
|
summary: unsupported.reason,
|
|
108
122
|
expectedCadence: unsupported.expectedCadence,
|
|
109
123
|
observed: "No automation is expected for this repo/runtime combination.",
|
|
124
|
+
runbook: runDisplay?.runbook,
|
|
125
|
+
lastOutcome: runDisplay?.lastOutcome,
|
|
126
|
+
outcomeHistory: runDisplay?.outcomeHistory,
|
|
127
|
+
olderRecordCount: runDisplay?.olderRecordCount,
|
|
110
128
|
});
|
|
111
129
|
}
|
|
112
130
|
|
|
@@ -195,15 +213,43 @@ function extractClaudeScheduleCadence(command) {
|
|
|
195
213
|
);
|
|
196
214
|
}
|
|
197
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Read the read-only run-history display for every expected and unsupported
|
|
218
|
+
* loop up front, keyed by the loop's short id, so the per-entry item builder
|
|
219
|
+
* stays synchronous.
|
|
220
|
+
*
|
|
221
|
+
* @param {string} projectRoot
|
|
222
|
+
* @param {ExpectedFleet} expectedFleet
|
|
223
|
+
* @returns {Promise<Map<string, import("./automation-status-run-history.mjs").AutomationRunDisplay>>}
|
|
224
|
+
*/
|
|
225
|
+
async function resolveFleetRunDisplays(projectRoot, expectedFleet) {
|
|
226
|
+
const entries = [...expectedFleet.expected, ...expectedFleet.unsupported];
|
|
227
|
+
const displays = await Promise.all(
|
|
228
|
+
entries.map(entry =>
|
|
229
|
+
resolveAutomationRunDisplay({
|
|
230
|
+
projectRoot,
|
|
231
|
+
loopId: entry.id,
|
|
232
|
+
runbookPath: entry.runbookPath,
|
|
233
|
+
})
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
return new Map(entries.map((entry, index) => [entry.id, displays[index]]));
|
|
237
|
+
}
|
|
238
|
+
|
|
198
239
|
function createObservedStatusItem(input) {
|
|
199
240
|
const expected = input.expected;
|
|
200
241
|
const comparison = input.comparison;
|
|
201
242
|
const observed = comparison.observedAutomation;
|
|
243
|
+
const runDisplay = input.runDisplay;
|
|
202
244
|
const runSignal = classifyAutomationRunSignal({
|
|
203
245
|
expected,
|
|
204
246
|
observedAutomation: observed,
|
|
205
247
|
now: input.now,
|
|
206
248
|
});
|
|
249
|
+
// Three or more consecutive recorded recovery-required runs flip the loop to
|
|
250
|
+
// FAILING even when the /schedule entry looks fine — the fleet-health signal
|
|
251
|
+
// the scheduler surface cannot see. It wins over the scheduler run-signal.
|
|
252
|
+
const escalation = resolveRecoveryEscalation(runDisplay);
|
|
207
253
|
|
|
208
254
|
const observedDetails = [comparison.observed];
|
|
209
255
|
if (observed?.status) {
|
|
@@ -223,20 +269,30 @@ function createObservedStatusItem(input) {
|
|
|
223
269
|
}
|
|
224
270
|
|
|
225
271
|
const status =
|
|
272
|
+
escalation?.status ??
|
|
226
273
|
runSignal?.status ??
|
|
227
274
|
/** @type {"HEALTHY" | "MISSING" | "DRIFTED"} */ (comparison.status);
|
|
228
275
|
|
|
229
276
|
return {
|
|
230
277
|
id: expected.automationId,
|
|
231
278
|
status,
|
|
232
|
-
summary:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
279
|
+
summary: escalation
|
|
280
|
+
? escalation.summary
|
|
281
|
+
: composeAutomationSummary({
|
|
282
|
+
comparison,
|
|
283
|
+
runSignal,
|
|
284
|
+
}),
|
|
236
285
|
expectedCadence: expected.expectedCadence,
|
|
237
286
|
expectedCommand: expected.expectedCommand,
|
|
238
287
|
observed: observedDetails.join(" "),
|
|
239
|
-
|
|
288
|
+
runbook: runDisplay?.runbook,
|
|
289
|
+
lastOutcome: runDisplay?.lastOutcome,
|
|
290
|
+
outcomeHistory: runDisplay?.outcomeHistory,
|
|
291
|
+
olderRecordCount: runDisplay?.olderRecordCount,
|
|
292
|
+
remediation:
|
|
293
|
+
escalation?.remediation ??
|
|
294
|
+
runSignal?.remediation ??
|
|
295
|
+
comparison.remediation,
|
|
240
296
|
};
|
|
241
297
|
}
|
|
242
298
|
|
|
@@ -22,6 +22,10 @@ import {
|
|
|
22
22
|
createAutomationGroupBins,
|
|
23
23
|
renderAutomationGroups,
|
|
24
24
|
} from "./automation-status-expected-fleet.mjs";
|
|
25
|
+
import {
|
|
26
|
+
resolveAutomationRunDisplay,
|
|
27
|
+
resolveRecoveryEscalation,
|
|
28
|
+
} from "./automation-status-run-history.mjs";
|
|
25
29
|
|
|
26
30
|
const CODEx_RUNTIME_LABEL = "Codex automations";
|
|
27
31
|
const RUN_TIMESTAMP_PATTERN = /20\d{2}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?Z/;
|
|
@@ -132,6 +136,7 @@ async function execGitWithRetry(args, options, attempts = 4) {
|
|
|
132
136
|
* @param {{
|
|
133
137
|
* readonly expectedFleet: ExpectedFleet
|
|
134
138
|
* readonly automationsDir?: string
|
|
139
|
+
* readonly projectRoot?: string
|
|
135
140
|
* readonly now?: string | Date
|
|
136
141
|
* }} input
|
|
137
142
|
* @returns {Promise<{
|
|
@@ -147,6 +152,10 @@ async function execGitWithRetry(args, options, attempts = 4) {
|
|
|
147
152
|
* readonly expectedCadence?: string
|
|
148
153
|
* readonly expectedCommand?: string
|
|
149
154
|
* readonly observed?: string
|
|
155
|
+
* readonly runbook?: string
|
|
156
|
+
* readonly lastOutcome?: { readonly ts: string, readonly outcome: string, readonly summary: string }
|
|
157
|
+
* readonly outcomeHistory?: readonly string[]
|
|
158
|
+
* readonly olderRecordCount?: number
|
|
150
159
|
* readonly remediation?: string
|
|
151
160
|
* }[]
|
|
152
161
|
* }[]
|
|
@@ -156,11 +165,14 @@ async function execGitWithRetry(args, options, attempts = 4) {
|
|
|
156
165
|
export async function inspectCodexAutomationFleet(input) {
|
|
157
166
|
const expectedFleet = input.expectedFleet;
|
|
158
167
|
const now = normalizeDate(input.now);
|
|
168
|
+
const projectRoot = input.projectRoot ?? process.cwd();
|
|
159
169
|
const observedAutomations = await listCodexAutomations({
|
|
160
170
|
automationsDir: input.automationsDir,
|
|
161
171
|
automationPrefix: expectedFleet.automationPrefix,
|
|
162
172
|
});
|
|
163
173
|
|
|
174
|
+
const runDisplays = await resolveFleetRunDisplays(projectRoot, expectedFleet);
|
|
175
|
+
|
|
164
176
|
const expectedGroups = createAutomationGroupBins();
|
|
165
177
|
|
|
166
178
|
const comparisons = compareAutomationFleet({
|
|
@@ -177,17 +189,23 @@ export async function inspectCodexAutomationFleet(input) {
|
|
|
177
189
|
expected,
|
|
178
190
|
comparison,
|
|
179
191
|
now,
|
|
192
|
+
runDisplay: runDisplays.get(expected.id),
|
|
180
193
|
})
|
|
181
194
|
);
|
|
182
195
|
}
|
|
183
196
|
|
|
184
197
|
for (const unsupported of expectedFleet.unsupported) {
|
|
198
|
+
const runDisplay = runDisplays.get(unsupported.id);
|
|
185
199
|
assignToAutomationGroup(expectedGroups, unsupported.group, {
|
|
186
200
|
id: unsupported.automationId,
|
|
187
201
|
status: "UNSUPPORTED",
|
|
188
202
|
summary: unsupported.reason,
|
|
189
203
|
expectedCadence: unsupported.expectedCadence,
|
|
190
204
|
observed: "No automation is expected for this repo/runtime combination.",
|
|
205
|
+
runbook: runDisplay?.runbook,
|
|
206
|
+
lastOutcome: runDisplay?.lastOutcome,
|
|
207
|
+
outcomeHistory: runDisplay?.outcomeHistory,
|
|
208
|
+
olderRecordCount: runDisplay?.olderRecordCount,
|
|
191
209
|
});
|
|
192
210
|
}
|
|
193
211
|
|
|
@@ -374,15 +392,43 @@ async function readCodexAutomation(automationDir) {
|
|
|
374
392
|
};
|
|
375
393
|
}
|
|
376
394
|
|
|
395
|
+
/**
|
|
396
|
+
* Read the read-only run-history display for every expected and unsupported
|
|
397
|
+
* loop up front, keyed by the loop's short id, so the per-entry item builder
|
|
398
|
+
* stays synchronous.
|
|
399
|
+
*
|
|
400
|
+
* @param {string} projectRoot
|
|
401
|
+
* @param {ExpectedFleet} expectedFleet
|
|
402
|
+
* @returns {Promise<Map<string, import("./automation-status-run-history.mjs").AutomationRunDisplay>>}
|
|
403
|
+
*/
|
|
404
|
+
async function resolveFleetRunDisplays(projectRoot, expectedFleet) {
|
|
405
|
+
const entries = [...expectedFleet.expected, ...expectedFleet.unsupported];
|
|
406
|
+
const displays = await Promise.all(
|
|
407
|
+
entries.map(entry =>
|
|
408
|
+
resolveAutomationRunDisplay({
|
|
409
|
+
projectRoot,
|
|
410
|
+
loopId: entry.id,
|
|
411
|
+
runbookPath: entry.runbookPath,
|
|
412
|
+
})
|
|
413
|
+
)
|
|
414
|
+
);
|
|
415
|
+
return new Map(entries.map((entry, index) => [entry.id, displays[index]]));
|
|
416
|
+
}
|
|
417
|
+
|
|
377
418
|
function createObservedStatusItem(input) {
|
|
378
419
|
const expected = input.expected;
|
|
379
420
|
const comparison = input.comparison;
|
|
380
421
|
const observed = comparison.observedAutomation;
|
|
422
|
+
const runDisplay = input.runDisplay;
|
|
381
423
|
const runSignal = classifyAutomationRunSignal({
|
|
382
424
|
expected,
|
|
383
425
|
observedAutomation: observed,
|
|
384
426
|
now: input.now,
|
|
385
427
|
});
|
|
428
|
+
// Three or more consecutive recorded recovery-required runs flip the loop to
|
|
429
|
+
// FAILING even when the scheduler entry looks fine — the fleet-health signal
|
|
430
|
+
// the raw backing store cannot see. It wins over the scheduler run-signal.
|
|
431
|
+
const escalation = resolveRecoveryEscalation(runDisplay);
|
|
386
432
|
|
|
387
433
|
const observedDetails = [comparison.observed];
|
|
388
434
|
if (observed?.status) {
|
|
@@ -401,20 +447,30 @@ function createObservedStatusItem(input) {
|
|
|
401
447
|
}
|
|
402
448
|
|
|
403
449
|
const status =
|
|
450
|
+
escalation?.status ??
|
|
404
451
|
runSignal?.status ??
|
|
405
452
|
/** @type {"HEALTHY" | "MISSING" | "DRIFTED"} */ (comparison.status);
|
|
406
453
|
|
|
407
454
|
return {
|
|
408
455
|
id: expected.automationId,
|
|
409
456
|
status,
|
|
410
|
-
summary:
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
457
|
+
summary: escalation
|
|
458
|
+
? escalation.summary
|
|
459
|
+
: composeAutomationSummary({
|
|
460
|
+
comparison,
|
|
461
|
+
runSignal,
|
|
462
|
+
}),
|
|
414
463
|
expectedCadence: expected.expectedCadence,
|
|
415
464
|
expectedCommand: expected.expectedCommand,
|
|
416
465
|
observed: observedDetails.join(" "),
|
|
417
|
-
|
|
466
|
+
runbook: runDisplay?.runbook,
|
|
467
|
+
lastOutcome: runDisplay?.lastOutcome,
|
|
468
|
+
outcomeHistory: runDisplay?.outcomeHistory,
|
|
469
|
+
olderRecordCount: runDisplay?.olderRecordCount,
|
|
470
|
+
remediation:
|
|
471
|
+
escalation?.remediation ??
|
|
472
|
+
runSignal?.remediation ??
|
|
473
|
+
comparison.remediation,
|
|
418
474
|
};
|
|
419
475
|
}
|
|
420
476
|
|
|
@@ -26,12 +26,22 @@ export const AUTOMATION_FLEET_VERDICTS = [
|
|
|
26
26
|
* @typedef {"HEALTHY" | "PARTIAL_SUPPORT" | "ATTENTION_NEEDED"} AutomationFleetVerdict
|
|
27
27
|
*
|
|
28
28
|
* @typedef {{
|
|
29
|
+
* readonly ts: string
|
|
30
|
+
* readonly outcome: string
|
|
31
|
+
* readonly summary: string
|
|
32
|
+
* }} AutomationLastOutcome
|
|
33
|
+
*
|
|
34
|
+
* @typedef {{
|
|
29
35
|
* readonly id: string
|
|
30
36
|
* readonly status: AutomationHealthStatus
|
|
31
37
|
* readonly summary: string
|
|
32
38
|
* readonly expectedCadence?: string
|
|
33
39
|
* readonly expectedCommand?: string
|
|
34
40
|
* readonly observed?: string
|
|
41
|
+
* readonly runbook?: string
|
|
42
|
+
* readonly lastOutcome?: AutomationLastOutcome
|
|
43
|
+
* readonly outcomeHistory?: readonly string[]
|
|
44
|
+
* readonly olderRecordCount?: number
|
|
35
45
|
* readonly remediation?: string
|
|
36
46
|
* }} AutomationStatusItem
|
|
37
47
|
*
|
|
@@ -130,6 +140,26 @@ export function renderAutomationStatusReport(input) {
|
|
|
130
140
|
if (item.observed) {
|
|
131
141
|
lines.push(` Observed: ${item.observed}`);
|
|
132
142
|
}
|
|
143
|
+
// Contract + run-history block: observable facts about where the runbook
|
|
144
|
+
// lives and how recent runs ended, kept between Observed and Remediation
|
|
145
|
+
// so operators read the state before the fix. Every line degrades
|
|
146
|
+
// explicitly — an absent runbook or empty history is stated, never blank.
|
|
147
|
+
if (item.runbook !== undefined) {
|
|
148
|
+
lines.push(` Runbook: ${item.runbook}`);
|
|
149
|
+
lines.push(
|
|
150
|
+
item.lastOutcome
|
|
151
|
+
? ` Last run: ${item.lastOutcome.outcome} — ${item.lastOutcome.summary} (${item.lastOutcome.ts})`
|
|
152
|
+
: " Last run: no recorded runs yet"
|
|
153
|
+
);
|
|
154
|
+
if (item.outcomeHistory && item.outcomeHistory.length > 0) {
|
|
155
|
+
const historyLine = ` History: ${item.outcomeHistory.join(", ")} (newest first)`;
|
|
156
|
+
lines.push(
|
|
157
|
+
item.olderRecordCount && item.olderRecordCount > 0
|
|
158
|
+
? `${historyLine}; … and ${item.olderRecordCount} older records`
|
|
159
|
+
: historyLine
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
133
163
|
if (item.remediation) {
|
|
134
164
|
lines.push(` Remediation: ${item.remediation}`);
|
|
135
165
|
}
|