Skip to content

fix: snapshot author readbackを正規化する - #1665

Merged
squne121 merged 3 commits into
mainfrom
worktree-issue-1664-snapshot-author-readback-latest
Jul 20, 2026
Merged

squne121 merged 3 commits into
mainfrom
worktree-issue-1664-snapshot-author-readback-latest

Conversation

@squne121

@squne121 squne121 commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • 単一 Issue comment readback を、trusted parser が要求する canonical identity projection に整合させました。
  • readback を github.com と sanitized subprocess environment に束縛し、identity tuple の欠落・型不正・allowlist 不一致を fail-closed のまま回帰テストで固定しました。
  • contract snapshot publish の pre/post live Issue body readback も、固定 github.com と metadata sanitizer に束縛しました。

Checks

  • AC1: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_canonical_projection"
  • AC2: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_production_parser_accepts_trusted_snapshot"
  • AC3: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_missing_identity_fails_closed"
  • AC4: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_tuple_mismatch_fails_closed"
  • AC5: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_readback_binds_hostname_and_sanitized_env"
  • AC6: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_fixture_preserves_existing_safeguards"
  • AC7: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -m github_live -k "single_comment_read_only_github_smoke"
  • 対象テスト全件: 66 passed, 1 deselected

受け入れ条件の達成状況

  • AC1〜AC6: canonical projection、trusted parser 受理、identity tuple の fail-closed、hostname と sanitizer の束縛、既存 safeguard 保持を対象テストで確認済みです。
  • AC5: hostile GH_HOST・GH_REPO・GH_CONFIG_DIR を親環境に設定しても、contract snapshot publish の pre/post readback が github.com と sanitized child env を使うことを確認済みです。
  • AC6: identity-bearing fixture で duplicate marker を含む条件でも exact direct comment GET のみを使い、list endpoint 非使用・trusted author・fingerprint-ready・live body triple-hash を確認済みです。
  • AC7: 実 GitHub の read-only smoke を production parser まで通し、trusted author・fingerprint-ready・authoritative go の選択成功を確認済みです。

検証コマンド結果

  • 実行結果: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -m github_live -k "single_comment_read_only_github_smoke": PASS(exit 0)
  • 対象テスト結果: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q: 66 passed, 1 deselected
  • 静的検査結果: uv run --locked ruff check --ignore E402 scripts/agent-guards/controlled_skill_mutation_exec.py scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py: PASS

Allowed Paths 遵守

Runtime Verification Evidence(動作検証証跡)

  • 実行コマンド: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -m github_live -k "single_comment_read_only_github_smoke"
  • sanitized environment: GH_PROMPT_DISABLED=1 と GH_NO_UPDATE_NOTIFIER=1 を設定し、metadata sanitizer を経由しました。
  • canonical key set: id/html_url/created_at/updated_at/body/author/author_id/author_type/author_association
  • production parser: trusted author / fingerprint-ready / authoritative go の全てを true と確認しました。
  • result: PASS(exit 0)
  • artifact: artifacts/runtime-verification-AC7-20260720T112722Z.log

Contract Snapshot Evidence(契約スナップショット証跡)

Scope Collision Evidence(スコープ競合証跡)

Schema Change Applicability

  • decision: not_schema_change
  • reason: canonical parser が既に要求する identity key set を single-comment readback に補完する変更であり、contract schema や consumer interface を変更しません。

Schema Consumer Inventory

N/A。既存 parser の正規化済み input contract へ readback projection を合わせるだけで、schema producer/consumer の追加・削除・型変更はありません。

Compatibility Decision(互換性判断)

  • change_type: N/A
  • compatibility: N/A
  • migration_required: N/A
  • migration_or_followup: N/A
  • reason: 既存の trusted parser policy と fingerprint schema は変更しません。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
単一コメント readback を固定 hostname に束縛する yes AC5 PASS N/A
subprocess environment を metadata sanitizer に束縛する yes AC5 PASS N/A
contract snapshot publish の live Issue body readback を固定 host に束縛する yes hostile-env pre/post readback PASS N/A
identity tuple の不正値を trusted author として受理しない yes AC2〜AC4 PASS N/A
実 GitHub comment を parser まで通して authoritative go を確認する yes AC7 PASS、runtime artifact N/A

