@yemi33/minions 0.1.768 → 0.1.770
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/CHANGELOG.md +3 -1
- package/docs/pr-review-fix-loop.md +18 -1
- package/engine/ado.js +49 -40
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.770 (2026-04-10)
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
- id/kill endpoint
|
|
7
7
|
|
|
8
8
|
### Fixes
|
|
9
|
+
- increase ADO pipeline/task caps from 3 to 10, update docs
|
|
10
|
+
- ADO build detection uses builds API, not unreliable status checks
|
|
9
11
|
- handle work type names as action aliases for dispatch
|
|
10
12
|
- align Agent Usage and Engine Usage table columns
|
|
11
13
|
- harden agent kill endpoint — use killGracefully, clean steer.md, remove dead var
|
|
@@ -41,7 +41,7 @@ How the engine manages the lifecycle of a PR from creation through review, fix,
|
|
|
41
41
|
|
|
42
42
|
- Gate: `buildFixAttempts < maxBuildFixAttempts` (default 3) + grace period expired
|
|
43
43
|
- **Grace period** (`_buildFixPushedAt`): after fix dispatches, waits `buildFixGracePeriod` (default 10min, configurable in `ENGINE_DEFAULTS`) for CI to run before re-dispatching. Cleared when poller detects build status transition (CI actually ran).
|
|
44
|
-
- **Error logs**: GitHub fetches annotations (failures only, not warnings) + Actions job log (always). ADO fetches build timeline
|
|
44
|
+
- **Error logs**: GitHub fetches annotations (failures only, not warnings) + Actions job log (always). ADO queries builds API directly (not status checks), fetches build timeline → failed task logs (up to 10 per build, up to 10 failing pipelines).
|
|
45
45
|
- **Escalation**: after 3 failed attempts, writes inbox alert, sets `buildFixEscalated = true`, stops auto-dispatch. Counter resets when build recovers.
|
|
46
46
|
|
|
47
47
|
## 5. Fix completes
|
|
@@ -108,3 +108,20 @@ How the engine manages the lifecycle of a PR from creation through review, fix,
|
|
|
108
108
|
| `lastReviewedAt` | `updatePrAfterReview()` | Prevents re-dispatch if reviewed |
|
|
109
109
|
| `minionsReview` | Post-completion hooks | `{ reviewer, reviewedAt, note, fixedAt }` |
|
|
110
110
|
| `humanFeedback` | `pollPrHumanComments()` | `{ pendingFix, feedbackContent, lastProcessedCommentDate }` |
|
|
111
|
+
|
|
112
|
+
## Platform differences
|
|
113
|
+
|
|
114
|
+
| | GitHub | ADO |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| **Build status API** | `/commits/{sha}/check-runs` | `_apis/build/builds` (not status checks — those show stale codecoverage postbacks) |
|
|
117
|
+
| **Commit tracking** | `head.sha` (source branch tip) | `lastMergeCommit.commitId` (merge commit that builds use as sourceVersion) |
|
|
118
|
+
| **Passing** | success, skipped, neutral | succeeded, partiallySucceeded (warnings, not failures) |
|
|
119
|
+
| **Error logs** | Annotations (failures only) + Actions job log (always) | Build timeline → failed task logs (up to 10 tasks, up to 10 pipelines) |
|
|
120
|
+
| **Push detection** | `head.sha` change | `lastMergeCommit.commitId` change |
|
|
121
|
+
|
|
122
|
+
### ADO lessons learned
|
|
123
|
+
|
|
124
|
+
- Don't trust `/pullRequests/{id}/statuses` — shows stale codecoverage postbacks, not actual build results
|
|
125
|
+
- Builds use the merge commit hash as `sourceVersion`, not the source branch commit — compare against `lastMergeCommit.commitId`
|
|
126
|
+
- `partiallySucceeded` counts as passing (warnings, not failures)
|
|
127
|
+
- A stale but passing build is still valid — don't re-trigger builds that already passed
|
package/engine/ado.js
CHANGED
|
@@ -101,13 +101,14 @@ const BUILD_ERROR_LOG_MAX_LINES = 150;
|
|
|
101
101
|
*/
|
|
102
102
|
async function fetchAdoBuildErrorLog(orgBase, project, failedStatus, token, pr, seenBuildIds) {
|
|
103
103
|
try {
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
buildId = buildIdMatch[1];
|
|
110
|
-
}
|
|
104
|
+
// Use pre-resolved buildId if available (from builds API query), else parse from targetUrl
|
|
105
|
+
let buildId = failedStatus?._buildId || null;
|
|
106
|
+
if (!buildId) {
|
|
107
|
+
const targetUrl = failedStatus?.targetUrl || '';
|
|
108
|
+
const buildIdMatch = targetUrl.match(/buildId=(\d+)/);
|
|
109
|
+
if (buildIdMatch) buildId = buildIdMatch[1];
|
|
110
|
+
}
|
|
111
|
+
if (!buildId) {
|
|
111
112
|
// Fallback: query recent failed builds for this PR's source branch
|
|
112
113
|
try {
|
|
113
114
|
const branch = pr?.branch || pr?.sourceRefName?.replace('refs/heads/', '');
|
|
@@ -140,9 +141,9 @@ async function fetchAdoBuildErrorLog(orgBase, project, failedStatus, token, pr,
|
|
|
140
141
|
);
|
|
141
142
|
if (failedRecords.length === 0) return null;
|
|
142
143
|
|
|
143
|
-
// Fetch logs for failed tasks (cap at
|
|
144
|
+
// Fetch logs for failed tasks (cap at 10 to cover multi-stage pipelines)
|
|
144
145
|
const logParts = [];
|
|
145
|
-
for (const record of failedRecords.slice(0,
|
|
146
|
+
for (const record of failedRecords.slice(0, 10)) {
|
|
146
147
|
try {
|
|
147
148
|
const logUrl = `${orgBase}/${project.adoProject}/_apis/build/builds/${buildId}/logs/${record.log.id}?api-version=7.1`;
|
|
148
149
|
const text = await adoFetchText(logUrl, token);
|
|
@@ -281,7 +282,8 @@ async function pollPrStatus(config) {
|
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
// Track head commit changes to detect new pushes (used for review re-dispatch gating)
|
|
284
|
-
|
|
285
|
+
// Use lastMergeCommit (the merge commit), not lastMergeSourceCommit (source branch tip)
|
|
286
|
+
const headCommit = prData.lastMergeCommit?.commitId || prData.lastMergeSourceCommit?.commitId || '';
|
|
285
287
|
if (headCommit && pr._adoHeadCommit !== headCommit) {
|
|
286
288
|
if (pr._adoHeadCommit) { // skip first detection — only track changes
|
|
287
289
|
pr.lastPushedAt = ts();
|
|
@@ -344,38 +346,45 @@ async function pollPrStatus(config) {
|
|
|
344
346
|
|
|
345
347
|
if (newStatus !== PR_STATUS.ACTIVE) return updated;
|
|
346
348
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
for (const s of statusData.value || []) {
|
|
351
|
-
const key = (s.context?.genre || '') + '/' + (s.context?.name || '');
|
|
352
|
-
if (!latest.has(key)) latest.set(key, s);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
const buildStatuses = [...latest.values()].filter(s => {
|
|
356
|
-
const ctx = ((s.context?.genre || '') + '/' + (s.context?.name || '')).toLowerCase();
|
|
357
|
-
return /\bcodecoverage\b/.test(ctx) || /\bbuild\b/.test(ctx) ||
|
|
358
|
-
/\bdeploy\b/.test(ctx) || /(?:^|\/)ci(?:\/|$)/.test(ctx);
|
|
359
|
-
});
|
|
360
|
-
|
|
349
|
+
// Query builds API directly — status checks (/statuses) are unreliable (stale codecoverage postbacks)
|
|
350
|
+
// Use the merge commit hash to find builds for this PR
|
|
351
|
+
const mergeCommitId = prData.lastMergeCommit?.commitId;
|
|
361
352
|
let buildStatus = 'none';
|
|
362
353
|
let buildFailReason = '';
|
|
354
|
+
let buildStatuses = []; // for error log fetching
|
|
363
355
|
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
356
|
+
if (mergeCommitId) {
|
|
357
|
+
try {
|
|
358
|
+
// Find builds where sourceVersion matches the PR's merge commit
|
|
359
|
+
const buildsUrl = `${orgBase}/${project.adoProject}/_apis/build/builds?$top=10&api-version=7.1`;
|
|
360
|
+
const buildsData = await adoFetch(buildsUrl, token);
|
|
361
|
+
const prBuilds = (buildsData?.value || []).filter(b =>
|
|
362
|
+
b.sourceVersion === mergeCommitId || b.sourceBranch === prData.sourceRefName
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
if (prBuilds.length > 0) {
|
|
366
|
+
// partiallySucceeded = warnings, not failures — counts as passing
|
|
367
|
+
const hasFailed = prBuilds.some(b => b.result === 'failed' || b.result === 'canceled');
|
|
368
|
+
const allDone = prBuilds.every(b => b.status === 'completed');
|
|
369
|
+
const allPassed = prBuilds.every(b => b.result === 'succeeded' || b.result === 'partiallySucceeded');
|
|
370
|
+
const hasRunning = prBuilds.some(b => b.status === 'inProgress' || b.status === 'notStarted');
|
|
371
|
+
|
|
372
|
+
if (hasFailed && allDone) {
|
|
373
|
+
buildStatus = 'failing';
|
|
374
|
+
const failed = prBuilds.find(b => b.result === 'failed');
|
|
375
|
+
buildFailReason = failed?.definition?.name || 'Build failed';
|
|
376
|
+
// Build fake status objects for error log fetching
|
|
377
|
+
buildStatuses = prBuilds.filter(b => b.result === 'failed').map(b => ({
|
|
378
|
+
state: 'failed', targetUrl: `${orgBase}/${project.adoProject}/_build/results?buildId=${b.id}`,
|
|
379
|
+
_buildId: String(b.id),
|
|
380
|
+
}));
|
|
381
|
+
} else if (allDone && allPassed) {
|
|
382
|
+
buildStatus = 'passing';
|
|
383
|
+
} else if (hasRunning) {
|
|
384
|
+
buildStatus = 'running';
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
} catch (e) { log('warn', `ADO build query for ${pr.id}: ${e.message}`); }
|
|
379
388
|
}
|
|
380
389
|
|
|
381
390
|
if (pr.buildStatus !== buildStatus) {
|
|
@@ -395,7 +404,7 @@ async function pollPrStatus(config) {
|
|
|
395
404
|
|
|
396
405
|
// Fetch actual compiler/build error logs when transitioning to failing
|
|
397
406
|
if (buildStatus === 'failing') {
|
|
398
|
-
const failedStatusObjs = buildStatuses.filter(s => s.state === 'failed' || s.state === 'error').slice(0,
|
|
407
|
+
const failedStatusObjs = buildStatuses.filter(s => s.state === 'failed' || s.state === 'error').slice(0, 10);
|
|
399
408
|
const logParts = [];
|
|
400
409
|
const seenBuildIds = new Set();
|
|
401
410
|
for (const failedStatusObj of failedStatusObjs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.770",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|