Repository navigation
fix(issue-refinement-loop): add fail-closed routing to compact producers (#1165) - #1194
Conversation
AC1-AC8 for #1165: - compact_review_result.py: emit canonical PRODUCER_FAILURE_V1 envelope on schema_mismatch, output_budget_violation, and termination bypass errors. Catches jsonschema.ValidationError (not a ValueError subclass in jsonschema 4.x) by using except (ValueError, Exception) in main(). - compact_author_result.py: same fail-closed routing; documents schema-less consumer contract via ISSUE_AUTHOR_RESULT_V1_SCHEMA_LESS_CONTRACT constant. - tests/test_producer_fail_closed.py: 11 new tests covering AC1-AC7. Closes #1165
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-1194/ The preview will be removed when this PR is closed. |
squne121
left a comment
There was a problem hiding this comment.
PR #1194 review by review_subagent (claude-sonnet-4-6) head=fb6682f3d19ec3d1b6c70223bdbc90530af50ca4 --- LOOP_VERDICT_V2: {verdict: APPROVE, merge_ready: true, required_auto_actions: [], allowed_paths_gate: {status: ok, producer_role: review_subagent, worker_report_used_as_canonical: false, gate_result: ALLOWED_PATHS_GATE_RESULT_V1=ok, all_files_within_allowed_paths: true, contract_source_kind: issue_comment, contract_source_id: 4813956941, expected_contract_fingerprint: sha256:2f64fb40533d894a885e9c2922468fe92d4680c06331b54693bc5ba2df75d85a}, blockers: [], ac_coverage: {AC1: pass, AC2: pass, AC3: pass, AC4: pass, AC5: pass, AC6: pass, AC7: pass, AC8: pass}, pr_review_url: https://github.com/squne121/loop-protocol/pull/1194}
判定: REQUEST_CHANGESPR #1194 は既存の P0:
|
B1: compact_author_result - status missing → schema_mismatch (not default ok) B2: _emit_failure_envelope - ARTIFACT_SHA256 always present (write_failed fallback) B3: compact_review/author - success artifact written AFTER budget check (not before) B4: AC7 test - --repo-root positive/negative tests instead of --artifact-dir only B5: AC3 test - verify no compact_*_result_*.json remains after budget violation P1-6: except (ValueError, Exception) → explicit (ValueError, _jsonschema.ValidationError, OSError) P1-7: compact_author_result uses _strict_json_loads (allow_nan=False) Closes #1165
B3 修正(artifact write を budget check 後に移動)で compact_review_result と compact_author_result の戻り値が 2-tuple → 4-tuple に変更されたため、 既存 unit test の unpack を starred assignment / _atomic_write 呼び出しに修正。 対象テストファイル: - test_compact_review_result.py - test_compact_author_result.py - test_artifact_security.py Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…on に追加 test_producer_fail_closed.py が .claude/skills/issue-refinement-loop/scripts/tests/ に配置されており、python-test-plan.json の targets に同ディレクトリが未登録だったため、 generate_ci_test_selection_artifact.py が "Uncovered tests: 1" を報告していた。 .claude/skills/create-issue/scripts/tests/ 等と同様に scripts/tests/ を追加する。 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
squne121
left a comment
There was a problem hiding this comment.
LOOP_VERDICT_V2: verdict=APPROVE merge_ready=true reviewed_head_sha=e0c49f8c blockers=[] AC1-AC8=all_pass allowed_paths_gate=ok_with_scope_delta_note summary=iter0-B1-B5修正済み-CI全green
squne121
left a comment
There was a problem hiding this comment.
review_subagent iteration=1 head=e0c49f8c. B1-B5 all fixed. AC1-AC8 all pass. CI all green. Allowed paths gate ok_with_scope_delta_note. Full LOOP_VERDICT_V2 follows. LOOP_VERDICT_V2 verdict=APPROVE merge_ready=true reviewed_head_sha=e0c49f8c5bf2a7947b8e0b965b3e56391ee3109c required_auto_actions=[] blockers=[] ac_coverage all pass allowed_paths_gate status=ok_with_scope_delta_note producer_role=review_subagent worker_report_used_as_canonical=false contract_source_kind=issue_comment contract_source_id=4813956941 expected_contract_fingerprint=sha256:2f64fb40533d894a885e9c2922468fe92d4680c06331b54693bc5ba2df75d85a summary=iter0-B1-B5全修正-AC1-AC8全PASS-CI全green
概要
issue-refinement-loopの producer 系スクリプト(compact_review_result.py、compact_author_result.py)の fail-closed routing を固定する。スキーマ不一致・出力バジェット超過・終端バイパス検出時に canonical failure envelope を stdout に出力し、
publish_termination_report.py/_post_github_comment()を一切呼ばない設計を実装した。変更内容
compact_review_result.py_write_failure_artifact()関数追加:PRODUCER_FAILURE_V1JSON をアーティファクト dir に書き込む_emit_failure_envelope()関数追加:5 フィールド envelope(STATUS/NEXT_ACTION/REASON_CODE/ARTIFACT/ARTIFACT_SHA256)を stdout に出力main()の 4 つの failure path を envelope 出力に置き換え:JSON パースエラー・schema mismatch・シークレット検出・出力バジェット超過except (ValueError, Exception)でjsonschema.ValidationErrorを補足(jsonschema 4.x ではValueErrorサブクラスでない)compact_author_result.py_write_failure_artifact()/_emit_failure_envelope()追加ISSUE_AUTHOR_RESULT_V1_SCHEMA_LESS_CONTRACT定数でスキーマレス consumer contract を文書化(AC6)main()の 5 つの failure path を envelope 出力に置き換えtests/test_producer_fail_closed.py(新規)11 テストで AC1–AC7 を検証:
test_review_compact_schema_mismatch_emits_failure_artifact— AC1/AC2test_review_compact_invalid_verdict_emits_failure_artifact— AC2test_review_compact_output_budget_violation_is_machine_readable— AC3test_author_compact_schema_mismatch_emits_failure_artifact— AC2/AC6test_author_compact_ok_without_body_hash_emits_failure— AC6test_author_compact_schema_less_contract_fields— AC6test_preflight_planner_fail_closed_payload_invalid_routes_environment_failure— AC2(_apply_exit_code_mappingユニットテスト)test_producer_failure_never_invokes_publish_termination_report— AC4(AST 解析 + subprocess 検証)test_termination_bypass_fixture_call_count_zero— AC4(monkeypatch)test_failure_stdout_never_contains_raw_issue_body_or_comment— AC1test_canonical_artifact_path_in_failure_artifact— AC7(--repo-root付き canonical path 検証)docs/dev/agent-skill-boundaries.md#1154 / #1165 / #1166の責務分割テーブルを追加検証結果
pnpm typecheck/pnpm lint/pnpm test(1123 tests) /pnpm build全 PASStest_model_routing.py21 PASSCloses #1165(producer fail-closed routing 実装完了)