Repository navigation
feat(#550): generalize scope collision detection with scope_context - #554
Conversation
語彙一致による誤エスカレーションを抑止するため、scope rollup の衝突判定を 構造化コンテキスト(scope_context / domain_flags / ordering_constraint)ベースへ汎用化する。 - scope_context を追加(anchor_paths / conflicting_anchors / domain_flags / conflict_type / escalation_required) - domain_flags を audit 専用分類として追加(security/schema/metadata/workflow/ runtime/docs)— 判定の主因にしない - ordering_constraint を suggested_action とは別の時間順序フィールドとして追加 - escalation を keyword 一致から scope_context.escalation_required / conflict_type==uncertain へ変更 - sub-file anchor(JSON Pointer / バックティック付きプロパティ名)を軽量抽出し、 同一ファイルでも anchor が disjoint なら escalate しない(#547/#549 パターン) - 既存 ISSUE_SCOPE_ROLLUP_DECISION_V2 フィールドは非削除(additive 拡張) - AC4/AC5 回帰テスト追加、scope-rollup-policy.md を更新 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=UNSTABLE(e2e pending のみ。conflict/merge blocker ではない)
Evidence Check
- AC coverage: ○ 全 AC1-AC7 を firsthand 検証(reviewer が PR head SHA 7aec2e5 で VC 実行)
- AC1
scope_context/ AC2domain_flags/ AC3ordering_constraint: rg で出力フィールド確認 - AC4
test_scope_rollup_treats_schema_property_keyword_as_metadata_not_domain_specific_risk: pass。escalation は語彙一致ではなくscope_context.conflict_type == same_file_disjoint_anchorで driven、security_match_evidenceは audit 記録のみ(意味的に正しい) - AC5
test_scope_rollup_escalates_uncertain_or_boundary_affecting_changes: pass。same_anchor_conflicting_operation(escalation_required==true)とuncertain(fail-safe)の両経路で human_review_required を検証 - AC6:
test_plan_issue_scope_rollup.py35 passed(B4:test_issue_author_does_not_trigger_security_auth_keyword/test_token_budget_does_not_trigger_security_token_keyword存在・pass) - AC7:
suggested_action/security_match_evidence等の既存フィールド非削除(additive)
- AC1
- Allowed Paths: 遵守。diff は 3 ファイルのみ(plan_issue_scope_rollup.py / test_plan_issue_scope_rollup.py / scope-rollup-policy.md)で issue #550 Allowed Paths と完全一致
- CI Verification: build/lint/test/typecheck/python-test/validate-generated-artifact = pass、e2e = pending
- 検証コマンド結果(firsthand): scope rollup 35 passed / model_routing 回帰ゲート 21 passed
VC 証跡注記
- PR に TEST_VERDICT_MACHINE コメントが存在せず、CI python-test job は
test_plan_issue_scope_rollup.pyを実行していない(CI_CHECK_RUN_SCOPED が対象 VC を被覆しない)。 - このため PR body self-report 単独では APPROVE 不可だが、reviewer が PR head SHA で VC を firsthand 実行し PASS を直接確認したため、self-report より強い一次証跡として採用。
Schema / Safety Gate
- Schema:
ISSUE_SCOPE_ROLLUP_DECISION_V2への additive 拡張(新規フィールドのみ、削除/rename なし)。consumer は同一 skill の orchestrator のみで additive により非破壊。schema-governance.md Initial Known Schemas 非該当 → not_schema_change として扱い consumer inventory 不要。 - Safety:
.claude/skills/**パスで safety-sensitive 判定だが、変更は security-keyword 即時停止を緩和する方向で、genuine conflict escalation(AC5)と uncertain fail-safe は保持。無限定の safe/read-only 主張なし → overclaim なし。
Blockers
- なし
Non-blockers(任意改善)
- なし(AST / tree-sitter anchor 解決, domain plugin は issue #550 Out of Scope として follow-up 明記済み)
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: UNSTABLE
reviewed_head_sha: 7aec2e508f833d394b72614225707ad2ec6c4340
recommendations: []
follow_up_issue_requests: []
判定: REQUEST_CHANGESPR #554 は方向性としては妥当です。 ただし、このまま approve は危険です。主に Issue契約とのズレ と テストが本来の失敗を固定できていない 点で止めるべきです。 Blocker 1: #550 の公開ACを満たしていない公開されている Issue #550 は、出力に 一方、PR #554 は 修正要求: #550 側の契約を更新するか、該当コメントをPR本文の contract snapshot として明示してください。少なくとも「 Blocker 2: 回帰テストが「secret_policy による false positive」を直接固定していない#550 の実例は、#547 が しかし追加テストの fixture は、 修正要求: 実際の #547 / #549 相当の本文を fixture 化し、少なくとも次を assert してください。 candidate: "#549"
security_match_evidence: includes "secret" # 本当に出る設計なら
scope_context.conflict_type: same_file_disjoint_anchor
scope_context.escalation_required: false
suggested_action: != human_review_required逆に、現在の Blocker 3: 「実セキュリティリスクは止める」保証が消えている#550 は false positive 抑止と同時に、secret value の読み取り・ログ出力、GitHub Actions secrets、auth token、permission/access control などは引き続き PR #554 の実装は、security keyword を 追加テストも「secretをログ出力する」「GitHub Actions secretsを扱う」「token/API key/credential validation」「permission/access control」を直接扱っていません。テストされている positive path は、同じ 修正要求: 方針を二択で明示してください。
現状は「security keywordだけでは止めない」からさらに進んで、「real security risk でも構造衝突でなければ止めない」実装に見えます。 Blocker 4: prefix overlap が
|
…emise correction, RFC6901 limits 人間レビュー (PR #554 REQUEST_CHANGES) の Blocker 2/4/5 に対応する実装修正。 B1/B3(contract transition / security gate 責務)は PR body と follow-up Issue で扱う。 - B4: prefix overlap(親子パス関係)が conflict_type: none に collapse する問題を修正。 新分類 prefix_overlap_uncertain を追加し anchor_paths に "parent -> child" を記録。 共有 anchor があれば escalate、なければ fail-safe で非 escalate(false escalation 抑止) - B2: secret_policy false-positive 前提の訂正。SECURITY_RE は secret_policy を secret として拾わない(_ が word char)ことを単体テストで固定。realistic fixture は standalone keyword(secret / permission)を実トリガーとして使用 - B5: sub-file anchor 抽出が RFC 6901 非準拠(~0/~1 unescape なし・array index 非対応) である限界を policy に明記。AST/tree-sitter は follow-up - scope rollup は security gate ではない旨を policy / scope_context docstring に明記 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
@squne121 REQUEST_CHANGES ありがとうございます。設計方針(B1/B3)と実装修正(B2/B4/B5)を分けて対応しました(commit 33124c5)。 B1/B3 — 設計方針(contract transition / security gate 責務)人間指示 issuecomment-4592375157(「security 特化にしない。特定文脈は別エージェントスキルに」)に整合する Option 1 を採用します。
B2/B4/B5 — 実装修正(レビュー指摘を正として受容)
検証再レビューをお願いします。 |
概要
Closes #550
scope rollup の衝突判定を、語彙一致(security keyword 等)による即時 escalation から、
構造化コンテキスト(
scope_context/domain_flags/ordering_constraint)ベースの判定へ汎用化する。同一スキーマファイルを対象とするが目的・anchor が独立した変更(#547/#549 パターン)が
human_review_requiredに誤分類される問題を解消する。Contract transition(旧 security_assessment → scope_context)
本 PR の正本契約は、reframe 後の 現 Issue #550 本文(
scope_context/domain_flags/ordering_constraint)である。security_assessment.classification/reason要求は、人間指示#550 issuecomment-4592375157
(「security 特化にしない。特定文脈は別エージェントスキルに」)による Issue 実装: scope collision 判定を構造化コンテキストで汎用化し、単語一致による誤エスカレーションを抑止する #550 の reframe で superseded された。
scope_context/domain_flags/ordering_constraint。real-security-risk escalation(secret logging / Actions secrets / credential / permission /
access-control)は別 skill の責務とし、follow-up 設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558 で設計する。
Assumption correction(secret_policy 前提の訂正)
SECURITY_REはsecret_policyを keywordsecretとして 検出しない(_が wordcharacter のため
\bsecret\b不成立)。実証:secret_policy → []、"secret policy"(空白)→ ['secret']。secret_policyフィールド名一致が false-positive の直接原因だった」という旧前提は 誤り。secret/permission等)。test_secret_policy_property_name_is_not_detected_as_secret_keywordで回帰固定。Fixture rationale(テスト設計根拠)
issues_547_549_same_schema_disjoint_anchor_json: 実装: agent_session_manifest schema の phase_instance_id を CI-native 形式(ci:<workflow>:<run_id>:<run_attempt>)に対応させる #547(phase_instance_idpattern 拡張)と実装: agent-session-manifest.schema.json の root required に secret_policy を追加する #549(
secret_policyへの/required追加)の 同一スキーマファイル / disjoint anchor を再現。body に standalone
secret/permissionを含め、実 keyword がマッチしても disjoint anchor ならescalate しないことを検証(
test_standalone_security_keyword_in_disjoint_anchor_case_is_recorded_but_not_escalated)。conflict_type: noneに collapse する回帰をtest_prefix_overlap_records_anchor_paths_and_is_not_classified_noneで固定。変更内容
scope_context(additive):anchor_paths/conflicting_anchors/domain_flags/conflict_type/escalation_requireddomain_flags: security / schema / metadata / workflow / runtime / docs の audit 専用分類ordering_constraint:suggested_actionとは別の時間順序フィールドscope_context.escalation_required == true/conflict_type == uncertainのみで停止同一ファイルでも anchor disjoint なら escalate しない
prefix_overlap_uncertainを追加しanchor_pathsにparent -> childを記録(B4)ISSUE_SCOPE_ROLLUP_DECISION_V2フィールドは非削除(additive)conflict_type 判定
nonesame_anchor_conflicting_operationsame_file_disjoint_anchorprefix_overlap_uncertainuncertainsub-file anchor 抽出の限界(RFC 6901 非準拠)
軽量テキスト抽出であり厳密な RFC 6901 実装ではない(
~0/~1unescape なし・array index 非対応・構文検証なし)。precise な AST / tree-sitter anchoring は follow-up。限界は
scope-rollup-policy.mdに明記。Acceptance Criteria 検証
scope_contextが出力に含まれるdomain_flagsが出力に含まれるordering_constraintが別フィールドtest_scope_rollup_treats_schema_property_keyword_as_metadata_not_domain_specific_risktest_scope_rollup_escalates_uncertain_or_boundary_affecting_changes検証コマンド結果
Out of Scope / follow-up
🤖 Generated with Claude Code