mandrel 2.121.0 → 2.122.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/.agents/agents/acceptance-critic.md +1 -1
- package/.agents/instructions.md +3 -3
- package/.agents/scripts/audit-to-stories.js +21 -0
- package/.agents/scripts/lib/audit-to-stories/audit-label-taxonomy.js +7 -3
- package/.agents/scripts/lib/audit-to-stories/audit-lenses.js +18 -1
- package/.agents/scripts/lib/orchestrate/classify.js +30 -14
- package/.agents/scripts/lib/orchestrate/inventory.js +10 -6
- package/.agents/workflows/audit-to-stories.md +6 -3
- package/.agents/workflows/mandrel-orchestrate.md +4 -0
- package/.agents/workflows/memory-consolidate.md +1 -1
- package/docs/CHANGELOG.md +12 -0
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ turned in about it. Your only trusted inputs are:
|
|
|
76
76
|
into your spawn context. Do **not** re-derive the set yourself —
|
|
77
77
|
re-enumerating it can pick up commits that landed after your caller routed
|
|
78
78
|
the ceremony, and then you would be scoring a different change than the one
|
|
79
|
-
you were dispatched for
|
|
79
|
+
you were dispatched for. If no change set reached you, say so
|
|
80
80
|
in your verdict rather than substituting your own enumeration.
|
|
81
81
|
- the Story's inline `acceptance[]` and `verify[]` arrays, read from the
|
|
82
82
|
**Story body itself** (`gh issue view <storyId> --json body`) — its `##
|
package/.agents/instructions.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Execution Protocol
|
|
2
2
|
|
|
3
3
|
You operate under the Agent Execution Protocol — this instruction set
|
|
4
|
-
governs your behavior and constraints
|
|
4
|
+
governs your behavior and constraints.
|
|
5
5
|
It is a lean always-on spine: procedural detail lives in the on-demand
|
|
6
6
|
tier (§ 1.F rules,
|
|
7
7
|
[`docs/execution-reference.md`](docs/execution-reference.md), skills)
|
|
@@ -13,8 +13,8 @@ and is read when the task engages it.
|
|
|
13
13
|
|
|
14
14
|
### A. Role Framing
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Constraints come from this file, the rules, and skills; "act as
|
|
17
|
+
[role]" means apply the matching
|
|
18
18
|
skill or workflow guidance. Role-scoped spawn contexts live under
|
|
19
19
|
`.agents/agents/` (`delivery.routing.roleScopedAgents`); `qa.personas`
|
|
20
20
|
is a separate fixture concept. **Host mapping:** a `subagent_type: <role>`
|
|
@@ -10,6 +10,10 @@ import path from 'node:path';
|
|
|
10
10
|
import process from 'node:process';
|
|
11
11
|
import { pathToFileURL } from 'node:url';
|
|
12
12
|
import { parseArgs } from 'node:util';
|
|
13
|
+
import {
|
|
14
|
+
AUDIT_CUSTOM_LENS,
|
|
15
|
+
lensFromSourceReport,
|
|
16
|
+
} from './lib/audit-to-stories/audit-lenses.js';
|
|
13
17
|
import { buildStoryBody } from './lib/audit-to-stories/build-story-body.js';
|
|
14
18
|
import { classifyGroupsAgainstGitHub } from './lib/audit-to-stories/dedupe-against-github.js';
|
|
15
19
|
import { formatEpicGrouping } from './lib/audit-to-stories/epic-grouping-directive.js';
|
|
@@ -109,6 +113,22 @@ function formatTally(tally) {
|
|
|
109
113
|
return `Critical ${tally.critical} / High ${tally.high} / Medium ${tally.medium} / Low ${tally.low}`;
|
|
110
114
|
}
|
|
111
115
|
|
|
116
|
+
/**
|
|
117
|
+
* One warning per report that maps to no canonical lens, so the fallback
|
|
118
|
+
* label is visible before anything is filed.
|
|
119
|
+
*
|
|
120
|
+
* @param {Array<{ sourceReport: string }>} reports
|
|
121
|
+
* @returns {string[]}
|
|
122
|
+
*/
|
|
123
|
+
function customLensWarnings(reports) {
|
|
124
|
+
return reports
|
|
125
|
+
.filter((r) => lensFromSourceReport(r.sourceReport) === null)
|
|
126
|
+
.map(
|
|
127
|
+
(r) =>
|
|
128
|
+
`audit lens: ${r.sourceReport} names no canonical lens; its Stories carry audit::${AUDIT_CUSTOM_LENS}.`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
112
132
|
/**
|
|
113
133
|
* Cross-check the reports, warn on stderr, and throw under
|
|
114
134
|
* `failOnReportFailures` (`--auto`) BEFORE any GitHub write; `--scan`
|
|
@@ -663,6 +683,7 @@ async function buildPlan(
|
|
|
663
683
|
{ groups, useProvider, issues },
|
|
664
684
|
{ loadProviderImpl, classifyGroupsImpl, logger },
|
|
665
685
|
);
|
|
686
|
+
for (const warning of customLensWarnings(reports)) logger.warn(warning);
|
|
666
687
|
|
|
667
688
|
return {
|
|
668
689
|
generatedAt: new Date().toISOString(),
|
|
@@ -12,7 +12,11 @@ import {
|
|
|
12
12
|
TYPE_LABELS,
|
|
13
13
|
} from '../label-constants.js';
|
|
14
14
|
import { labelDescription } from '../label-taxonomy.js';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
AUDIT_CUSTOM_LENS,
|
|
17
|
+
AUDIT_LENSES,
|
|
18
|
+
auditLabelsForFindings,
|
|
19
|
+
} from './audit-lenses.js';
|
|
16
20
|
|
|
17
21
|
/** A lens absent here falls back to {@link DEFAULT_LENS_META}. */
|
|
18
22
|
const LENS_META = Object.freeze({
|
|
@@ -84,9 +88,9 @@ function hex(color) {
|
|
|
84
88
|
return String(color).replace('#', '');
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
/** Derived from the same
|
|
91
|
+
/** Derived from the same lens SSOT the generator uses. */
|
|
88
92
|
const AUDIT_LENS_LABELS = Object.freeze(
|
|
89
|
-
AUDIT_LENSES.map((name) => ({
|
|
93
|
+
[...AUDIT_LENSES, AUDIT_CUSTOM_LENS].map((name) => ({
|
|
90
94
|
name: `audit::${name}`,
|
|
91
95
|
...(LENS_META[name] ?? DEFAULT_LENS_META),
|
|
92
96
|
})),
|
|
@@ -66,13 +66,30 @@ export function lensFromSourceReport(sourceReport) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
+
* The fixed lens a non-canonical report falls back to. Not in
|
|
70
|
+
* {@link AUDIT_LENSES}: no `/audit-custom` workflow exists to iterate.
|
|
71
|
+
*/
|
|
72
|
+
export const AUDIT_CUSTOM_LENS = 'custom';
|
|
73
|
+
|
|
74
|
+
/** Canonical lens, else the fallback for any named report, else `null`. */
|
|
75
|
+
function labelLens(sourceReport) {
|
|
76
|
+
if (typeof sourceReport !== 'string' || sourceReport.length === 0) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return lensFromSourceReport(sourceReport) ?? AUDIT_CUSTOM_LENS;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The dedup corpus is listed by these labels, so a named report always yields
|
|
84
|
+
* one: a bespoke report gets `audit::custom` rather than none.
|
|
85
|
+
*
|
|
69
86
|
* @param {Array<{ sourceReport?: unknown }>} findings
|
|
70
87
|
* @returns {string[]} sorted, deduped `audit::<lens>` labels.
|
|
71
88
|
*/
|
|
72
89
|
export function auditLabelsForFindings(findings) {
|
|
73
90
|
const lenses = new Set();
|
|
74
91
|
for (const finding of findings ?? []) {
|
|
75
|
-
const lens =
|
|
92
|
+
const lens = labelLens(finding?.sourceReport);
|
|
76
93
|
if (lens) lenses.add(lens);
|
|
77
94
|
}
|
|
78
95
|
return [...lenses].sort().map((lens) => `audit::${lens}`);
|
|
@@ -14,17 +14,22 @@ const CONFLICTS_SHOWN = 10;
|
|
|
14
14
|
const BUDGET_BYTES = 16384;
|
|
15
15
|
const OVERLAPS_KEPT = 10;
|
|
16
16
|
|
|
17
|
+
/** A check that concluded and passed: done, not red, not halted. */
|
|
18
|
+
const passed = (c) => c.phase === 'done' && !c.red && !c.halted;
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Rollup over the required checks (every check when the required set is
|
|
19
|
-
* unknown). Green needs every required name present, done and not
|
|
22
|
+
* unknown). Green needs every required name present, done, not red and not
|
|
23
|
+
* halted (cancelled, stale or awaiting action).
|
|
20
24
|
*
|
|
21
|
-
* @param {Array<{ name: string, phase: string, red: boolean }>} checks
|
|
25
|
+
* @param {Array<{ name: string, phase: string, red: boolean, halted?: boolean }>} checks
|
|
22
26
|
* @param {string[]|null} required
|
|
23
27
|
*/
|
|
24
28
|
function rollup(checks, required) {
|
|
25
29
|
const want = required ? new Set(required) : null;
|
|
26
30
|
const relevant = want ? checks.filter((c) => want.has(c.name)) : checks;
|
|
27
31
|
const red = relevant.some((c) => c.red);
|
|
32
|
+
const halted = relevant.some((c) => c.halted === true);
|
|
28
33
|
const running = relevant.some((c) => c.phase === 'running');
|
|
29
34
|
const queued = relevant.some((c) => c.phase === 'queued');
|
|
30
35
|
const present = new Set(relevant.map((c) => c.name));
|
|
@@ -33,9 +38,10 @@ function rollup(checks, required) {
|
|
|
33
38
|
: relevant.length > 0;
|
|
34
39
|
return {
|
|
35
40
|
red,
|
|
41
|
+
halted,
|
|
36
42
|
running,
|
|
37
43
|
queued,
|
|
38
|
-
green: complete &&
|
|
44
|
+
green: complete && relevant.every(passed),
|
|
39
45
|
};
|
|
40
46
|
}
|
|
41
47
|
|
|
@@ -57,8 +63,8 @@ function isEjected(pr, queueReadable) {
|
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
65
|
* The first rule that holds wins: ejected, conflicted-real / -driver-only,
|
|
60
|
-
* red-inherited, red-own-failure, waiting-on-runner,
|
|
61
|
-
* stale, moving.
|
|
66
|
+
* red-inherited, red-own-failure, checks-cancelled, waiting-on-runner,
|
|
67
|
+
* green-not-queued, stale, moving.
|
|
62
68
|
*
|
|
63
69
|
* @param {object} pr normalised snapshot row
|
|
64
70
|
* @param {{ queueReadable: boolean, inheritedPrs: Set<number>,
|
|
@@ -73,12 +79,17 @@ function classifyPr(pr, ctx) {
|
|
|
73
79
|
const conflict = conflictState(pr.conflict);
|
|
74
80
|
return done(conflict.state, { conflict });
|
|
75
81
|
}
|
|
82
|
+
return done(checksState(pr, checks, ctx) ?? quietState(pr, checks, ctx));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Red outranks halted: a real failure stays the owner's to fix. */
|
|
86
|
+
function checksState(pr, checks, ctx) {
|
|
76
87
|
if (checks.red) {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
return ctx.inheritedPrs.has(pr.number)
|
|
89
|
+
? 'red-inherited'
|
|
90
|
+
: 'red-own-failure';
|
|
80
91
|
}
|
|
81
|
-
return
|
|
92
|
+
return checks.halted ? 'checks-cancelled' : null;
|
|
82
93
|
}
|
|
83
94
|
|
|
84
95
|
/** The states below red: waiting-on-runner, green-not-queued, stale, moving. */
|
|
@@ -104,11 +115,15 @@ function substitute(requeueCommand, number) {
|
|
|
104
115
|
};
|
|
105
116
|
}
|
|
106
117
|
|
|
107
|
-
function requeueOf(pr, { green, vetoHeld, requeueCommand }) {
|
|
108
|
-
const blockedBy = [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
function requeueOf(pr, { green, halted, vetoHeld, requeueCommand }) {
|
|
119
|
+
const blockedBy = [
|
|
120
|
+
[!headMoved(pr), 'head-not-moved'],
|
|
121
|
+
[!green, 'checks-not-green'],
|
|
122
|
+
[halted, 'checks-cancelled'],
|
|
123
|
+
[vetoHeld, 'release-veto'],
|
|
124
|
+
]
|
|
125
|
+
.filter(([hit]) => hit)
|
|
126
|
+
.map(([, reason]) => reason);
|
|
112
127
|
return {
|
|
113
128
|
eligible: blockedBy.length === 0,
|
|
114
129
|
blockedBy,
|
|
@@ -170,6 +185,7 @@ function prEntry(pr, verdict, opts) {
|
|
|
170
185
|
if (verdict.state === 'ejected') {
|
|
171
186
|
entry.requeue = requeueOf(pr, {
|
|
172
187
|
green: verdict.checks.green,
|
|
188
|
+
halted: verdict.checks.halted,
|
|
173
189
|
vetoHeld: vetoed && opts.vetoHeld,
|
|
174
190
|
requeueCommand: opts.requeueCommand,
|
|
175
191
|
});
|
|
@@ -10,11 +10,8 @@ import { spawnCapture } from '../child-exec.js';
|
|
|
10
10
|
import { gh as defaultGh, prTransportOf } from '../gh-exec.js';
|
|
11
11
|
import { parseApiJson } from '../gh-pr-rest.js';
|
|
12
12
|
import { gitSpawn, parseStoryBranch } from '../git-utils.js';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
readRunName,
|
|
16
|
-
redConclusionOf,
|
|
17
|
-
} from '../orchestration/merge-poll.js';
|
|
13
|
+
import { classifyRollupEntry } from '../orchestration/check-state.js';
|
|
14
|
+
import { isRunInFlight, readRunName } from '../orchestration/merge-poll.js';
|
|
18
15
|
import { parseGraphqlData } from '../orchestration/merge-queue.js';
|
|
19
16
|
import { readBaseRequiredNames } from '../orchestration/required-checks.js';
|
|
20
17
|
import { buildEnvelope } from './classify.js';
|
|
@@ -54,16 +51,23 @@ const latest = (...times) => {
|
|
|
54
51
|
return ms.length ? new Date(Math.max(...ms)).toISOString() : null;
|
|
55
52
|
};
|
|
56
53
|
|
|
54
|
+
/** Outcomes that are a real failure; the close-path merge wait reads these differently. */
|
|
55
|
+
const RED_OUTCOMES = new Set(['failure', 'timed_out']);
|
|
56
|
+
/** A run that never passed and never failed: not green, not the owner's red. */
|
|
57
|
+
const HALTED_OUTCOMES = new Set(['cancelled', 'stale', 'action_required']);
|
|
58
|
+
|
|
57
59
|
/** A rollup node (GraphQL, or REST mapped to the same shape) as a terse check. */
|
|
58
60
|
function normalizeCheck(node) {
|
|
59
61
|
const status = String(node?.status ?? '').toUpperCase();
|
|
60
62
|
let phase = 'done';
|
|
61
63
|
if (isRunInFlight(node))
|
|
62
64
|
phase = status === 'IN_PROGRESS' ? 'running' : 'queued';
|
|
65
|
+
const outcome = classifyRollupEntry(node);
|
|
63
66
|
return {
|
|
64
67
|
name: readRunName(node) ?? '',
|
|
65
68
|
phase,
|
|
66
|
-
red:
|
|
69
|
+
red: RED_OUTCOMES.has(outcome),
|
|
70
|
+
halted: HALTED_OUTCOMES.has(outcome),
|
|
67
71
|
note: node?.annotations?.nodes?.[0]?.message ?? node?.output?.title ?? null,
|
|
68
72
|
at: latest(node?.startedAt, node?.completedAt, node?.createdAt),
|
|
69
73
|
};
|
|
@@ -234,7 +234,10 @@ Labels applied:
|
|
|
234
234
|
|
|
235
235
|
- `type::story`
|
|
236
236
|
- `audit::<dimension>` — one per dimension represented in the merge
|
|
237
|
-
(cross-audit groups carry multiple).
|
|
237
|
+
(cross-audit groups carry multiple). A bespoke report whose name is not a
|
|
238
|
+
canonical lens (`audit-guard-census-results.md`) gets `audit::custom`
|
|
239
|
+
instead, so the Story stays in the label-listed dedup corpus; `--scan` warns
|
|
240
|
+
once per such report.
|
|
238
241
|
- `risk::high` — added when any finding in the group is Critical.
|
|
239
242
|
|
|
240
243
|
**No `agent::` state label, deliberately.** `agent::ready` is what
|
|
@@ -326,8 +329,8 @@ group is classified `create` and the operator is told dedupe was skipped — a
|
|
|
326
329
|
re-run opens duplicates.
|
|
327
330
|
|
|
328
331
|
**Reachable, but not through `gh`** (a cloud sandbox: no `gh`, no direct API,
|
|
329
|
-
MCP fine): fetch the corpus yourself. List every issue labelled `audit::*`
|
|
330
|
-
state `all` — `mcp__github__list_issues` or any other path — write the raw
|
|
332
|
+
MCP fine): fetch the corpus yourself. List every issue labelled `audit::*`
|
|
333
|
+
(`audit::custom` included) at state `all` — `mcp__github__list_issues` or any other path — write the raw
|
|
331
334
|
result as a JSON array, and pass it:
|
|
332
335
|
|
|
333
336
|
```bash
|
|
@@ -97,6 +97,10 @@ annotation, which the inventory already carries.
|
|
|
97
97
|
- **`green-not-queued`**: arm auto-merge only when `arm-auto-merge` is
|
|
98
98
|
granted and no release veto holds (`veto` is not `held`); otherwise raise
|
|
99
99
|
once.
|
|
100
|
+
- **`checks-cancelled`**: a required check was cancelled, went stale or
|
|
101
|
+
awaits action, so it never passed. Never arm auto-merge or requeue it, and
|
|
102
|
+
never message the owner about a failure; raise it once naming the halted
|
|
103
|
+
checks, so the operator decides whether to re-run them.
|
|
100
104
|
- **`waiting-on-runner`**: no action. Report the `runners` backlog, and hold
|
|
101
105
|
back optional load while it is saturated.
|
|
102
106
|
- **`stale`**: raise once.
|
|
@@ -103,7 +103,7 @@ the pass; nothing in the framework reads it back.
|
|
|
103
103
|
The `/mandrel-plan` Phase 0 advisory re-arms on exactly one condition:
|
|
104
104
|
`MEMORY.md` exceeding the fixed 24576-byte index ceiling —
|
|
105
105
|
the harness cap past which the index it loads is truncated. Pool size and
|
|
106
|
-
stamp age never trigger it
|
|
106
|
+
stamp age never trigger it: a pass that
|
|
107
107
|
rewrites long index lines short quiets it without pruning an entry.
|
|
108
108
|
|
|
109
109
|
Write it **only** after Gate #2 — the stamp asserts an operator reviewed the
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,18 @@ All notable changes to this project will be documented in this file.
|
|
|
15
15
|
-->
|
|
16
16
|
<!-- markdownlint-disable-file MD004 MD012 MD037 -->
|
|
17
17
|
|
|
18
|
+
## [2.122.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.121.0...mandrel-v2.122.0) (2026-11-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
* audit-to-stories: a non-canonical report's findings carry audit::custom so indexed dedup sees their Stories ([#6081](https://github.com/dsj1984/mandrel/issues/6081)) ([#6082](https://github.com/dsj1984/mandrel/issues/6082)) ([896a468](https://github.com/dsj1984/mandrel/commit/896a4687157ddd5fe4eff000b7b440c2421ed6fe))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
* orchestrate-inventory stops reporting cancelled or timed-out required checks as green ([#6084](https://github.com/dsj1984/mandrel/issues/6084)) ([#6085](https://github.com/dsj1984/mandrel/issues/6085)) ([2f1e16b](https://github.com/dsj1984/mandrel/commit/2f1e16b73cd9433ecb18a53bee43fbf4e53ebb2c))
|
|
29
|
+
|
|
18
30
|
## [2.121.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.120.0...mandrel-v2.121.0) (2026-11-12)
|
|
19
31
|
|
|
20
32
|
|
package/package.json
CHANGED