ci(process): раунд ревью ждёт Validate событием, а не сном раннера (#636)

Стадия prepare спала ≈ 28 минут на раунд, пока шёл Validate с мутантами на
материале (модель работает 10–12); за неделю ≈ 420–500 job-минут простоя и
потолок бюджета стадии 55 минут.

- validate-gate.mjs: `--no-wait` — гейт диспатчит прогон, убеждается, что тот
  встал на материал (#539 сохранён), и возвращает `pending` (код 2) вместо
  ожидания; завершённый зелёный/красный отдаёт сразу, как прежде.
- process.yml prepare: третий исход `proceed=pending`: запечатанный маркер
  `review-pending-<issue>-<run>-<attempt>` (issue, stage, branch, material_sha,
  validate run) и выход; модель и интеграция не запускаются; возврат автору —
  только на явном `false`.
- process-resume.yml + scripts/process-resume.mjs: на `workflow_run: completed`
  Validate по ветке issue/* — если метка S7 стоит, активного прогона нет и
  последний прогон оставил маркер на этот SHA, переставить S7 (HP_PROCESS_TOKEN);
  новый прогон находит завершённый dispatch сразу. Без маркера не будит.
- process-reconcile.mjs: читает маркер и состояние Validate на материале;
  идёт — wait, завершился/пропал без продолжения — retry; без маркера — прежний
  escalate. Общий loadSealedArtifact, экспорт processRuns/artifactNames.
- preflight сверяет process-resume.yml между main и dev наравне с process.yml.
- Тесты: validate-gate (4), process-resume (8, включая контракт трёх workflow),
  process-reconcile (2); мутанты gate-no-wait-still-sleeps,
  resume-wakes-round-without-marker, resume-ignores-active-run,
  reconcile-wakes-pending-while-validate-active. PROCESS.md §10.4, AGENTS.md.

Issue: #636
User-Visible: no
This commit is contained in:
Claude
2026-09-23 08:51:17 +03:00
parent e29dfdeb72
commit 351fef43d6
14 changed files with 580 additions and 32 deletions
+45
View File
@@ -8449,6 +8449,51 @@ const MUTANT_DEFINITIONS = [
+ ' никогда — именно оно в этом процессе заменяет тестирование.',
}],
},
// #636: раунд продолжается по событию завершения Validate, а не сном раннера.
// Каждая защита — от второго вызова модели или от вечного ожидания.
{
id: 'gate-no-wait-still-sleeps',
guard: 'node --test --test-name-pattern="#636" test/validate-gate.test.mjs',
because: 'with --no-wait the gate must return pending for a running dispatch instead of polling '
+ 'it inside the pipeline job — otherwise the runner sleeps 28 minutes per round again (#636)',
patches: [{
file: 'scripts/validate-gate.mjs',
find: " if (!wait) {\n // #636: прогон найден и идёт — ждать его будет событие, не раннер.",
replace: " if (false && !wait) {\n // #636: прогон найден и идёт — ждать его будет событие, не раннер.",
}],
},
{
id: 'resume-wakes-round-without-marker',
guard: 'node --test --test-name-pattern="#636" test/process-resume.test.mjs',
because: 'a successful process run without a pending marker did not wait for Validate; relabelling '
+ 'it would spend the model a second time (#636)',
patches: [{
file: 'scripts/process-resume.mjs',
find: " if (!pending) return { action: 'noop', reason: 'latest process run left no pending marker — it did not wait for Validate' };",
replace: " if (false && !pending) return { action: 'noop', reason: 'latest process run left no pending marker — it did not wait for Validate' };",
}],
},
{
id: 'resume-ignores-active-run',
guard: 'node --test --test-name-pattern="#636" test/process-resume.test.mjs',
because: 'relabelling while a process run is active queues a second round for the same request (#636)',
patches: [{
file: 'scripts/process-resume.mjs',
find: " if (mine.some((run) => ACTIVE_RUN_STATES.has(run.status))) return { action: 'noop', reason: 'a process run for this issue is already active' };",
replace: " if (false && mine.some((run) => ACTIVE_RUN_STATES.has(run.status))) return { action: 'noop', reason: 'a process run for this issue is already active' };",
}],
},
{
id: 'reconcile-wakes-pending-while-validate-active',
guard: 'node --test --test-name-pattern="#636" test/process-reconcile.test.mjs',
because: 'reconcile must wait while the Validate the round is pending on still runs; relabelling '
+ 'early dispatches a second Validate and a second round (#636)',
patches: [{
file: 'scripts/process-reconcile.mjs',
find: " if (run.pendingValidate === 'active') {",
replace: " if (false && run.pendingValidate === 'active') {",
}],
},
{
id: 'process-reconcile-restarts-healthy-run',
guard: 'node --test test/process-reconcile.test.mjs',