feat(TASK-0872): #872 PR-2 — c3-prime 受理器(非HO)+ HO patch 群(Human 適用)#889
Merged
Conversation
受理側実装を非 HO と HO に分離。本コミットは非 HO(AI コミット可能): - scripts/ai-loop/c3prime_verify.py 新設(非 HO・bin/plangate 共有ヘルパー): approvals/c3.json の approval_kind を strict JSON 判別。c3-prime なら契約 §4 の 全束縛(plan_hash / artifact_hashes / plan_package_hash / source_sha / reviewer snapshot 三つ組 / decision-verdict 整合 / decision allowlist)を再検証(trust boundary・#887 F-4)。exit 0=受理 / 10=legacy 委譲 / 1=fail-closed - tests/extras/ta-55-c3prime-accept.sh: c3prime_verify.py を直接叩く E2E(valid/ 改竄/legacy/未知 approval_kind の 4 ケース・CI 常時 PASS)+ HO 適用後の bin/plangate 全鎖テスト(未適用時 SKIP)。set -eu 安全な rc 捕捉 - docs/working/TASK-0872/patches/: HO patch 群(Human 適用)— bin-plangate.patch/.new(validate+exec に _plangate_c3_dispatch 配線・legacy 非変更・ git apply --check clean 実証・sandbox で全 6 exit code 実測)/ ai-loop-workflow command patch ×2(run 入口 TASK 必須化)/ c3-prime.schema.json(#888 で同梱済)/ ho-apply-approval.md(適用手順・検証結果) HO 適用(bin/plangate・commands ×2・schemas/)は Human-owned のため本 PR には含めず、 ho-apply-approval.md に集約。未適用の間 c3-prime は legacy grep で FAIL / schema-validate は F-8 で ERROR(fail-closed・Shadow Config なし)。 Refs: #872 <!-- skip-issue-link-check --> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Codex 敵対的レビュー(受理側・reject: critical 1/high 2/medium 1)を全件一次ソース 再現裁定し是正: - R-026 critical: c3prime_verify.py が偽造 record(source_sha 不整合・必須欠落・ c3_status 混入・未知キー)を AUTO_APPROVED 受理していた(再現 CONFIRMED)→ 構造 allowlist + 必須キー + c3_status 拒否 + task_id/phase 検証 + evidence/policy/ issued 非空 + optional expected_sha 照合(exec preflight が git rev-parse HEAD を渡し source_sha を厳密照合・契約 §4) - R-027 high: 受理器不在時 approval_kind=[]/null/不正 JSON が legacy 委譲されていた → fallback を「approval_kind キーが物理的に無い場合のみ 10、存在すれば値不問で 1」へ - R-028 high TOCTOU: exec preflight が再検証の実点であることを契約 §4 に明記 + 残余窓は Phase 1 許容・flock 単一 snapshot を V2 候補化 - R-029 medium: test_c3prime_verify.py 新設(producer 非依存の手 mutate 14 パターン)+ ta-55 に手偽造ケース追加 - R-030 info: || _c3_rc=0 の set -e 安全性は指摘なし sandbox 実適用テストで非退行(legacy/正規 record 受理)+ 偽造 reject + expected_sha BLOCK を実測。bin-plangate.patch 再生成(git apply --check clean)。全変更は非 HO (bin/plangate は patches/ のみ・Human 適用)。 検証: test_c3prime_verify 6 / test_plan_package 30 / run-tests 411 passed(TA-55 に 手偽造ケース含む) Refs: #889, #872 <!-- skip-issue-link-check --> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…性 + nested schema(R2-01〜06) Codex 再レビュー(是正後により深い critical/high を検出)を全件一次ソース再現裁定し是正: - R2-01 critical: 受理器が C-1/C-2 evidence 内容を再検証せず、FAIL/reject/marker 無し evidence + 再 hash 済み record が HEAD 照合付きでも受理していた(CONFIRMED)→ 受理側でも plan_package.check_evidence を実行し marker/stale を再検証 - R2-02 high: task_id が task_dir に非束縛 → task_dir.name == task_id を必須化 - R2-03 high: reviewer 独立性偽装(model_a==model_b)→ evidence_ref 相異を必須化 - R2-04 high: 非 git exec で HEAD 空 → 照合 skip 受理(fail-open)→ c3-prime かつ HEAD 空は exec 即 BLOCK(sandbox 実測で確認) - R2-05 medium: schema 同等の nested 制約(issued_at 形式・extra reviewer・snapshot 未知キー・非 string 注釈)→ 受理器に型/additionalProperties 相当を追加 - R2-06 medium: sync に verifier 欠落 → sync-plugin-plangate.sh の copy + delete 保護へ追加 契約 §4 に受理側再検証範囲 + 脅威モデル境界(record+tree 双方書換は git-tree 束縛/署名で のみ防御 = V2)を明記。test_c3prime_verify.py に R2 回帰 5 テスト追加(計 11)。 R2-07(受理ロジックが HO 機械強制対象外)は承認境界ガバナンス決定のため Human 判断待ち (review-external.md)。全変更は非 HO(bin/plangate は patches/ のみ)。 検証: test_c3prime_verify 11 / test_plan_package 30 / sandbox 実適用(非 git exec BLOCK 含む) Refs: #889, #872 <!-- skip-issue-link-check --> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- R2-07(受理ロジックの HO 機械強制): Human 決定 B(現状維持 + V2 明記)を known-issues.md KI-1 に記録。HO 化は将来判断 - KI-2 脅威モデル境界(git-tree 束縛/署名 V2)/ KI-3 TOCTOU / KI-4 切り戻し - ho-apply-approval.md に切り戻し手順(git apply -R)+ legacy 非退行確認を追記 Refs: #889, #872 <!-- skip-issue-link-check --> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… + doc 精度(R3-01〜05) Codex + Sonnet 独立レビュー(R2 是正後)の minor/info を是正(新規 critical/high なし): - R3-01: patch ファイルの trailing whitespace(unified diff 空行 context マーカー)→ patches/.gitattributes で *.patch を whitespace 検査除外(完成形 .new は元々 clean) - R3-02: artifact_hashes 個別改竄(plan.md 以外)の専用テスト欠落 → test_artifact_hashes_individual_tampering 追加(12 テスト) - R3-03: known-issues KI-1 の verbatim 一次証跡 → decision-log に選択肢原文追記 - R3-04: ho-apply 切り戻しに cp 経路(git checkout -- bin/plangate)併記 - R3-05: 契約 §4 の静的 validate は source_sha 形式チェックのみを明記 CI: CodeQL fail は GitHub 503 障害中のインフラ失敗 → 再実行で pass 実測。全 checks green。 3 ラウンドの敵対レビューで穴収束(R1 表層→R2 深層→R3 test 網羅・doc 精度)。 Refs: #889, #872 <!-- skip-issue-link-check --> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
issue #872 の PR-2。ai-loop C-3'(c3-prime record)を
bin/plangate validate/ exec preflight が受理する経路を実装する。承認境界の受理側(セキュリティ critical)。設計判断:
scripts/ai-loop/*.pyは HO 対象外のため、c3-prime 検証本体をc3prime_verify.py(非 HO・本 PR でコミット) に分離し、bin/plangate側は配線数行(HO・Human 適用)に縮小した。本 PR に含む(非 HO)
scripts/ai-loop/c3prime_verify.py: approval_kind を strict JSON 判別し、c3-prime なら契約 §4 の全束縛を再検証(trust boundary / fix(plan-package): #886 敵対的レビュー残件 — PR-2(c3-prime 受理側)着手前に F-1/F-3/F-5 是正必須 #887 F-4)— plan_hash・artifact_hashes 全数・plan_package_hash 再計算・source_sha・reviewer snapshot 三つ組一致・decision↔verdict 整合・decision allowlist。exit 0=受理 /10=legacy 委譲 /1=fail-closedtests/extras/ta-55-c3prime-accept.sh: E2E(valid=0 / 改竄=1 / legacy=10 / 未知 approval_kind=1 の 4 ケース・CI 常時実行)+ HO 適用後の bin/plangate 全鎖テスト(未適用時 SKIP)docs/working/TASK-0872/patches/: HO patch 群 +ho-apply-approval.mdHO 適用(Human-owned・本 PR には含めない)
ho-apply-approval.mdに集約。対象 4 ファイル:bin/plangate(validate+exec 配線)/.claude/commands/ai-loop-workflow.md+ plugin 同期(run 入口 TASK 必須化)/schemas/c3-prime.schema.json。AI 実施済み検証(sandbox 実適用テスト・推測でない):
実適用テスト中に
set -eu下で dispatch の非ゼロ戻り(10=legacy)がスクリプトを中断するバグを捕捉し|| _c3_rc=$?で修正済み。bin-plangate.patchはgit apply --checkclean 通過。安全性(未適用の間)
c3-prime artifact は legacy grep 経路で
c3_status不在により FAIL、schema-validate は #887 F-8 で ERROR。いずれも fail-closed で Shadow Config なし。テスト
sh tests/run-tests.sh→ TA-55(4 PASS + HO SKIP)・TA-05 F-8 PASS。(ローカル ta-42 TC-04 の 1 failed は macOS sh の set -e 挙動差による既存偽陽性で、main CI = success・PR-2 非改変領域)Refs #872
🤖 Generated with Claude Code