← Назад к задаче

automatic-review-r1-review.md

FACTORY_OUTCOME: COMPLETED

Сводка для владельца

Итог: вердикт R1 — FAIL (условный): код, хеши, additive-миграция, замороженное согласование, CAS/идемпотентность и режим PARKED подтверждены; найден один блокирующий дефект владельческих действий.
Проблемы: после PASS владелец не может изменить требования (revise) или остановить (hold) — запрос возвращает успех (303), но ничего не меняется; плюс 3 некритичных замечания. Production не пострадал: миграция безопасна, режим PARKED, циклов 0.
Решение: принять итог FAIL и поручить минимальную правку (≈10 строк) с повторной проверкой; миграция уже применена и откат не нужен; включение функции и рестарт сервисов по-прежнему не разрешены.

R1 independent review — automatic review cycles

Reviewer: independent task FR-AUTO-REVIEW-R1-REVIEW, 2026-11-29. No code edited, no production writes, no restart. Production DB was opened only read-only (mode=ro); all tests/copy checks used temporary DBs and fake executors. Real-CLI tests (test_errors_timeout_and_auth_preflight, test_execution_edits_real_workspace_and_contract) were excluded and not run.

Verdict: FAIL (one blocking defect; everything else PASS)

The defect is small, local, disabled-by-default, and does not endanger production in PARKED mode, but it breaks an owner control that the design (§3.4, §8 downgrade preflight, row 2 of the transition table) relies on. R1 should not be accepted as complete until fixed and re-tested.

Blocking finding

B-1. Owner revise/hold on a PASSED cycle is a silent no-op.