Notes

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1665 closed).

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  schema: TEST_VERDICT_MACHINE/v2
  producer_kind: test-runner
  repository: squne121/loop-protocol
  issue_number: 1664
  pr_number: 1665
  head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
  reviewed_head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
  diff_head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
  contract_body_sha256: sha256:25c7826a227b920809c5f1b71030da2955830dd5a7f00f5c42c9b98434be8ba7
  run_id: test-runner-1665-6f80e2e2-20260720T103603Z
  run_url: https://github.com/squne121/loop-protocol/actions/runs/29735467768
  workflow_run_id: 29735467768
  workflow_run_attempt: 1
  check_run_id: 88329636493
  artifact:
    name: test-results
    artifact_digest: sha256:028c7584452b133f639f428ffac7e56ae6b71c55096094a63c5c8515b9cb8635
    url: https://github.com/squne121/loop-protocol/actions/runs/29735467768/artifacts/8458146889
  artifact_payload:
    issue_number: 1664
    pr_number: 1665
    head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
    reviewed_head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
    diff_head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
    contract_body_sha256: sha256:25c7826a227b920809c5f1b71030da2955830dd5a7f00f5c42c9b98434be8ba7
    command_hashes:
      - sha256:84fea5a0156ec4db21f6def2982ec354f4c3d3a98146af3880420b4429c70c33
      - sha256:8f93fa27e2d785f91518ff94866a4a273928d20d2a2739ffed0923582784885b
      - sha256:b1d546963600b951cb663a31beb8d206c24b7adf99c29958406086379359aaa9
      - sha256:c1504b4762c6a274bc94215eb80f5b174f01ceecc6729b95e53cbc933bab780f
      - sha256:d4a3830b5b0eb14c9251167276d3daabdca79b5bb4eab74de24934604ed381f8
      - sha256:e5dab1ecf49acb631800da8d657a7a0442f2a497a2f4a2acfb5dd8046bf84d0b
      - sha256:f05dd5e9805c91a496cf1a2ebee56db6c3e196f23380da23ccab3a8ab6bbdbc8
  artifact_payload_sha256: sha256:26269d86f2d15349de6900237e04fb0064eae111787a8475dd4d07ab1e067f28
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: BEHIND
  branch_behind_main: true
  baseline_only: false
  verification_commands_pass: 7
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_canonical_projection"
      command_hash: sha256:e5dab1ecf49acb631800da8d657a7a0442f2a497a2f4a2acfb5dd8046bf84d0b
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC2
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_production_parser_accepts_trusted_snapshot"
      command_hash: sha256:c1504b4762c6a274bc94215eb80f5b174f01ceecc6729b95e53cbc933bab780f
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC3
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_missing_identity_fails_closed"
      command_hash: sha256:d4a3830b5b0eb14c9251167276d3daabdca79b5bb4eab74de24934604ed381f8
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 9 passed, 58 deselected
    - ac: AC4
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_tuple_mismatch_fails_closed"
      command_hash: sha256:b1d546963600b951cb663a31beb8d206c24b7adf99c29958406086379359aaa9
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 4 passed, 63 deselected
    - ac: AC5
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_readback_binds_hostname_and_sanitized_env"
      command_hash: sha256:8f93fa27e2d785f91518ff94866a4a273928d20d2a2739ffed0923582784885b
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC6
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_fixture_preserves_existing_safeguards"
      command_hash: sha256:84fea5a0156ec4db21f6def2982ec354f4c3d3a98146af3880420b4429c70c33
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC7
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -m github_live -k "single_comment_read_only_github_smoke"
      command_hash: sha256:f05dd5e9805c91a496cf1a2ebee56db6c3e196f23380da23ccab3a8ab6bbdbc8
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected; artifacts/runtime-verification-AC7-20260720T103603Z.log
VC_ADJUDICATION_RESULT_V1:
  schema_version: 1
  overall_status: indeterminate
  blocking: true
  rerun_required: true
  errors:
    - unsupported_baseline_classification:AC7
  per_ac: []
  source_integrity:
    evidence_complete: true
    evidence_fresh: true
    contract_body_sha256: sha256:25c7826a227b920809c5f1b71030da2955830dd5a7f00f5c42c9b98434be8ba7
    head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
    current_vc_result_head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
    diff_summary_head_sha: 6f80e2e2c3a588cfd8c2f9291030a42b440f2361
    baseline_items_count: 7
    current_items_count: 7
  note: AC1-AC7の実行はPASSだが、fresh snapshotのAC7がruntime_onlyかつclassification=skippedのためadjudicatorはfail-closed

