FACTORY_OUTCOME: COMPLETED
Итог: вердикт R1 — FAIL (условный): код, хеши, additive-миграция, замороженное согласование, CAS/идемпотентность и режим PARKED подтверждены; найден один блокирующий дефект владельческих действий.
Проблемы: после PASS владелец не может изменить требования (revise) или остановить (hold) — запрос возвращает успех (303), но ничего не меняется; плюс 3 некритичных замечания. Production не пострадал: миграция безопасна, режим PARKED, циклов 0.
Решение: принять итог FAIL и поручить минимальную правку (≈10 строк) с повторной проверкой; миграция уже применена и откат не нужен; включение функции и рестарт сервисов по-прежнему не разрешены.
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.
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.
B-1. Owner revise/hold on a PASSED cycle is a silent no-op.
control_plane/review_cycles.py:437 — c['state']=='PASSED' and trigger!='accept' ⇒ outcome='STALE_OUTCOME'. This branch is meant for late worker outcomes but also catches owner (non-worker) triggers stop and change_requirements. console/owner_decisions.py:36-41 does not check the returned outcome, so the route returns 303.can_accept true; POST /tasks/{id}/decision action=revise ⇒ HTTP 303, cycle stays PASSED, version 2→2, task stays COMPLETED, instruction unchanged; only a STALE_OUTCOME transition row is written.guard_edit) also blocks any other edit path, so the only way out is accept. Contradicts design §8 (downgrade requires owner to "accept, supersede or cancel" an unresolved cycle) and gives the owner a false success.worker triggers only, and let non-worker change_requirements (→ SUPERSEDED, task PLANNED) and stop through when state is PASSED and no live execution; (2) in decide() raise 409 if the returned transition outcome is STALE_OUTCOME; (3) add a test in test_review_cycles_r1.py for revise and hold after PASS (state, task status, instruction, HTTP code).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.: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.accept after PASSED keeps cycle state PASSED (task ACCEPTED); fine, noted for UI work.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):
| Run | Result |
|---|---|
test_review_cycles_r1.py + test_runtime.py::test_migration_is_additive_and_repeatable | 45 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):
MIGRATIONS with defaults; tables CREATE IF NOT EXISTS; init_db idempotent. Copy tests (see below) preserved all row counts.approve_task transaction after approved_at is set; snapshot has BEFORE UPDATE/DELETE abort triggers and a digest over all fields; task inputs/attachments/dependencies frozen by triggers while cycle is ACTIVE/STOPPED/PASSED; snapshot_valid re-checks digest, requirement attachments (full streaming SHA-256), workspace and contract. Resource paths and contract paths cannot escape workspace; contract paths are a floor. CORAL/L-IT cannot enable cycles.cycle_apply requires an open transaction, uses savepoint, version CAS, unique idem_key; duplicates return the stored transition; stale outcomes don't advance version or overwrite recorded evidence.can_accept needs latest producer of current revision/snapshot, durable passed verification with matching hash and contract, unchanged manifest, independent completed PASS (different executor), clean integrity record, no live execution, no validated BLOCKING finding. Owner accept can't bypass it; legacy tasks unchanged.criterion|target; BLOCKING requires valid criterion/target and contained evidence/recorded test else downgraded; PASS evaluated before no-progress; disputes need evidence; 2nd UPHELD / 2 persisted remediations stop.REJECTED_MUTATION, findings not applied, acceptance cleared, no auto-resume; resume owner-only, ceiling 5, needs reacquisition flag + fresh baseline equal to current files, then re-executes in the same spent revision.CYCLE_MANAGED for rows with a cycle; dispatcher claim fence retained (no cycle launch path exists yet, as R1 scope intends).enabled=False; control row defaults PARKED; effective_mode is PARKED unless both durable ON and env AI_FACTORY_REVIEW_CYCLE=1; approval raises Conflict if enabled settings but parked.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.
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".
source-sha256.json.integrity_check result in the rollout notes.subprocess.Popen in those two tests).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.