Non-blocking findings (recommendations, not required for R1 verdict)

  1. Mutation reason masked by stop/park (review_cycles.py:439 precedes :492). Reproduced: reviewer result with files_changed+forbidden_action while stop_requested=1 ⇒ cycle STOPPED/MANUAL_STOP, execution left COMPLETED (not REJECTED_MUTATION). Safe outcome (stopped, can't accept, resume needs fresh baseline and clears acceptance), but the mutation evidence/reason is lost. Suggest evaluating integrity_violation before the stop/park branch for REVIEW-phase workers.
  2. Stale reviewer outcome with mutation is record-only (:437): a late reviewer from an older revision that mutated files will not stop the cycle. Mitigated because can_accept recomputes the producer manifest, but R2/R3 should treat integrity violations in stale outcomes as a stop.
  3. No CANCELLED producer: state exists in the CHECK constraint and design, but no code path sets it. Needed by the design's downgrade path; defer to R3/R4 but track.
  4. Owner accept after PASSED keeps cycle state PASSED (task ACCEPTED); fine, noted for UI work.

Evidence checked

Hashes. All 11 files in r1-evidence/source-sha256.json re-hashed now: byte counts and SHA-256 all match current sources (db.py 52c1e93b…, review_cycles.py 6819ab07…, test_review_cycles_r1.py fac29bca…, etc.). No git history exists (.git is an empty directory), so no historical diff was possible and none is claimed.

Fresh test runs (this review, temp DBs, fake executors):

RunResult
test_review_cycles_r1.py + test_runtime.py::test_migration_is_additive_and_repeatable45 passed (44 R1 + 1 migration), 115 s
legacy_probe.py (runtime/approved_runtime/supervisor/verification/owner_decisions minus the 13 listed)56 passed, 13 deselected, 15 subtests passed, 151 s
Two probes (B-1 and finding 1)both reproduce defects above

Report numbers (44/56/15) are reproduced. Report's safe adapter subset (21 passed) and the interrupted adapter run were taken from its logs, not re-run; the report discloses the real-CLI mock defect honestly (no model result is claimed).

Design v4 conformance (code read in full: review_cycles.py, review_cycle_schema.sql, db.py, owner_decisions, approval hook):

Pre-migration compatibility failure and rollout ordering (owner revision)

What failed. The first broad legacy run was 55 passed / 14 failed. One failure was test_migration_is_additive_and_repeatable: the test simulates a pre-R1 DB by ALTER TABLE … DROP COLUMN, and SQLite refuses to drop a column referenced by the new trigger cycle_task_inputs. Assessment: a test-fixture artifact, not a real upgrade defect. The fixture fix (drop that trigger first, as a pre-R1 DB wouldn't have it, then let init_db recreate it) is legitimate and the test now passes. Side note: those triggers do prevent DROP COLUMN on guarded task columns, so a future physical rollback by dropping columns would also need to drop triggers; the design's rollback is PARKED mode with code retained, so this is not a problem.

Real-DB upgrade proof (my own copy test, temp files only). init_db() twice on (a) backups/factory-pre-r1-20261129-082817.db and (b) the old factory.db.bak-20261013-1754-pre-contract: both succeed, all table row counts unchanged, integrity_check ok, foreign_key_check empty, control mode PARKED. So both a recent and a much older schema upgrade cleanly.

Production state observed read-only. data/factory.db: R1 tables/triggers/columns present; review_cycle_control.mode = PARKED; review_cycles = 0, cycle_snapshots = 0; integrity_check ok; 252 tasks (same as backup). Backup backups/factory-pre-r1-20261129-082817.db (sha256 a2b6e28c…d8f6a1) predates the migration (it contains no R1 tables), passes integrity_check, has 341 executions vs 342 live (one new execution since, expected). Backup was taken before the migration — ordering correct. Design §8 asks for sqlite3 .backup; I cannot tell from files which method was used (size 24297472 incl. WAL content suggests a consistent backup, but unproven) — a recommendation to record the method.

Rollout ordering. Console and dispatcher have run since 2026-11-28 07:08 and the supervisor since 2026-10-17, i.e. they are old code (R1 sources were modified 2026-11-29). They kept operating after the migration (console POSTs at 08:28:31 returned 303; dispatcher/supervisor ticks continue at 08:29–08:30). That is consistent with design: old code ignores new tables, all new columns have defaults, and the new triggers fire only for tasks with an open cycle (none). So the sequence backup → copy test → additive migration → old code keeps running, PARKED is safe. Cautions for the next step: (1) do not restart until B-1 is fixed, because the restarted code will bring in the owner-decision path with the defect; (2) after restart AI_FACTORY_REVIEW_CYCLE is unset ⇒ still PARKED regardless of DB; (3) no dispatcher path can launch a cycle yet (R3), so turning mode ON would be inert and misleading — keep PARKED; (4) restart only in an authorized idle window per design §8; this review authorizes nothing.

Attribution of the 13 legacy failures (no historical checkout claimed)

The report's legacy-known-failures.json lists 13 node IDs: 8 fallback/executor-expectation (runtime, approved_runtime, supervisor) and 5 UI/template (4 in owner_decisions, 1 monitor template). I verified: (a) the 56-test remainder passes; (b) legacy-hooks-bypassed.log shows the same 13 failing with the R1 hooks (current/freeze_approval/guard_edit/guard_project_inputs) replaced by no-ops; (c) failure messages are expectation mismatches ('deepseek' lists vs claude-code, None != 'nemotron', 'totals' is undefined, missing "Technical details" in English markup) that match the known outdated DeepSeek/text-only expectation debt from FR-EXECUTOR-VERIFY. Caveat, accurately stated: this shows the failures are not caused by the four hooks; it does not isolate the other R1 edits (supervisor fence, owner token, DB migration) nor prove they pre-date R1 (no checkout), and it does not equate them to the "12 legacy tests" of the earlier note (13 ≠ 12; one is unexplained and should be triaged). The attribution is "reproduces without R1 hooks; consistent with legacy expectation debt", not "proven pre-existing".

Recommendations (separate from verdict)

Not verified

Real HTTP server behaviour (tests call handlers directly), real executors/E2E, dispatcher recovery, physical isolation — all R2–R6 scope. Production was inspected read-only and not exercised.

Материалы