検証結果

AC1〜AC7の契約VCはすべてexit 0です。AC7は実GitHub read-only smokeでPASSし、fallbackおよびSKIPはありません。C1判断コメントも再確認済みです。

ただし、fresh contract snapshotのAC7 preflight classificationがskippedのため、VC adjudicatorはunsupported_baseline_classification:AC7でblockingと判定します。

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  schema: TEST_VERDICT_MACHINE/v2
  producer_kind: test-runner
  repository: squne121/loop-protocol
  issue_number: 1664
  pr_number: 1665
  head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
  reviewed_head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
  diff_head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
  contract_body_sha256: sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba
  run_id: test-runner-1665-4eb2c443-20260720T105706Z
  run_url: https://github.com/squne121/loop-protocol/actions/runs/29736561242
  workflow_run_id: 29736561242
  workflow_run_attempt: 1
  check_run_id: 88333160369
  artifact:
    name: test-results
    artifact_digest: sha256:921579ee7a8311a6d7666358148cc81af994f93e9b0dc3a2f9fcc454a623744b
    url: https://github.com/squne121/loop-protocol/actions/runs/29736561242/artifacts/8458589676
  artifact_payload:
    issue_number: 1664
    pr_number: 1665
    head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
    reviewed_head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
    diff_head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
    contract_body_sha256: sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba
    command_hashes:
      - sha256:84fea5a0156ec4db21f6def2982ec354f4c3d3a98146af3880420b4429c70c33
      - sha256:8f93fa27e2d785f91518ff94866a4a273928d20d2a2739ffed0923582784885b
      - sha256:b1d546963600b951cb663a31beb8d206c24b7adf99c29958406086379359aaa9
      - sha256:c1504b4762c6a274bc94215eb80f5b174f01ceecc6729b95e53cbc933bab780f
      - sha256:d4a3830b5b0eb14c9251167276d3daabdca79b5bb4eab74de24934604ed381f8
      - sha256:e5dab1ecf49acb631800da8d657a7a0442f2a497a2f4a2acfb5dd8046bf84d0b
      - sha256:f05dd5e9805c91a496cf1a2ebee56db6c3e196f23380da23ccab3a8ab6bbdbc8
  artifact_payload_sha256: sha256:1dd208e41084a7157d07f0f38812053755a4761509f450b4d10a07b30f879ea3
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 7
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_canonical_projection"
      command_hash: sha256:e5dab1ecf49acb631800da8d657a7a0442f2a497a2f4a2acfb5dd8046bf84d0b
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC2
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_production_parser_accepts_trusted_snapshot"
      command_hash: sha256:c1504b4762c6a274bc94215eb80f5b174f01ceecc6729b95e53cbc933bab780f
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC3
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_missing_identity_fails_closed"
      command_hash: sha256:d4a3830b5b0eb14c9251167276d3daabdca79b5bb4eab74de24934604ed381f8
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 9 passed, 58 deselected
    - ac: AC4
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_tuple_mismatch_fails_closed"
      command_hash: sha256:b1d546963600b951cb663a31beb8d206c24b7adf99c29958406086379359aaa9
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 4 passed, 63 deselected
    - ac: AC5
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_readback_binds_hostname_and_sanitized_env"
      command_hash: sha256:8f93fa27e2d785f91518ff94866a4a273928d20d2a2739ffed0923582784885b
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC6
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_fixture_preserves_existing_safeguards"
      command_hash: sha256:84fea5a0156ec4db21f6def2982ec354f4c3d3a98146af3880420b4429c70c33
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC7
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -m github_live -k "single_comment_read_only_github_smoke"
      command_hash: sha256:f05dd5e9805c91a496cf1a2ebee56db6c3e196f23380da23ccab3a8ab6bbdbc8
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected; artifacts/runtime-verification-AC7-20260720T105706Z.log
VC_ADJUDICATION_RESULT_V1:
  schema_version: 1
  overall_status: pass
  blocking: false
  rerun_required: false
  errors: []
  per_ac:
    - {ac: AC1, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC2, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC3, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC4, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC5, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC6, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC7, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
  source_integrity:
    evidence_complete: true
    evidence_fresh: true
    contract_body_sha256: sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba
    head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
    current_vc_result_head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa
    diff_summary_head_sha: 4eb2c44358d127a1ad63af98e3854e023b9ee1fa

検証結果

AC1〜AC7を現行HEADで逐語実行し、全件exit 0でした。AC7は実GitHub read-only smokeでPASSし、fallback・SKIPはありません。

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Evidence Check

  • AC1–AC7: 最新の TEST_VERDICT_MACHINE(HEAD 4eb2c44358d127a1ad63af98e3854e023b9ee1fa)で全件 PASS、SKIP・fallback はありません。
  • 契約snapshot: CONTRACT_REVIEW_RESULT_V1 status: go、body hash sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba と一致しています。
  • C1: #1632 との C1/non-conflict 判断を確認しました。
  • Allowed Paths: 再計算結果は ok。変更2ファイルはいずれも契約内です。
  • CI: CI_VERDICT_SUMMARY_V1 status: all_pass。
  • Schema: not_schema_change。Safety Claim Matrix は全claimに証跡があり、未制御項目はありません。

Blockers

  • なし。

Required auto action

  • PR本文に必須の 受け入れ条件の達成状況、検証コマンド結果、Allowed Paths 遵守 セクションがありません。内容は既に記載済みのため、本文整形のみを実行してください。
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "4eb2c44358d127a1ad63af98e3854e023b9ee1fa"
  merge_ready: false
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions:
    - kind: update_pr_body_hygiene
      executor: implementation-worker
      skill: open-pr.update_pr
      blocking_merge_ready: true
      mechanical: true
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - scripts/agent-guards/controlled_skill_mutation_exec.py
      - scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py
  allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE、merge_state_status=CLEAN を現行HEADで確認しました。

Evidence Check

  • AC1–AC7: 現行HEADの TEST_VERDICT_MACHINE と VC_ADJUDICATION_RESULT_V1 は全件 PASS で、SKIP・fallback はありません。
  • 契約snapshot: CONTRACT_REVIEW_RESULT_V1 status: go と body hash が一致しています。
  • C1: #1632 との C1/non-conflict 判断を live readback しました。
  • PR本文: 受け入れ条件の達成状況、検証コマンド結果、Allowed Paths 遵守 を確認しました。
  • Allowed Paths: 再計算結果は ok、変更2ファイルはいずれも契約内です。
  • CI: CI_VERDICT_SUMMARY_V1 status: all_pass。
  • Schema / Safety: not_schema_change、Safety Claim Matrix に未制御項目はありません。

Blockers

  • なし。
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "4eb2c44358d127a1ad63af98e3854e023b9ee1fa"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions: []
  auto_fix_applied:
    - update_pr_body_hygiene
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - scripts/agent-guards/controlled_skill_mutation_exec.py
      - scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py
  allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES — 修正方針は正しいものの、remote_postcondition_verified=True を「github.com に source-bound」と断定できない経路が残っています。

PRは現行HEAD 4eb2c443...、Draft、変更は2ファイルです。CIは現行HEADに対して成功しています。

中核修正自体は妥当です。GitHub RESTの単一Issue commentレスポンスには、nested user.login、user.id、user.type とtop-level author_association が存在します。今回追加されたprojectionは公式レスポンス形状と一致し、gh api --hostname github.com --jq ... の使い方も正しいです。 ([GitHub CLI]1)

1. High: 最終Issue本文readbackが固定ホスト・sanitized envに束縛されていない

単一コメントGETは、明示的な--hostname github.comと_build_metadata_sanitized_env()を使用しています。ところが、その後に成功判定の一部として実行されるlive Issue body再取得は、_fetch_issue_body_and_updated_at()をそのまま呼んでいます。

そのhelperは現在、次の形式です。

gh issue view <number> --repo owner/repo --json body,updatedAt

--hostname相当の指定も、sanitized envもありません。

リポジトリ自身のpolicyは、GH_HOST、GH_REPO、GH_CONFIG_DIRなどを「ghの接続先や設定を変更し得る親環境」としてsanitize対象にしています。しかし、このfinal readbackではそのpolicyが適用されていません。

GitHub CLIの公式仕様でも、hostnameが明示されずローカルrepository contextから推論できない場合はGH_HOSTが使用されます。また、gh issue view --repoは[HOST/]OWNER/REPO形式を受け付けます。つまり現在のargvだけでは、final body readbackが必ずgithub.comを参照するという構造的保証がありません。([GitHub CLI]2)

必須修正

_fetch_issue_body_and_updated_at()にenvと固定hostを渡せるようにし、少なくともcontract_snapshot.publishのpreconditionとpostconditionで同じ境界を使うべきです。

推奨は、CLIのrepository inferenceを避けてRESTへ統一する形です。

[
    gh_bin,
    "api",
    "--hostname",
    _TRUSTED_GITHUB_HOST,
    f"repos/{repo}/issues/{issue_number}",
    "--jq",
    "{body, updatedAt: .updated_at}",
]

これをenv=_build_metadata_sanitized_env()で実行してください。

テストではGH_HOST=attacker.example、GH_REPO=other/repo、GH_CONFIG_DIR=/tmp/evilを親環境に設定し、final body取得のargvがgithub.comへ固定され、これらの環境変数が子プロセスへ渡らないことを検証する必要があります。

2. High: 実GitHub smokeがproduction parserまで到達していない

今回の根本障害は、単に「APIにフィールドがあるか」ではなく、次の結合境界でした。

REST response
→ gh --jq projection
→ normalized comment
→ production parser
→ trusted-author判定
→ fingerprint-ready判定

しかし新規テストは、この経路を分割して検証しています。

  • projection unit testは、mockが最初から正規化済みdictを返します。
  • production parser testも、最初から正規化済みfixtureを直接parserへ渡します。
  • live smokeはkey集合とauthor_idが整数であることしか確認しません。

production parserのtrust判定は、positive non-bool integer ID、login、type、associationの完全一致を要求します。単にキーが存在するだけでは受理されません。

またparserは、正規化フィールドを読み取った後にis_trusted_authorとis_fingerprint_readyを計算し、find_latest_authoritative_go()で両方を要求します。

必須修正

live testで取得した実commentをproduction parserへ渡し、少なくとも以下をassertしてください。

assert comment["id"] == _SINGLE_COMMENT_ID
assert comment["html_url"] == _SINGLE_COMMENT_URL

results = parser.parse_contract_review_results([comment], issue_url)

assert len(results) == 1
assert results[0]["is_trusted_author"] is True
assert results[0]["is_fingerprint_ready"] is True
assert parser.find_latest_authoritative_go(results) == results[0]

対象のcomment 5015599730は実際にCONTRACT_REVIEW_RESULT_V1 status: goとsource-bound fingerprintを持つため、このintegration assertionは成立します。

runtime artifactにもkey集合だけでなく、以下を残すべきです。

  • comment IDとURLの一致
  • identity tupleの検証結果
  • production parserの受理結果
  • fingerprint-ready結果
  • authoritative-go選択結果

3. Medium: AC6の「identity-bearing fixtureで既存safeguard維持」が実際には証明されていない

Issue #1664のAC6は、identity-bearing REST fixtureを使用した状態で、exact comment-ID binding、duplicate-marker回避、fingerprint readiness、live Issue body triple-hashを維持することを要求しています。

しかし既存のduplicate-markerテストは、現在も以下の5フィールドしか返していません。

id / html_url / created_at / updated_at / body

identity tupleを持たず、production trust判定も通っていません。

一方、新規のtest_single_comment_identity_fixture_preserves_existing_safeguardsはidentity tupleを持ちますが、

  • duplicate markerを実際に用意していない
  • direct GETが一回だけだったことをassertしていない
  • list-all-comments APIを呼んでいないことをassertしていない
  • production parserではなくfunctional test fixtureに依存している

という状態です。

必須修正

既存duplicate-markerテストのpayloadをcanonical identity-bearing payloadに更新するのが最小修正です。その上で、production parserを経由し、以下を同一テストで確認してください。

  • exact comment IDのendpointだけが呼ばれる
  • comment list endpointは呼ばれない
  • trusted authorとして受理される
  • fingerprint-readyである
  • live body triple-hash一致時だけ成功する

現状のPR本文にある「AC6 PASS」は、契約上は過大評価です。

4. Low: AC5テストがAC1テストの再実行にすぎない

test_single_comment_readback_binds_hostname_and_sanitized_env()は、独立した検証をせず、別のtest methodを直接呼び出しています。

def test_single_comment_readback_binds_hostname_and_sanitized_env(self):
    self.test_single_comment_canonical_projection()

これによりpytest上は別のPASSとして計上されますが、独立したfailure surfaceは増えていません。共通helperへassertionを抽出するか、AC5専用にhostile environmentを設定したテストへ置き換えるべきです。

非ブロッカーの設計改善

executor側とproduction parser側に、同一projection文字列が別々にハードコードされています。parser側は既に同じidentity projectionを使用していますが、今後のprojection driftを型や共有定数で防いでいるわけではありません。

Issue #1664では共有定数化がOut of Scopeなので、このPRのブロッカーにはしません。ただし、次のいずれかはfollow-upとして必要です。

  • canonical projectionを共有moduleへ移す
  • projection文字列ではなくcanonical key setを独立したcontract testで比較する
  • raw REST fixtureへ実際のjqを適用するcontract testを追加する

最終結論

コード本体の「単一comment GETにidentity tupleを追加する」という修正は正しいです。現在のCI成功も確認できています。

ただし、マージ前に最低限必要なのは次の3点です。

  1. live Issue bodyのpre/post readbackも固定github.comとsanitized envへ束縛する
  2. 実GitHub smokeをproduction parser・trusted author・fingerprint readinessまで接続する
  3. duplicate-marker回帰をidentity-bearing fixtureへ更新し、AC6を実際に証明する

このレビューはGitHub上の現行HEAD、関連Issue・コメント・CI・リポジトリ資産と公式GitHub REST/CLI仕様に対する静的レビューです。ローカルでのpytest再実行は行っていません。

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  schema: TEST_VERDICT_MACHINE/v2
  producer_kind: test-runner
  repository: squne121/loop-protocol
  issue_number: 1664
  pr_number: 1665
  head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
  reviewed_head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
  diff_head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
  contract_body_sha256: sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba
  run_id: test-runner-1665-64a4b462-20260720T113302Z
  run_url: https://github.com/squne121/loop-protocol/actions/runs/29738768227
  workflow_run_id: 29738768227
  workflow_run_attempt: 1
  check_run_id: 88340328965
  artifact:
    name: test-results
    artifact_digest: sha256:85700888b752d4ad25aa7b4aaa7baaab294261cbfdf1044fe929a576e64059eb
    url: https://github.com/squne121/loop-protocol/actions/runs/29738768227/artifacts/8459486883
  artifact_payload:
    issue_number: 1664
    pr_number: 1665
    head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
    reviewed_head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
    diff_head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
    contract_body_sha256: sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba
    command_hashes:
      - sha256:84fea5a0156ec4db21f6def2982ec354f4c3d3a98146af3880420b4429c70c33
      - sha256:8f93fa27e2d785f91518ff94866a4a273928d20d2a2739ffed0923582784885b
      - sha256:b1d546963600b951cb663a31beb8d206c24b7adf99c29958406086379359aaa9
      - sha256:c1504b4762c6a274bc94215eb80f5b174f01ceecc6729b95e53cbc933bab780f
      - sha256:d4a3830b5b0eb14c9251167276d3daabdca79b5bb4eab74de24934604ed381f8
      - sha256:e5dab1ecf49acb631800da8d657a7a0442f2a497a2f4a2acfb5dd8046bf84d0b
      - sha256:f05dd5e9805c91a496cf1a2ebee56db6c3e196f23380da23ccab3a8ab6bbdbc8
  artifact_payload_sha256: sha256:5cace588f2fb94bb186628ef6220187a8d3e421e342587811e22d67d25ce9b24
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 7
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_canonical_projection"
      command_hash: sha256:e5dab1ecf49acb631800da8d657a7a0442f2a497a2f4a2acfb5dd8046bf84d0b
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC2
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_production_parser_accepts_trusted_snapshot"
      command_hash: sha256:c1504b4762c6a274bc94215eb80f5b174f01ceecc6729b95e53cbc933bab780f
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 1 passed, 66 deselected
    - ac: AC3
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_missing_identity_fails_closed"
      command_hash: sha256:d4a3830b5b0eb14c9251167276d3daabdca79b5bb4eab74de24934604ed381f8
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 9 passed, 58 deselected
    - ac: AC4
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_tuple_mismatch_fails_closed"
      command_hash: sha256:b1d546963600b951cb663a31beb8d206c24b7adf99c29958406086379359aaa9
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 4 passed, 63 deselected
    - ac: AC5
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_readback_binds_hostname_and_sanitized_env"
      command_hash: sha256:8f93fa27e2d785f91518ff94866a4a273928d20d2a2739ffed0923582784885b
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: hostile GH_HOST/GH_REPO/GH_CONFIG_DIR sanitized; 1 passed, 66 deselected
    - ac: AC6
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -k "single_comment_identity_fixture_preserves_existing_safeguards"
      command_hash: sha256:84fea5a0156ec4db21f6def2982ec354f4c3d3a98146af3880420b4429c70c33
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: identity-bearing exact comment-ID and duplicate-marker safeguards; 1 passed, 66 deselected
    - ac: AC7
      command: uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q -m github_live -k "single_comment_read_only_github_smoke"
      command_hash: sha256:f05dd5e9805c91a496cf1a2ebee56db6c3e196f23380da23ccab3a8ab6bbdbc8
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: production parser trusted-author/fingerprint/authoritative-go PASS; artifacts/runtime-verification-AC7-20260720T113302Z.log
VC_ADJUDICATION_RESULT_V1:
  schema_version: 1
  overall_status: pass
  blocking: false
  rerun_required: false
  errors: []
  per_ac:
    - {ac: AC1, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC2, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC3, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC4, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC5, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC6, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
    - {ac: AC7, status: pass, reason_code: pr_review_only_runtime_evidence_pass}
  source_integrity:
    evidence_complete: true
    evidence_fresh: true
    contract_body_sha256: sha256:ab409522d7be8ae845020de2def7b37841a52f6dc7929f56fe9ecbd4c3f89eba
    head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
    current_vc_result_head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c
    diff_summary_head_sha: 64a4b462fca9220463dcb72f42d06802e171db8c

レビュー指摘の再検証

  • High: final Issue body readbackはgithub.comとmetadata sanitizerへ束縛され、hostile environment regressionがPASS。
  • High: 実GitHub smokeはproduction parser、trusted-author、fingerprint-ready、authoritative-goまでPASSし、artifactに記録。
  • Medium: identity-bearing fixtureでexact comment-ID、duplicate-marker回避、parser受理、triple-hash postconditionを確認。
  • Low: AC5は独立したhostile environment testで検証。

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • 現行HEADで mergeable=MERGEABLE、merge_state_status=CLEAN を確認しました。

Evidence Check

  • required checks: wait_ci_checks.sh --required --head-sha が pass。ci-verdict-summary を含むrequired checksは完了しています。
  • AC1–AC7: HEAD 64a4b462fca9220463dcb72f42d06802e171db8c の TEST_VERDICT_MACHINE と VC_ADJUDICATION_RESULT_V1 は全件PASSで、SKIP・fallbackはありません。
  • High: contract snapshot publish のpre/post live Issue body readbackは固定 github.com とmetadata sanitizerに束縛され、hostile environment regressionを確認しました。
  • High: 実GitHub smokeはproduction parser、trusted-author、fingerprint-ready、authoritative-go選択まで確認しています。
  • Medium/Low: identity-bearing fixtureによるexact comment-ID・duplicate-marker safeguardと、独立hostile-environment検証を確認しました。
  • 契約snapshot、C1/non-conflict判断、PR本文の必須証跡セクションをlive readbackしました。
  • Allowed Paths: 再計算結果は ok。変更2ファイルはいずれも契約内です。
  • Schema / Safety: not_schema_change。Safety Claim Matrixの未制御項目はありません。

Blockers

  • なし。
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "64a4b462fca9220463dcb72f42d06802e171db8c"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - scripts/agent-guards/controlled_skill_mutation_exec.py
      - scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py
  allowed_paths_gate_source: review_subagent

@squne121
squne121 marked this pull request as ready for review July 20, 2026 11:55
@squne121
squne121 merged commit 0ab536c into main Jul 20, 2026
26 checks passed
@squne121
squne121 deleted the worktree-issue-1664-snapshot-author-readback-latest branch July 20, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: controlled publisherのsnapshot author readbackを修正する

1 participant