also looking at this
feat(ci): let buddy see whose failure it is, and retry the ones worth retrying
#1410
16 files
+1092
-14
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | #!/usr/bin/env bun |
| 2 | 2 | |
| 3 | import type { FailureKind } from '../src/ci/classify' | |
| 3 | 4 | import type { GitProvider } from '../src/git/provider' |
| 4 | 5 | import type { ReviewFinding } from '../src/review/findings' |
| 5 | 6 | import type { ReviewFormat } from '../src/review/local' |
| @@ -1355,7 +1356,7 @@ cli | ||
| 1355 | 1356 | return |
| 1356 | 1357 | } |
| 1357 | 1358 | |
| 1358 | const { attemptFix } = await import('../src/ci') | |
| 1359 | const { attemptFix, failsOnBaseBranch } = await import('../src/ci') | |
| 1359 | 1360 | const { parseFixAttempts, upsertFixAttempts } = await import('../src/ci/attempts') |
| 1360 | 1361 | const { createAiClient } = await import('../src/ai') |
| 1361 | 1362 | |
| @@ -1368,15 +1369,36 @@ cli | ||
| 1368 | 1369 | pullRequest = open.find(candidate => candidate.number === prNumber) |
| 1369 | 1370 | } |
| 1370 | 1371 | const priorAttempts = parseFixAttempts(pullRequest?.body)?.attempts ?? 0 |
| 1372 | const baseBranch = config.repository?.baseBranch ?? 'main' | |
| 1373 | ||
| 1374 | // Both of these are capability-gated rather than assumed: a provider | |
| 1375 | // that cannot read a run history still gets the full diagnosis, it just | |
| 1376 | // cannot tell an inherited failure from a new one. | |
| 1377 | const canReadRuns = supports(provider, 'ciRuns', 'listWorkflowRuns') | |
| 1378 | const canRerun = supports(provider, 'ciRuns', 'rerunWorkflowRun') | |
| 1371 | 1379 | |
| 1372 | 1380 | const outcome = await attemptFix({ |
| 1373 | 1381 | log, |
| 1374 | 1382 | priorAttempts, |
| 1375 | 1383 | workspace: process.cwd(), |
| 1376 | baseBranch: config.repository?.baseBranch ?? 'main', | |
| 1384 | baseBranch, | |
| 1377 | 1385 | ai: createAiClient(config, logger), |
| 1378 | 1386 | logger, |
| 1379 | 1387 | dryRun: Boolean(options.dryRun), |
| 1388 | ...(canReadRuns | |
| 1389 | ? { | |
| 1390 | checkBase: (kind: FailureKind) => failsOnBaseBranch( | |
| 1391 | { | |
| 1392 | listWorkflowRuns: (branch, listOptions) => provider.listWorkflowRuns!(branch, listOptions), | |
| 1393 | getWorkflowRunLogs: id => provider.getWorkflowRunLogs!(id), | |
| 1394 | }, | |
| 1395 | baseBranch, | |
| 1396 | kind, | |
| 1397 | logger, | |
| 1398 | ), | |
| 1399 | } | |
| 1400 | : {}), | |
| 1401 | ...(canRerun && runId ? { rerun: () => provider.rerunWorkflowRun!(runId) } : {}), | |
| 1380 | 1402 | regenerateLockfile: async () => { |
| 1381 | 1403 | const { regenerateLockFile, detectRequiredPackageManagers, getAllLockFilePaths } = await import('../src/utils/lock-file') |
| 1382 | 1404 | const { commitAndPush } = await import('../src/utils/git') |