mandrel 2.122.0 → 2.124.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/README.md +1 -1
- package/.agents/docs/agentrc-reference.json +1 -0
- package/.agents/docs/configuration.md +10 -7
- package/.agents/runtime-deps.json +2 -2
- package/.agents/schemas/agentrc.schema.json +26 -4
- package/.agents/schemas/audit-rules.schema.json +1 -1
- package/.agents/schemas/story-deliver-terminal.schema.json +7 -2
- package/.agents/scripts/check-doc-links.js +4 -4
- package/.agents/scripts/lib/audit-baselines/surface-entry.js +2 -2
- package/.agents/scripts/lib/audit-exceptions/globs.js +2 -2
- package/.agents/scripts/lib/audit-exceptions/scope.js +2 -2
- package/.agents/scripts/lib/audit-suite/selector.js +3 -3
- package/.agents/scripts/lib/baselines/bundle-size-scorer.js +3 -3
- package/.agents/scripts/lib/baselines/components.js +2 -2
- package/.agents/scripts/lib/baselines/kinds/_crap-new-method-gate.js +2 -2
- package/.agents/scripts/lib/bdd-runner-detect.js +3 -4
- package/.agents/scripts/lib/close-validation/base-sync-revalidation.js +2 -2
- package/.agents/scripts/lib/close-validation/gates.js +16 -3
- package/.agents/scripts/lib/close-validation/test-delta.js +9 -4
- package/.agents/scripts/lib/config/gates/coverage.schema.js +2 -2
- package/.agents/scripts/lib/config/handoff.js +21 -6
- package/.agents/scripts/lib/config-settings-schema-delivery.js +19 -10
- package/.agents/scripts/lib/config-settings-schema-quality.js +1 -1
- package/.agents/scripts/lib/coverage-baseline.js +8 -4
- package/.agents/scripts/lib/coverage-capture-delta.js +2 -2
- package/.agents/scripts/lib/coverage-capture-own-fix.js +2 -2
- package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
- package/.agents/scripts/lib/git-test-guard.js +119 -0
- package/.agents/scripts/lib/git-utils.js +3 -0
- package/.agents/scripts/lib/maintainability-utils.js +4 -4
- package/.agents/scripts/lib/observability/handoff-telemetry.js +2 -0
- package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +3 -2
- package/.agents/scripts/lib/orchestration/block-class-recovery.js +44 -0
- package/.agents/scripts/lib/orchestration/code-review.js +35 -19
- package/.agents/scripts/lib/orchestration/diff-magnitude.js +1 -1
- package/.agents/scripts/lib/orchestration/git-cleanup/phases/filters.js +3 -3
- package/.agents/scripts/lib/orchestration/handoff-suite-of-record.js +15 -7
- package/.agents/scripts/lib/orchestration/merge-queue.js +36 -10
- package/.agents/scripts/lib/orchestration/plan-persist/audit-attribution.js +3 -4
- package/.agents/scripts/lib/orchestration/review-history.js +9 -10
- package/.agents/scripts/lib/orchestration/review-providers/code-review.js +9 -2
- package/.agents/scripts/lib/orchestration/review-providers/codex-cli.js +8 -5
- package/.agents/scripts/lib/orchestration/review-providers/codex.js +3 -11
- package/.agents/scripts/lib/orchestration/review-providers/mi-exemptions.js +2 -2
- package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +22 -0
- package/.agents/scripts/lib/orchestration/review-providers/security-review.js +10 -2
- package/.agents/scripts/lib/orchestration/review-providers/types.js +2 -0
- package/.agents/scripts/lib/orchestration/review-providers/ultrareview.js +13 -2
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +40 -15
- package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +8 -1
- package/.agents/scripts/lib/orchestration/story-handoff.js +216 -54
- package/.agents/scripts/lib/test-temp.js +5 -5
- package/.agents/scripts/lib/test-tiers.js +3 -3
- package/.agents/scripts/lib/util/glob-match.js +64 -0
- package/.agents/scripts/lib/wave-runner/footprint.js +3 -3
- package/.agents/scripts/run-tests.js +2 -1
- package/.agents/scripts/single-story-init.js +3 -3
- package/.agents/workflows/helpers/code-review.md +8 -1
- package/.agents/workflows/helpers/deliver-digest.md +23 -24
- package/.agents/workflows/helpers/deliver-reference.md +62 -26
- package/.agents/workflows/helpers/deliver-story-reference.md +10 -3
- package/.agents/workflows/helpers/deliver-story.md +27 -7
- package/.agents/workflows/mandrel-deliver.md +8 -2
- package/docs/CHANGELOG.md +23 -0
- package/package.json +2 -2
|
@@ -20,7 +20,10 @@ import { resolveConfig } from '../../config-resolver.js';
|
|
|
20
20
|
import { STRICT_CLAIM_SCHEMA } from './claim-grounding.js';
|
|
21
21
|
import { BUG_CLASS_RULE } from './parse-findings.js';
|
|
22
22
|
import { PROVIDER_SEVERITY_MAP } from './provider-severity.js';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
renderDepthDirective,
|
|
25
|
+
renderExhaustiveDirective,
|
|
26
|
+
} from './review-depth.js';
|
|
24
27
|
import { renderGuidanceBlock } from './review-guidance.js';
|
|
25
28
|
|
|
26
29
|
const PROBE_TIMEOUT_MS = 5000;
|
|
@@ -109,14 +112,14 @@ export function defaultProbeCodexCommand(opts = {}) {
|
|
|
109
112
|
|
|
110
113
|
/**
|
|
111
114
|
* @param {{ baseRef: string, headRef: string, depth?: ReviewDepth,
|
|
112
|
-
* guidance?: string|null }} args
|
|
115
|
+
* exhaustive?: boolean, guidance?: string|null }} args
|
|
113
116
|
* @returns {string}
|
|
114
117
|
*/
|
|
115
|
-
function buildReviewPrompt({ baseRef, headRef, depth, guidance }) {
|
|
118
|
+
function buildReviewPrompt({ baseRef, headRef, depth, exhaustive, guidance }) {
|
|
116
119
|
return (
|
|
117
120
|
`Review the code changes in the git diff \`${baseRef}...${headRef}\` ` +
|
|
118
121
|
`of this repository (run \`git diff ${baseRef}...${headRef}\` to read ` +
|
|
119
|
-
`it). ${renderDepthDirective(depth)}\n\n` +
|
|
122
|
+
`it). ${renderDepthDirective(depth)}${renderExhaustiveDirective(exhaustive)}\n\n` +
|
|
120
123
|
'Report correctness, security, reliability and maintainability problems ' +
|
|
121
124
|
'the change introduces. For each one give the file and line in the new ' +
|
|
122
125
|
'version when attributable (otherwise null), a short title, a markdown ' +
|
|
@@ -146,7 +149,7 @@ function readIfPresent(file) {
|
|
|
146
149
|
* file becomes `stdout`.
|
|
147
150
|
*
|
|
148
151
|
* @param {{ baseRef: string, headRef: string, depth?: ReviewDepth,
|
|
149
|
-
* guidance?: string|null }} args
|
|
152
|
+
* exhaustive?: boolean, guidance?: string|null }} args
|
|
150
153
|
* @param {{ run?: Function, tempRoot?: string, cwd?: string }} [deps]
|
|
151
154
|
* @returns {Promise<InvokeResult>}
|
|
152
155
|
*/
|
|
@@ -66,7 +66,7 @@ export function parseCodexFindings(rawOutput) {
|
|
|
66
66
|
/**
|
|
67
67
|
* @param {{
|
|
68
68
|
* probeFn?: () => boolean,
|
|
69
|
-
* invokeFn?: (
|
|
69
|
+
* invokeFn?: (input: ReviewInput) => { status: number, stdout: string, stderr: string } | Promise<{ status: number, stdout: string, stderr: string }>,
|
|
70
70
|
* logger?: { info?: Function, warn?: Function, error?: Function },
|
|
71
71
|
* }} [deps]
|
|
72
72
|
* @returns {ReviewProvider}
|
|
@@ -86,8 +86,7 @@ export function createCodexProvider(deps = {}) {
|
|
|
86
86
|
* @returns {Promise<Finding[]>}
|
|
87
87
|
*/
|
|
88
88
|
async runReview(input) {
|
|
89
|
-
const { scope, ticketId, baseRef, headRef
|
|
90
|
-
input ?? {};
|
|
89
|
+
const { scope, ticketId, baseRef, headRef } = input ?? {};
|
|
91
90
|
if (!baseRef || !headRef) {
|
|
92
91
|
throw new TypeError(
|
|
93
92
|
'[codex-review] runReview requires baseRef and headRef.',
|
|
@@ -104,14 +103,7 @@ export function createCodexProvider(deps = {}) {
|
|
|
104
103
|
`for ${scope} #${ticketId}...`,
|
|
105
104
|
);
|
|
106
105
|
|
|
107
|
-
const result = await invokeFn(
|
|
108
|
-
baseRef,
|
|
109
|
-
headRef,
|
|
110
|
-
scope,
|
|
111
|
-
ticketId,
|
|
112
|
-
depth,
|
|
113
|
-
guidance,
|
|
114
|
-
});
|
|
106
|
+
const result = await invokeFn(input);
|
|
115
107
|
if (result.status !== 0) {
|
|
116
108
|
throw new Error(
|
|
117
109
|
`[codex-review] codex exec exited with status ${result.status}: ${
|
|
@@ -13,7 +13,7 @@ import { isIgnoredByGlobs } from '../../maintainability-utils.js';
|
|
|
13
13
|
* scoring nothing would silently retire the dimension.
|
|
14
14
|
*
|
|
15
15
|
* @param {{ resolveConfigFn?: typeof resolveConfig, getQualityFn?: typeof getQuality }} [deps]
|
|
16
|
-
* @returns {string[]}
|
|
16
|
+
* @returns {string[]} glob patterns; `[]` when unset or unresolvable.
|
|
17
17
|
*/
|
|
18
18
|
export function resolveMaintainabilityIgnoreGlobs({
|
|
19
19
|
resolveConfigFn = resolveConfig,
|
|
@@ -29,7 +29,7 @@ export function resolveMaintainabilityIgnoreGlobs({
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Matches through `isIgnoredByGlobs`, the same rule the baseline uses; a
|
|
32
|
-
* local
|
|
32
|
+
* local glob matcher would let the two surfaces disagree.
|
|
33
33
|
*
|
|
34
34
|
* @param {string[]} files
|
|
35
35
|
* @param {string[]} ignoreGlobs
|
|
@@ -25,6 +25,18 @@ const DEPTH_DIRECTIVES = Object.freeze({
|
|
|
25
25
|
'signature or shape.',
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Follows the depth directive on a Story's first review pass, so it leads with
|
|
30
|
+
* a space; see `BUG_CLASS_RULE`.
|
|
31
|
+
*/
|
|
32
|
+
const EXHAUSTIVE_DIRECTIVE =
|
|
33
|
+
' This is the first review of this Story: make it exhaustive. Enumerate ' +
|
|
34
|
+
'every defect class you raise. For each class, sweep every changed file ' +
|
|
35
|
+
'for every instance before returning, and report them all in that ' +
|
|
36
|
+
"finding's `instances`. For an access-control, authorization or " +
|
|
37
|
+
'role-narrowing class, check every read, write and response path the ' +
|
|
38
|
+
'diff adds.';
|
|
39
|
+
|
|
28
40
|
/**
|
|
29
41
|
* Anything unrecognised, including `undefined`, is `standard`.
|
|
30
42
|
*
|
|
@@ -44,3 +56,13 @@ export function normalizeDepth(depth) {
|
|
|
44
56
|
export function renderDepthDirective(depth) {
|
|
45
57
|
return DEPTH_DIRECTIVES[normalizeDepth(depth)];
|
|
46
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* `EXHAUSTIVE_DIRECTIVE` on a first pass; otherwise empty.
|
|
62
|
+
*
|
|
63
|
+
* @param {boolean|undefined} exhaustive
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
export function renderExhaustiveDirective(exhaustive) {
|
|
67
|
+
return exhaustive ? EXHAUSTIVE_DIRECTIVE : '';
|
|
68
|
+
}
|
|
@@ -13,7 +13,10 @@ import { spawnSync } from 'node:child_process';
|
|
|
13
13
|
import { resolveAgentrcRoot } from '../../config/git-roots.js';
|
|
14
14
|
import { BUG_CLASS_RULE, parseProviderFindings } from './parse-findings.js';
|
|
15
15
|
import { PROVIDER_SEVERITY_MAP } from './provider-severity.js';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
renderDepthDirective,
|
|
18
|
+
renderExhaustiveDirective,
|
|
19
|
+
} from './review-depth.js';
|
|
17
20
|
import { renderGuidanceBlock } from './review-guidance.js';
|
|
18
21
|
|
|
19
22
|
export const SECURITY_REVIEW_REMEDIATIONS = Object.freeze({
|
|
@@ -122,7 +125,11 @@ export function buildSecurityReviewPrompt(input) {
|
|
|
122
125
|
.replace('{headRef}', headRef)
|
|
123
126
|
.replace('{scopeLabel}', scopeLabel)
|
|
124
127
|
.replace('{ticketId}', ticketId)
|
|
125
|
-
.replace(
|
|
128
|
+
.replace(
|
|
129
|
+
'{depthDirective}',
|
|
130
|
+
renderDepthDirective(input?.depth) +
|
|
131
|
+
renderExhaustiveDirective(input?.exhaustive),
|
|
132
|
+
)
|
|
126
133
|
.replace('{guidance}', () => renderGuidanceBlock(input?.guidance));
|
|
127
134
|
}
|
|
128
135
|
|
|
@@ -211,6 +218,7 @@ export function createSecurityReviewProvider(deps = {}) {
|
|
|
211
218
|
baseRef,
|
|
212
219
|
headRef,
|
|
213
220
|
depth: input.depth,
|
|
221
|
+
exhaustive: input.exhaustive,
|
|
214
222
|
guidance: input.guidance,
|
|
215
223
|
});
|
|
216
224
|
if (result.status !== 0) {
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
* providers MUST render it into their prompt. Absent → `standard`.
|
|
41
41
|
* @property {string=} effort - `claude --effort` level resolved from `depth`;
|
|
42
42
|
* absent → `low`.
|
|
43
|
+
* @property {boolean=} exhaustive - The Story's first review pass; LLM-backed
|
|
44
|
+
* providers render it via `renderExhaustiveDirective`.
|
|
43
45
|
* @property {(string|null)=} guidance - Project review guidance; LLM-backed
|
|
44
46
|
* providers render it via `renderGuidanceBlock`.
|
|
45
47
|
*
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
* @typedef {import('./types.js').ReviewInput} ReviewInput
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
renderDepthDirective,
|
|
14
|
+
renderExhaustiveDirective,
|
|
15
|
+
} from './review-depth.js';
|
|
13
16
|
|
|
14
17
|
export const ULTRAREVIEW_PROMPT_TEMPLATE =
|
|
15
18
|
'💡 **Suggested:** Consider running `/ultrareview` on this ' +
|
|
@@ -29,7 +32,15 @@ export function buildUltrareviewMessage(input) {
|
|
|
29
32
|
return ULTRAREVIEW_PROMPT_TEMPLATE.replace('{scopeLabel}', scopeLabel)
|
|
30
33
|
.replace('{baseRef}', baseRef)
|
|
31
34
|
.replace('{headRef}', headRef)
|
|
32
|
-
.replace('{depthDirective}',
|
|
35
|
+
.replace('{depthDirective}', directives(input));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The depth directive, then the exhaustive one on a first pass. */
|
|
39
|
+
function directives(input) {
|
|
40
|
+
return (
|
|
41
|
+
renderDepthDirective(input?.depth) +
|
|
42
|
+
renderExhaustiveDirective(input?.exhaustive)
|
|
43
|
+
);
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
/**
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* check fails fast instead of burning the budget.
|
|
16
16
|
*
|
|
17
17
|
* Terminals: `landed` (confirmed, post-land tail ran); `pending` (nothing
|
|
18
|
-
* mutated); `blocked` (classified, `merge.unlanded` emitted, friction posted
|
|
19
|
-
*
|
|
18
|
+
* mutated); `blocked` (classified, `merge.unlanded` emitted, friction posted;
|
|
19
|
+
* only an operator-recovery class flips `agent::blocked`); `blocked`/`merged-flip-failed` (merged but the
|
|
20
20
|
* `agent::done` write failed — its own event and wording, since the merge
|
|
21
21
|
* is not in question).
|
|
22
22
|
*/
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import { pollUntil } from '../../../util/poll-loop.js';
|
|
33
33
|
import { defaultSleep } from '../../../util/sleep.js';
|
|
34
34
|
import { applyBehindUpdate } from '../../behind-recovery.js';
|
|
35
|
+
import { recoveryOf } from '../../block-class-recovery.js';
|
|
35
36
|
import {
|
|
36
37
|
checkVerdict,
|
|
37
38
|
classifyRollupEntry,
|
|
@@ -495,10 +496,17 @@ function formatUnlandedFriction({
|
|
|
495
496
|
`gave up after ${elapsedSeconds}s without observing a confirmed merge.\n\n` +
|
|
496
497
|
`**Block class:** \`${blockClass}\`\n\n` +
|
|
497
498
|
`**Reason:** ${reason}\n\n` +
|
|
498
|
-
|
|
499
|
+
`${recoveryLine(blockClass)}\n\n${remedy}`
|
|
499
500
|
);
|
|
500
501
|
}
|
|
501
502
|
|
|
503
|
+
/** Agent-class blocks stay `agent::closing`: the session owns the fix. */
|
|
504
|
+
function recoveryLine(blockClass) {
|
|
505
|
+
return recoveryOf(blockClass) === 'agent'
|
|
506
|
+
? 'Story stays at `agent::closing` — the delivering session fixes and resumes it (recovery: agent).'
|
|
507
|
+
: 'Story transitioned to `agent::blocked` — an operator must act (recovery: operator).';
|
|
508
|
+
}
|
|
509
|
+
|
|
502
510
|
/** Friction for a merge that landed but whose `agent::done` write failed. */
|
|
503
511
|
function formatFlipFailedFriction({
|
|
504
512
|
storyId,
|
|
@@ -927,6 +935,34 @@ function pinnedRun(run) {
|
|
|
927
935
|
return { writeDigestFn: (args) => writeCiDigest({ ...args, checkRunFn }) };
|
|
928
936
|
}
|
|
929
937
|
|
|
938
|
+
/** Only an operator-class block is the HITL pause; best-effort. */
|
|
939
|
+
async function blockIfOperatorOwned({
|
|
940
|
+
provider,
|
|
941
|
+
storyId,
|
|
942
|
+
blockClass,
|
|
943
|
+
progress,
|
|
944
|
+
}) {
|
|
945
|
+
if (recoveryOf(blockClass) === 'agent') {
|
|
946
|
+
progress?.(
|
|
947
|
+
'CONFIRM',
|
|
948
|
+
`🔧 Story #${storyId} stays agent::closing (${blockClass}, recovery: agent).`,
|
|
949
|
+
);
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
try {
|
|
953
|
+
await transitionTicketState(provider, storyId, STATE_LABELS.BLOCKED, {});
|
|
954
|
+
progress?.(
|
|
955
|
+
'CONFIRM',
|
|
956
|
+
`🛑 Story #${storyId} → agent::blocked (${blockClass}).`,
|
|
957
|
+
);
|
|
958
|
+
} catch (err) {
|
|
959
|
+
progress?.(
|
|
960
|
+
'CONFIRM',
|
|
961
|
+
`⚠️ Failed to flip Story #${storyId} to agent::blocked: ${err?.message ?? err}`,
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
930
966
|
/** Classify, emit `merge.unlanded`, post friction, block — all best-effort. */
|
|
931
967
|
async function blockOnUnlanded({
|
|
932
968
|
storyId,
|
|
@@ -999,18 +1035,7 @@ async function blockOnUnlanded({
|
|
|
999
1035
|
progress,
|
|
1000
1036
|
});
|
|
1001
1037
|
|
|
1002
|
-
|
|
1003
|
-
await transitionTicketState(provider, storyId, STATE_LABELS.BLOCKED, {});
|
|
1004
|
-
progress?.(
|
|
1005
|
-
'CONFIRM',
|
|
1006
|
-
`🛑 Story #${storyId} → agent::blocked (${blockClass}).`,
|
|
1007
|
-
);
|
|
1008
|
-
} catch (err) {
|
|
1009
|
-
progress?.(
|
|
1010
|
-
'CONFIRM',
|
|
1011
|
-
`⚠️ Failed to flip Story #${storyId} to agent::blocked: ${err?.message ?? err}`,
|
|
1012
|
-
);
|
|
1013
|
-
}
|
|
1038
|
+
await blockIfOperatorOwned({ provider, storyId, blockClass, progress });
|
|
1014
1039
|
|
|
1015
1040
|
return {
|
|
1016
1041
|
confirmed: false,
|
|
@@ -8,6 +8,7 @@ import nodeFs from 'node:fs';
|
|
|
8
8
|
import { storyTerminalEnvelopePath } from '../config/temp-paths.js';
|
|
9
9
|
import { resolveConfig } from '../config-resolver.js';
|
|
10
10
|
import { writeFileAtomic } from '../util/atomic-write.js';
|
|
11
|
+
import { BLOCK_CLASS_RECOVERY } from './block-class-recovery.js';
|
|
11
12
|
import { validateTerminalEnvelope } from './story-deliver-terminal-schema.js';
|
|
12
13
|
|
|
13
14
|
export { validateTerminalEnvelope };
|
|
@@ -95,6 +96,12 @@ function compact(obj) {
|
|
|
95
96
|
return out;
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
/** An unknown class gets no `recovery`, so the schema rejects the envelope. */
|
|
100
|
+
function withRecovery(blocked) {
|
|
101
|
+
if (!blocked) return null;
|
|
102
|
+
return { ...blocked, recovery: BLOCK_CLASS_RECOVERY[blocked.blockClass] };
|
|
103
|
+
}
|
|
104
|
+
|
|
98
105
|
/**
|
|
99
106
|
* Throws a `TypeError` on a schema violation — callers trust the status
|
|
100
107
|
* without re-probing GitHub. An unreadable schema does not throw.
|
|
@@ -163,7 +170,7 @@ export function buildTerminalEnvelope({
|
|
|
163
170
|
pr: pr ?? null,
|
|
164
171
|
gates,
|
|
165
172
|
tail: tail ?? null,
|
|
166
|
-
blocked: blocked
|
|
173
|
+
blocked: withRecovery(blocked),
|
|
167
174
|
failure: failure ?? null,
|
|
168
175
|
escalation: escalation ?? null,
|
|
169
176
|
nextCommand: nextCommand ?? null,
|