e2e-agent-runner 1.17.1 → 1.17.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/runner.mjs +36 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "e2e-agent-runner",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "description": "suseona e2e 작업 에이전트 로컬 러너 — 내 컴퓨터의 Claude Code 로 구현→테스트→리뷰→배포와 웹사이트 기능 지도 추출·QA·개선 사이클을 자동 수행",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
package/runner.mjs CHANGED
@@ -27,6 +27,7 @@ import {
27
27
  appendUpdateLog, autoUpdateEligible, fetchLatestVersion, isNewerVersion, replacementCommand, spawnReplacement, tokenPersistedOnDisk, waitForPidGone,
28
28
  } from './update.mjs';
29
29
  import { SlotPool, clampParallel } from './slots.mjs';
30
+ import { retryDelayMs, shouldRetryStep } from './retry.mjs';
30
31
 
31
32
  // env 자동 로드(이미 설정된 셸 env 는 덮지 않는다 — export 우선):
32
33
  // ① runner/.env.local(스크립트 옆 — 리포 체크아웃 실행용, npx 캐시에서는 버전마다 경로가 바뀌어 불안정)
@@ -311,24 +312,50 @@ async function handleStep({ step, task, project }) {
311
312
  log(`단계 시작: ${String(task.id).slice(0, 8)}/${step.phase} 모델=${step.model || '기본'} effort=${step.effort || '기본'}`);
312
313
 
313
314
  let result;
314
- if (step.phase === 'implement') {
315
- result = await runImplement({ step, task, project, buf, cancelled });
316
- } else if (step.phase === 'deploy') {
317
- result = await runDeploy({ step, task, project, buf, cancelled });
318
- } else if (step.phase === 'discover' || step.phase.startsWith('qa_') || step.phase.startsWith('imp_')) {
319
- result = await runDiscover({ step, task, project, buf, cancelled });
320
- } else {
315
+ // 일시 API 오류 재시도(2026-11-25 z.ai 1210 사고) — claude 가 API 오류로 시작 직후(90s 미만) 죽으면
316
+ // 여유를 두고 같은 단계를 다시 실행한다(최대 2회). 진짜 결함은 보통 90s 안에 죽지 않고,
317
+ // 취소·시간초과·산출물 있는 실패는 재시도하지 않는다. 슬롯 점유 연장은 최대 ~6분.
318
+ const execute = async () => {
319
+ if (step.phase === 'implement') {
320
+ return runImplement({ step, task, project, buf, cancelled });
321
+ }
322
+ if (step.phase === 'deploy') {
323
+ return runDeploy({ step, task, project, buf, cancelled });
324
+ }
325
+ if (step.phase === 'discover' || step.phase.startsWith('qa_') || step.phase.startsWith('imp_')) {
326
+ return runDiscover({ step, task, project, buf, cancelled });
327
+ }
321
328
  // test / remediate / review / continue — 서버 프롬프트(prompt_md)·세션(resume) 그대로 실행.
322
329
  // 워크트리 모드에선 implement 가 만든 작업 워크트리에서(reset 없이 상태 보존).
323
330
  const cwd = await workdirFor(task, project);
324
- result = await runPhase({ step, task, project, buf, cancelled, cwd });
331
+ const r = await runPhase({ step, task, project, buf, cancelled, cwd });
325
332
  if (step.phase === 'continue' || step.phase === 'remediate') {
326
333
  // 코드가 바뀌었는지 서버가 알 수 있게 누적 커밋 수(base..HEAD)만 보고한다(1.13.0+).
327
334
  // branchTip/remoteUrl 은 보내지 않는다 — 서버가 implement 시점 값을 덮어쓰지 않도록(배포 성공 시 별도 보고).
328
335
  const base = task.base_branch || (await resolveBase(project.folder_path));
329
336
  const meta = await captureTaskMeta(project.folder_path, cwd, base);
330
- result = { ...result, commits: meta.commits };
337
+ return { ...r, commits: meta.commits };
331
338
  }
339
+ return r;
340
+ };
341
+ let retried = 0;
342
+ for (let attempt = 0; ; attempt++) {
343
+ const t0 = Date.now();
344
+ result = await execute();
345
+ if (!shouldRetryStep(result, Date.now() - t0, attempt) || cancelled()) break;
346
+ retried = attempt + 1;
347
+ const delayMs = retryDelayMs(attempt);
348
+ log(`일시 API 오류(${String(result.error ?? '').slice(0, 120)}) — ${(delayMs / 1000) | 0}s 후 재시도 ${retried}/2`);
349
+ buf.push(step.id, 'status', {
350
+ event: 'phase_retry', phase: step.phase, attempt: retried,
351
+ delay_s: Math.round(delayMs / 1000), error: String(result.error ?? '').slice(0, 200),
352
+ });
353
+ const until = Date.now() + delayMs;
354
+ while (Date.now() < until && !cancelled()) await sleep(Math.min(1000, until - Date.now()));
355
+ if (cancelled()) break;
356
+ }
357
+ if (retried > 0 && result && !result.ok) {
358
+ result = { ...result, error: `${String(result.error ?? '').slice(0, 400)} (일시 API 오류 ${retried}회 재시도 후에도 실패)` };
332
359
  }
333
360
 
334
361
  const cancelledNow = cancelled() || result?.cancelled;