Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: research
parent_issue: "#2565"
goal_ref: "apply_workflow_signal()のimplementation_pr_observed分岐において、implementation Activityのlocal-state gate(activity_missing / activity_terminal)がcross-Task accepted-fact identity/ownership判定より先に評価されるprecedence defectの再現可能性を確認し、必要なら実装Issueを起票する"
change_kind: research-onlyParent Issue
(さらに親は #2562。PR #2661〔mergeCommit e952e32885d5afa8d4284b9386aa9948b8144a4c〕が #2565 を実装済み。)
Outcome
scripts/task-context/task_context_workflow_signals.py の apply_workflow_signal() における implementation_pr_observed 分岐で、implementation Activity の local-state gate(activity_missing / activity_terminal のいずれも)が、cross-Task の accepted-fact identity/ownership 判定(FACT_TASK_IDENTITY_CONFLICT)より先に評価される precedence defect について、以下の2経路を同一根因として扱い、それぞれの再現可能性・実運用 reachability・既存テストカバレッジを確認する。
- cross-Task accepted fact × 現在Taskのimplementation Activityがterminal: current
duplicate_noop/activity_terminal→ expectedconflict/FACT_TASK_IDENTITY_CONFLICT - cross-Task accepted fact × 現在Taskのimplementation Activityが未作成(missing): current
deferred/activity_missing→ expectedconflict/FACT_TASK_IDENTITY_CONFLICT
再現可能かつ修正が必要と判断した場合、両経路をカバーする実装Issueを起票する。再現不可能、または修正不要と判断した場合は、その判断根拠を本Issueに記録して close 可能な状態にする。
In Scope
apply_workflow_signal()のimplementation_pr_observed分岐の評価順序読解:implementationActivity 取得 →implementation is Noneの早期return(deferred/activity_missing) →accepted_implementationの dedupe_key 検索・same-Task 判定 →implementation["status"] != "ACTIVE"早期return(duplicate_noop/activity_terminal) →_validate_implementation_claims_tx()→ 後段の汎用 accepted-event dedupe (SAME_TASK_SAME_FACT/FACT_TASK_IDENTITY_CONFLICT) の到達順序を、行番号付きで本Issue本文に記録する- 上記2経路(terminal / missing)それぞれについて、既存テストでカバーされているか、実運用で発生しうるか(reachability)の確認
- reachability 判断のための read-only dependency tracing。
## Allowed Pathsに列挙する範囲(.claude/skills/open-pr/scripts/open_pr.pyのemit_implementation_pr_observed()、tests/task-context/配下の関連テスト)を読解対象に含める。Issue 実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625(wrong-primary UserPromptSubmit advisory-only 化)の semantics との関係も確認する - 修正が必要と判断した場合の実装Issue起票(terminal / missing 両経路を含む)
Out of Scope
src/およびtests/への実装変更そのもの(本Issueは調査。修正が必要なら別途実装Issueを起票する)- PR feat: Task Contextへworkflow trusted signalsを統合する #2661 の Finding 2 で既に対応済みの同一Task・同一PR・別Issueシナリオの再検証
- 新規daemon、ledger、汎用authorization framework、security harnessの追加(read-only dependency tracingの結果がそれらを示唆する場合でも、本Issueのスコープでは提案に留め実装しない)
## Allowed Pathsに列挙した範囲を超えるモジュールへの読解・実装変更
調査対象シナリオ(背景)
PR #2661(#2565実装)の OWNER レビュー comment 5748354743(Finding 2)は、implementation_pr_observed 分岐において、同一Task・同一PR・別Issueの遅延signalが duplicate_noop/activity_terminal に誤分類される問題を指摘し、PR #2661でこの同一Taskケースは修正済みである。
その後 #2565 completion report comment 5748658065 が、修正で狭められたが解消されていない cross-Task(accepted_implementation が現在解決中の Task とは別 Task に属し、かつ現在の Task 自身の implementation Activity が既に terminal である場合に activity_terminal へ短絡し、後段の cross-Task dedupe FACT_TASK_IDENTITY_CONFLICT に到達しない)エッジケースを note_only_observation として記録した。
本Issueの調査(後述の Repository Evidence 参照)により、この根因は activity_terminal の早期returnに限定されず、その手前にある implementation is None → deferred/activity_missing の早期return(同ファイル該当行、accepted_implementation の dedupe_key 検索より前に評価される)にも同一構造で当てはまることが確認された。すなわち、
Task A owns accepted PR fact (dedupe_key = repo+PR)
Task C origin、Task C に implementation Activity がまだ無い
→ deferred/activity_missing で早期return
→ FACT_TASK_IDENTITY_CONFLICT まで到達しない
も、activity_terminal の場合と同型の precedence defect として成立する。
Repository Evidence(本Issue調査で確認済み・current main で再検証済み)
調査時点の current main: 33a6ffbf450dd4132201c59f243d723cdeeabdd8。直前調査時点の main(dc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95)からの差分は、対象ファイル(scripts/task-context/task_context_workflow_signals.py、.claude/skills/open-pr/scripts/open_pr.py、tests/task-context/ 配下)に一切影響しないことを git diff --stat と現物の再読解の両方で確認済み。
scripts/task-context/task_context_workflow_signals.pyのapply_workflow_signal()(implementation_pr_observed分岐、L361-388付近)で、評価順序は次の通り:implementationActivity 取得(L362) →implementation is Noneならdeferred/activity_missingで即return(L363-364、accepted_implementation 検索より前) →accepted_implementationを dedupe_key で検索(L377) → same-Task なら metadata 確認(L378-385、別Issue合致ならFACT_TASK_IDENTITY_CONFLICT) → それ以外(accepted_implementationが None、または 別Taskに属する場合を含む)でimplementation["status"] != "ACTIVE"ならduplicate_noop/activity_terminalで即return(L386-387、_validate_implementation_claims_tx()に到達しない) →_validate_implementation_claims_tx()(L388、cross-Task claim 照合によりFACT_TASK_IDENTITY_CONFLICTを返しうる)。- L386 の
elif条件は「accepted_implementationが None」と「accepted_implementationが別Taskに属する」の両方を同一分岐に含めてしまうため、後者(cross-Task)でも implementation Activity が terminal であれば_validate_implementation_claims_tx()に到達せずactivity_terminalに誤分類される。 implementation is None(L363-364)の早期returnはaccepted_implementation検索(L377)より前に評価されるため、Task の implementation Activity が未作成の場合は cross-Task 判定に一切到達しない。
- L386 の
.claude/skills/open-pr/scripts/open_pr.py::emit_implementation_pr_observed()(L563-615)は、origin = os.environ.get("CLAUDE_CODE_SESSION_ID")により現在のセッションの origin を決定し、GitHub GraphQL で PR↔Issue の closing relation を検証する(classify_closing_issue_relation())。この検証は GitHub 側の PR/Issue relation の正当性のみを確認するものであり、現在のセッションが束縛されている Task と、その dedupe_key の accepted fact を所有する Task が一致するかどうかは producer 側では一切チェックされない。- Issue 実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625(実装済み、CLOSED)により、
UserPromptSubmitの wrong-primary 検知は hard block ではなく advisory-only化されている。すなわち、別 Task を指す入力があっても Claude の workflow 自体は継続し、現在の Task binding は維持される。したがって、あるセッションが Task B に束縛されたまま、Task A が所有する accepted fact と同一 dedupe_key(同一 repo+PR)のimplementation_pr_observedsignal を(正当な GitHub PR↔Issue relationを伴って)送信すること自体は、producer / hook 双方の現行契約で妨げられない。 tests/task-context/test_workflow_signal_repair_regressions.py::test_given_merged_implementation_when_delayed_signal_for_different_issue_same_pr_arrives_then_it_is_identity_conflict_not_activity_terminalは Finding 2(同一Task・同一PR・別Issue・terminal)をカバーする。同ファイルのtest_given_released_claims_when_same_task_or_other_task_replays_accepted_fact_then_no_state_is_writtenは cross-Task のFACT_TASK_IDENTITY_CONFLICTを検証しているが、cross-Task 側の Task(task_b)はworkflow_signal_test_support.py::create_origin()により ACTIVE な implementation Activity を持つため、L386 のelif implementation["status"] != "ACTIVE"分岐を経由せず、後段(L402-406)の汎用 accepted-event dedupe で conflict が検出される経路をテストしている。cross-Task の Task 側 implementation Activity が terminal または missing の状態で accepted fact が他Taskに属するケースは、test_signal_phase_monotonicity.pyを含め、確認した既存テストのいずれにも直接のカバレッジがない(create_origin()は常に ACTIVE な implementation Activity を生成するため、cross-Task 側で terminal/missing を作るには追加のテスト構築が必要)。
Acceptance Criteria
-
apply_workflow_signal()内のimplementation_pr_observed分岐について、identity/dedupe 判定とactivity_missing/activity_terminalの評価順序(行番号付き)が本Issue本文に明記されている(上記「Repository Evidence」参照。以後の main 更新で行番号がずれた場合は再確認する) - cross-Task accepted fact × 現在Task terminal の組み合わせについて、current result と expected result が本Issue本文に記録されている
- cross-Task accepted fact × 現在Task activity_missing の組み合わせについて、current result と expected result が本Issue本文に記録されている
- 上記2組み合わせがそれぞれ既存テストで直接カバーされているか否かが確認され、結果が本Issue本文に記載されている
- 実際の producer(
open_pr.py::emit_implementation_pr_observed())と session/Task binding semantics(Issue 実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625 を含む)から、上記シナリオが実運用で発生しうるか(reachability)についての判断が記録されている - Source で参照するコメントの provenance が検証され、齟齬があれば本Issue本文の Source 記述が修正されている
- 修正が必要と判断された場合、terminal / missing 両経路を含む実装Issueが起票され本Issueからリンクされている。修正不要と判断された場合はその根拠が記載されている
- 本Issueは close 可能、もしくは追加調査要件が明示されている
Runtime Verification Applicability
- decision: not_applicable
- reason: 本Issueは read-only のコード読解・既存テストの確認・provenance のfact-checkのみで完結する research Issue であり、プロセス起動・通信・新規I/Oを伴う動作検証は不要(
change_kind: research-only)
Verification Commands
# baseline-expect: pass
$ rg -n "def apply_workflow_signal" scripts/task-context/task_context_workflow_signals.py
# baseline-expect: pass
$ rg -n "activity_missing" scripts/task-context/task_context_workflow_signals.py
# baseline-expect: pass
$ rg -n "activity_terminal" scripts/task-context/task_context_workflow_signals.py
# baseline-expect: pass
$ rg -n "FACT_TASK_IDENTITY_CONFLICT" scripts/task-context/task_context_workflow_signals.py
# baseline-expect: pass
$ rg -n "def emit_implementation_pr_observed" .claude/skills/open-pr/scripts/open_pr.py上記のコード上の行位置確認だけでは AC2/AC3 の挙動・reachability を再現できないため、本Issue本文には以下の最小再現シーケンス(Task A / Task B / Task C、決定論的な入力と期待出力)を記録すること。既存 fixture(tests/task-context/workflow_signal_test_support.py::create_origin() 等)を利用した同等の deterministic reproduction でもよい。
Task A / session-a:
implementation_pr_observed(issue=20, pr=21) → accepted
(Task A がこの dedupe_key(repo+PR=21) の accepted fact を所有)
Task B / session-b:
implementation_pr_observed(issue=30, pr=31) → accepted
pr_merged_observed(issue=30, pr=31) → Task B の implementation Activity が terminal(DONE)
[経路1: terminal] session-b(Task Bに束縛されたまま)が Issue=20 / PR=21 の implementation_pr_observed signal を送信
→ current: duplicate_noop/activity_terminal
→ expected: conflict/FACT_TASK_IDENTITY_CONFLICT
Task C / session-c:
implementation Activity 未作成(implementation_pr_observed を一度も受理していない)
[経路2: missing] session-c(Task Cに束縛されたまま)が Issue=20 / PR=21 の implementation_pr_observed signal を送信
→ current: deferred/activity_missing
→ expected: conflict/FACT_TASK_IDENTITY_CONFLICT
follow-up実装Issueを起票または既存Issueを再利用した場合は、その実Issue番号・URLを本Issue本文に記録したうえで、canonical approval後に live readback(gh issue view <実番号>)を行い、リンク・scope・terminal/missing 両経路の記載を確認すること(起票前の架空の Issue 番号をここに記載しない)。
Allowed Paths
- 読み取り専用。リポジトリ変更なし(既定)
scripts/task-context/task_context_workflow_signals.py(precedence defect の調査対象。read-only).claude/skills/open-pr/scripts/open_pr.py(reachability 判断のための read-only 参照)tests/task-context/(既存テストカバレッジ確認のための read-only 参照)
Stop Conditions
- Outcome / Scope / AC が検索可能な形で記載されていない場合は即停止
- Allowed Paths 外への書き込みを試みた場合は即停止
- 権限不足(permission denied)により操作が完了できない場合は即停止
- 成果物の書き込みに失敗した場合(I/O エラー等)は即停止
Handoff Contract
Current Objective: cross-Task accepted-fact identity判定が implementation Activity の local-state gate(activity_missing / activity_terminal)に先を越される precedence defect の reachability 確認と修正要否判断(両経路)Bounded Current Context: PR feat: Task Contextへworkflow trusted signalsを統合する #2661(#2565実装)の OWNER レビュー Finding 2、実装: workflow trusted signalsとIssue/PR Task equivalenceをTask Contextへ統合する #2565 completion report の note_only_observation、OWNER anchor comment(issuecomment-5748838603)によるスコープ一般化指摘とその repository evidence 照合結果、前回 refinement-loop run のoperator_intervention_required停止(issuecomment-5748933140)とその body-author 側修正(Allowed Paths / placeholder VC / baseline annotation)Open Questions: 両経路は実運用で reachable か(本調査では reachable と判断、Repository Evidence 参照)。reachable な場合の推奨修正方針は何かNext Action: 修正要否の最終判断 → 必要なら実装Issue起票(両経路を含む)Artifact Refs:scripts/task-context/task_context_workflow_signals.pyのapply_workflow_signal()、.claude/skills/open-pr/scripts/open_pr.pyのemit_implementation_pr_observed()
Source
dedupe_key: task-context-v1:implementation-pr-observed-cross-task-dedupe-edge-case
- 本Issueの当初スコープ(
activity_terminal経路)は 実装: workflow trusted signalsとIssue/PR Task equivalenceをTask Contextへ統合する #2565 completion report の follow-up observation として materialize された(https://github.com/squne121/loop-protocol/issues/2565#issuecomment-5748658065)。同 report はsource_urlとして feat: Task Contextへworkflow trusted signalsを統合する #2661 (comment) を参照しているが、本Issueの調査で当該コメント本文を直接確認した結果、その内容は PR body のテスト件数の stale・non-required deploy check の cancelled・AC8 canary 未再実行の3点の警告のみであり、cross-Task dedupe / activity_terminal に関する言及は存在しない。このsource_url参照は current 時点では当該 warning を裏付けない。defect 自体は本Issueの調査における current code inspection で独立に確認済みである。 - OWNER review https://github.com/squne121/loop-protocol/pull/2661#issuecomment-5748354743(Finding 2)は、同一Task・同一PR・別Issueの terminal 誤分類を指摘しており、PR feat: Task Contextへworkflow trusted signalsを統合する #2661 で対応済み。今回の cross-Task 経路とは異なる、独立した finding である。
- OWNER anchor comment 調査: apply_workflow_signal()のimplementation_pr_observed分岐でcross-Task dedupeがactivity_terminal判定に先を越されるエッジケース #2685 (comment) が、根因を
activity_terminalに限定せずactivity_missingへも一般化する必要性、上記 provenance 不整合、Scope の矛盾(Out of Scope とreachability ACの不整合)、Verification 不足を指摘し、本Issueの refinement の契機となった。 - 前回 refinement-loop run の終了報告 調査: apply_workflow_signal()のimplementation_pr_observed分岐でcross-Task dedupeがactivity_terminal判定に先を越されるエッジケース #2685 (comment) は、
## Verification Commandsのrgsearch path が## Allowed Pathsのcontainmentを満たさずbroad_search_path_unboundedと判定されたこと、および placeholder commandgh issue view NEW_IMPLEMENTATION_ISSUE_NUMBERが分類不能だったことによりcanonical_step2_route: step_5_operator_intervention_requiredで停止したことを記録している。本rewriteはこの2点をbody-author側で解消するものであり、defect scopeの再拡張は行っていない。
severity: optional_follow_up(non-blocking、緊急性なし、調査優先)
Activity
squne121 commentedon Sep 20, 2026
結論
Issue #2685 の中心仮説は current
mainで成立しています。ただし、そのまま調査を完了して「activity_terminalの順序だけ直す実装Issue」を起票すると、同じ根因の別経路を残す可能性があります。レビュー判定は REQUEST_CHANGES 相当です。確認時点の
Priority | Finding -- | -- P1 | 根因が activity_terminal より広い。activity_missing も cross-Task identity 判定を先取りする P1 | 「実運用reachabilityを確認する」というACと、「他モジュールの挙動調査はOut of Scope」が矛盾している P2 | Sourceとして指定された PR comment 5748250792 に、実際にはこの cross-Task warning が存在しない P2 | Verification Commands が行順検索だけで、AC2/AC3の挙動・reachabilityを再現できないmainはdc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95。PR #2661 の merge commite952e328...から1 commitだけ進んでいますが、その1 commitはagent-guards系のみで、対象のtask_context_workflow_signals.pyは変わっていません。したがって #2685 は現行 main にそのまま適用されます。Issue #2685P1 — 問題は
activity_terminalだけではないcurrent implementation の重要部分は次の順です。current main の apply_workflow_signal()
つまり #2685 が指摘する
は正しいです。
しかし、そのさらに前に
があります。したがって、
も同じ構造で成立します。
これは親 #2565 AC3/AC10 の「claim/Task consistency → accepted-fact dedupe → phase/state judgment」「same fact resolved to another Task は typed identity conflict」という契約と整合しません。Parent Issue #2565
したがって、調査対象を **「terminal short-circuit」ではなく「implementation Activity の local-state gate が cross-Task fact identity より先に評価される問題」**へ一段一般化した方がよいです。
P1 — このケースは実運用上 reachable
これは単なるDBを直接加工した人工ケースではありません。
#2625 により wrong-primary
UserPromptSubmitは hard block ではなく advisory-only です。別Taskを指す入力でも Claude の workflow 自体は継続し、Binding は元Taskのまま維持されます。さらに #2625 は、workflow signal が session origin と整合しない場合には Task Context 側でdeferred/conflictに分類し、producer 本体をrollbackしない設計を明示しています。Issue #2625一方
open_pr.py::emit_implementation_pr_observed()は、現在のCLAUDE_CODE_SESSION_IDを origin としつつ、GitHubから取得した PR↔Issue relation を検証して、その evidence をsignal applyに送ります。つまり GitHub上の PR A ↔ Issue A relation が正しければ、現在のセッションが Task B にbindingされていることは producer classifier では排除されません。実際に次の通常シーケンスだけで再現できます。
GitHub側の closing relation はあくまで PR と Issue の関係です。GitHubは別repositoryのIssueへのclosing referenceも正式にサポートしており、このrelation validationとローカルのTask identityは別問題です。(GitHub Docs)
したがって reachability = yes と判断してよいです。
P2 — 既存テストは「2軸を別々に」覆っているだけ
current tests にはかなり近い証拠があります。
test_workflow_signal_repair_regressions.pyには、same Task / same PR / different Issue / terminal のケースがあり、FACT_TASK_IDENTITY_CONFLICTを期待しています。また同ファイルには、accepted fact の claim をreleaseした後に other Task から同じfactをreplayすると cross-Task conflict になるテストもあります。repair regressions一方
test_signal_phase_monotonicity.pyは、新規fact + terminal implementation がactivity_terminalになることだけを検証しています。phase monotonicity testsつまり、
の組み合わせが抜けています。さらに
cross-Task accepted fact × activity_missingも検索上カバーされていません。これは #2685 の「既存test evidenceなし」という結論を支持します。
P2 — Source provenance が壊れている
#2685 は最初の指摘元として PR #2661 comment
5748250792を指定しています。しかし現在取得できるそのコメント本文の warnings は、であり、cross-Task dedupe / activity_terminal の話はありません。comment 5748250792
cross-Task edge が明示されているのは、後段の #2565 completion report
5748658065です。ただしそのreport自身も5748250792をsource_urlとしているため、provenance chain が循環的に誤っています。completion report 5748658065OWNER review
5748354743には terminal ordering 問題がありますが、そこは same Task / same PR / different Issue の Finding 2 であり、今回の cross-Task variantそのものではありません。OWNER review 5748354743Issue本文では「最初に指摘された」と断定せず、**「#2565 completion report で follow-up observation としてmaterializeされた。元リンク
5748250792は現在の本文からは裏付け不能。current code inspectionで独立確認済み」**程度へ修正した方が証跡として健全です。スコープとVerificationも修正した方がよい
現在の Out of Scope にある「
task_context_workflow_signals.py以外のモジュールの挙動調査」は、AC3のreachability確認と両立しません。今回実際に reachability を判断するには、少なくともopen-prproducer と #2625 advisory semantics を読む必要がありました。「コード変更対象はなし。reachability判断のための read-only dependency tracing は
open-pr/ Task Context docs / relevant tests まで許可」と変えるのが適切です。Verification Commands も
rgだけでは不足です。最低限、調査結果に上記の Task A / Task B sequence と current result / expected result を記録するべきです。実装Issue側では大型E2Eではなく、既存fixtureによるfocused regression 2本で十分です。修正方針も新しいledgerやDB schemaは不要です。SQLiteの
BEGIN IMMEDIATEはwrite transactionを即時開始し、UNIQUE partial indexは対象row subsetの一意性を物理的に保証します。現行のevents.dedupe_key WHERE dedupe_key IS NOT NULL方針はそのままで妥当です。問題は 早期returnによってそのglobal identity判定まで到達しないapplication-level precedence にあります。(SQLite)実装Issueの修正順序は、概念的には
とするのが一番素直です。
これなら既存の
BEGIN IMMEDIATE、append-only events、partial UNIQUE indexをそのまま使えます。セキュリティ境界、retry framework、追加ledger、汎用ハーネスはいずれも不要です。要点としては、#2685 は close ではなく refinement 継続が妥当です。
## 結論activity_terminalの再現確認自体はほぼ完了していますが、実装Issueを起票する前にactivity_missingを同じ根因へ取り込み、SourceとOut of Scope、Verificationを修正するのが最小かつ取りこぼしの少ない進め方です。Issue #2685 の中心仮説は current
mainで成立しています。ただし、そのまま調査を完了して「activity_terminalの順序だけ直す実装Issue」を起票すると、同じ根因の別経路を残す可能性があります。レビュー判定は REQUEST_CHANGES 相当です。確認時点の
mainはdc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95。PR #2661 の merge commite952e328...から1 commitだけ進んでいますが、その1 commitはagent-guards系のみで、対象のtask_context_workflow_signals.pyは変わっていません。したがって #2685 は現行 main にそのまま適用されます。[Issue #2685](https://github.com/squne121/loop-protocol/issues/2685?utm_source=chatgpt.com)activity_terminalより広い。activity_missingも cross-Task identity 判定を先取りする5748250792に、実際にはこの cross-Task warning が存在しないP1 — 問題は
activity_terminalだけではないcurrent implementation の重要部分は次の順です。[current main の apply_workflow_signal()](
loop-protocol/scripts/task-context/task_context_workflow_signals.py
Lines 345 to 420 in dc286d9
つまり #2685 が指摘する
は正しいです。
しかし、そのさらに前に
があります。したがって、
も同じ構造で成立します。
これは親 #2565 AC3/AC10 の「claim/Task consistency → accepted-fact dedupe → phase/state judgment」「same fact resolved to another Task は typed identity conflict」という契約と整合しません。[Parent Issue #2565](https://github.com/squne121/loop-protocol/issues/2565?utm_source=chatgpt.com)
したがって、調査対象を **「terminal short-circuit」ではなく「implementation Activity の local-state gate が cross-Task fact identity より先に評価される問題」**へ一段一般化した方がよいです。
P1 — このケースは実運用上 reachable
これは単なるDBを直接加工した人工ケースではありません。
#2625 により wrong-primary
UserPromptSubmitは hard block ではなく advisory-only です。別Taskを指す入力でも Claude の workflow 自体は継続し、Binding は元Taskのまま維持されます。さらに #2625 は、workflow signal が session origin と整合しない場合には Task Context 側でdeferred/conflictに分類し、producer 本体をrollbackしない設計を明示しています。[Issue #2625](https://github.com/squne121/loop-protocol/issues/2625?utm_source=chatgpt.com)一方
open_pr.py::emit_implementation_pr_observed()は、現在のCLAUDE_CODE_SESSION_IDを origin としつつ、GitHubから取得した PR↔Issue relation を検証して、その evidence をsignal applyに送ります。つまり GitHub上の PR A ↔ Issue A relation が正しければ、現在のセッションが Task B にbindingされていることは producer classifier では排除されません。実際に次の通常シーケンスだけで再現できます。
GitHub側の closing relation はあくまで PR と Issue の関係です。GitHubは別repositoryのIssueへのclosing referenceも正式にサポートしており、このrelation validationとローカルのTask identityは別問題です。([GitHub Docs]1)
したがって reachability = yes と判断してよいです。
P2 — 既存テストは「2軸を別々に」覆っているだけ
current tests にはかなり近い証拠があります。
test_workflow_signal_repair_regressions.pyには、same Task / same PR / different Issue / terminal のケースがあり、FACT_TASK_IDENTITY_CONFLICTを期待しています。また同ファイルには、accepted fact の claim をreleaseした後に other Task から同じfactをreplayすると cross-Task conflict になるテストもあります。[repair regressions](https://github.com/squne121/loop-protocol/blob/dc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95/tests/task-context/test_workflow_signal_repair_regressions.py?utm_source=chatgpt.com)一方
test_signal_phase_monotonicity.pyは、新規fact + terminal implementation がactivity_terminalになることだけを検証しています。[phase monotonicity tests](https://github.com/squne121/loop-protocol/blob/dc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95/tests/task-context/test_signal_phase_monotonicity.py?utm_source=chatgpt.com)つまり、
の組み合わせが抜けています。さらに
cross-Task accepted fact × activity_missingも検索上カバーされていません。これは #2685 の「既存test evidenceなし」という結論を支持します。
P2 — Source provenance が壊れている
#2685 は最初の指摘元として PR #2661 comment
5748250792を指定しています。しかし現在取得できるそのコメント本文の warnings は、であり、cross-Task dedupe / activity_terminal の話はありません。[comment 5748250792](#2661)
cross-Task edge が明示されているのは、後段の #2565 completion report
5748658065です。ただしそのreport自身も5748250792をsource_urlとしているため、provenance chain が循環的に誤っています。[completion report 5748658065](#2565)OWNER review
5748354743には terminal ordering 問題がありますが、そこは same Task / same PR / different Issue の Finding 2 であり、今回の cross-Task variantそのものではありません。[OWNER review 5748354743](#2661)Issue本文では「最初に指摘された」と断定せず、**「#2565 completion report で follow-up observation としてmaterializeされた。元リンク
5748250792は現在の本文からは裏付け不能。current code inspectionで独立確認済み」**程度へ修正した方が証跡として健全です。スコープとVerificationも修正した方がよい
現在の Out of Scope にある「
task_context_workflow_signals.py以外のモジュールの挙動調査」は、AC3のreachability確認と両立しません。今回実際に reachability を判断するには、少なくともopen-prproducer と #2625 advisory semantics を読む必要がありました。「コード変更対象はなし。reachability判断のための read-only dependency tracing は
open-pr/ Task Context docs / relevant tests まで許可」と変えるのが適切です。Verification Commands も
rgだけでは不足です。最低限、調査結果に上記の Task A / Task B sequence と current result / expected result を記録するべきです。実装Issue側では大型E2Eではなく、既存fixtureによるfocused regression 2本で十分です。修正方針も新しいledgerやDB schemaは不要です。SQLiteの
BEGIN IMMEDIATEはwrite transactionを即時開始し、UNIQUE partial indexは対象row subsetの一意性を物理的に保証します。現行のevents.dedupe_key WHERE dedupe_key IS NOT NULL方針はそのままで妥当です。問題は 早期returnによってそのglobal identity判定まで到達しないapplication-level precedence にあります。([SQLite]2)実装Issueの修正順序は、概念的には
とするのが一番素直です。
これなら既存の
BEGIN IMMEDIATE、append-only events、partial UNIQUE indexをそのまま使えます。セキュリティ境界、retry framework、追加ledger、汎用ハーネスはいずれも不要です。要点としては、#2685 は close ではなく refinement 継続が妥当です。
activity_terminalの再現確認自体はほぼ完了していますが、実装Issueを起票する前にactivity_missingを同じ根因へ取り込み、SourceとOut of Scope、Verificationを修正するのが最小かつ取りこぼしの少ない進め方です。squne121 commentedon Sep 20, 2026
対象コメントと現行
issue-refinement-loop契約を確認しました。現時点のmainHEAD はコメント記載どおりdc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95です。推奨は、コメント
#5748838603をoperator-selected human contextとしてwith_human_contextlane に投入し、単なるactivity_terminal修正ではなく、Issue #2685 を次の根因へ一般化して refinement することです。implementation Activity の local-state gate(activity_missing / activity_terminal)が、cross-Task accepted-fact identity 判定より先に評価される precedence defectopen-prproducer、実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625、関連 Task Context docs/tests は read-only dependency tracing として許可する5748250792を「最初の指摘元」と断定する provenance は修正するterminalとmissingの2ケースまで明示するloop_iteration_approval_gate.default_required: falsehuman_judgment_required/ environment failure / integrity failure / max-iterations 等を返した場合は、その stop condition を迂回しないcodebase-investigatorなど、canonical flow が起動した SubAgent は必ず完了結果を取得してから次へ進むroot_review_pipeline.produceもrun_in_background: trueで起動後、completion join が完了するまで routing しないそのまま auto mode の ClaudeCode に貼るなら、以下を推奨します。
Issue #2685 の refinement を、以下の OWNER comment を authoritative human context として実行してください。
Target Issue:
#2685
Authoritative anchor / human-context comment:
#2685 (comment)
使用する Skill:
https://github.com/squne121/loop-protocol/tree/main/.claude/skills/issue-refinement-loop
既にこの ClaudeCode セッションは auto mode で起動済みです。
permission mode や auto mode の設定変更は行わず、repository の
issue-refinement-loopが定義する canonical workflow をそのまま使用してください。実行方針
issue-refinement-loopを Issue #2685 に対して起動し、上記 comment を operator-selected human context として扱ってください。origin lane は URL や
author_associationから推定せず、今回オペレーターが明示的に指定した comment なので canonicalwith_human_contextlane を使用してください。routine な iteration ごとの人間承認は不要です。
loop_iteration_approval_gate.default_required: falseに従い、needs-fix の場合はmax_iterationsの範囲で自律的に調査 → review → rewrite → fresh review を継続してください。ただし canonical workflow が以下を返した場合は勝手に bypass しないでください。
human_judgment_requiredoperator_intervention_requiredこれら以外では途中確認を求めず、approved または正規の termination まで進めてください。
今回の refinement で解消すべき中心事項
anchor comment の findings を単なる追記として扱わず、Issue contract 全体へ整合的に反映してください。
特に、現在の Issue #2685 の中心問題を
activity_terminal が cross-Task dedupe に先行するだけに限定せず、
implementation_pr_observed において、implementation Activity の local-state gate が cross-Task accepted-fact identity / ownership 判定より先に評価される precedence defectとして一般化することを検討してください。
少なくとも以下の2経路を同じ根因として扱える contract にしてください。
cross-Task accepted fact × current Task implementation terminal
duplicate_noop/activity_terminalconflict/FACT_TASK_IDENTITY_CONFLICTcross-Task accepted fact × current Task implementation Activity missing
deferred/activity_missingconflict/FACT_TASK_IDENTITY_CONFLICT最終的な技術判断は current-main の repository evidence で再検証し、anchor comment の文章を無検証でコピーしないでください。
必須調査
current
mainを fresh readback して SHA を記録してください。このプロンプト作成時点では
dc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95ですが、実行時点の live HEAD を authority としてください。Issue本文、anchor comment、関連Issue/PR/comment、および current repository assets を調査してください。
最低限確認対象:
scripts/task-context/task_context_workflow_signals.pyapply_workflow_signal()implementation_pr_observedactivity_missingactivity_terminal_validate_implementation_claims_tx()FACT_TASK_IDENTITY_CONFLICTopen_pr.py側のemit_implementation_pr_observed()と producer → signal apply 経路Issue 実装: workflow trusted signalsとIssue/PR Task equivalenceをTask Contextへ統合する #2565 の precedence / Task consistency / dedupe 契約
Issue 実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625 の wrong-primary advisory-only semantics
PR feat: Task Contextへworkflow trusted signalsを統合する #2661 の実装および relevant review / fix_delta
Issue 実装: workflow trusted signalsとIssue/PR Task equivalenceをTask Contextへ統合する #2565 completion report comment
5748658065PR feat: Task Contextへworkflow trusted signalsを統合する #2661 comment
5748250792PR feat: Task Contextへworkflow trusted signalsを統合する #2661 OWNER review comment
5748354743relevant Task Context tests
test_workflow_signal_repair_regressions.pytest_signal_phase_monotonicity.pyanchor comment が指摘する provenance 問題も独立に fact-check してください。
5748250792に cross-Task warning が実際に存在しないことが確認できた場合は、Issue本文の Source を「最初に指摘された」
と断定しない形へ修正してください。
例えば意味としては、
5748250792からは現在その具体的 warning を裏付けられないという provenance を残してください。
Scope の修正方針
現在の
task_context_workflow_signals.py 以外のモジュールの挙動調査は Out of Scopeという制約と、
実運用での reachability を確認するという AC が矛盾しているため、必要なら contract を修正してください。
推奨方向:
新しい daemon、ledger、generic authorization framework、security harness 等へ scope を広げないでください。
Acceptance Criteria / Verification の改善
AC が少なくとも次を検索可能・検証可能な形で固定されるよう refinement してください。
activity_missing/activity_terminalの評価順序単なる
rgによる行位置確認だけを Verification としないでください。Task A / Task B の最小再現シーケンス、または既存 fixture を利用した同等の deterministic reproduction を contract に記述してください。
実装Issueを materialize する場合、少なくとも以下の focused regression が要求されるようにしてください。
巨大な新規E2Eや汎用ハーネスを追加する前提にはしないでください。
修正方針の候補は、current architecture を維持しつつ概念的に
origin resolution
→ claim / Task consistency
→ accepted implementation fact ownership / metadata / dedupe
→ 新規 fact と確定した後だけ local Activity state (
activity_missing/activity_terminal) を評価→ claim attach / event append
となる precedence の妥当性を検討してください。
ただしこれは anchor の technical recommendation であり、current code / contract evidence と照合したうえで採否を決めてください。
SubAgent 実行契約
repository evidence 調査が planner により必要と判定された場合、canonical Step 1 の
codebase-investigatorSubAgent を使用してください。SubAgent は read-only とし、mutation を行わせないでください。
SubAgent を起動したら fire-and-forget にしないこと。
必ずその SubAgent の実際の完了と structured result の返却を待ち、結果を取得してから次の phase へ進んでください。
外部仕様調査が planner により必要とされた場合は canonical
web-researcherを使用し、同様に完了結果を取得してから継続してください。SubAgent がまだ実行中の状態で review / rewrite / termination を開始しないでください。
canonical planner が SubAgent 不要と判定した場合は、その判定を prose で上書きして独自 dispatch せず、planner authority に従ってください。
また Step 2 は
issue-reviewerSubAgent を独自起動しないでください。current
issue-refinement-loop契約どおり root-ownedrun_root_review_pipeline.py produceを使用してください。Step 2 の producer は明示的に background launch し、completion notification / completed JSON result を join してから routing してください。
background task を起動しただけで Step 2 完了扱いにしてはいけません。
Mutation 方針
repository filesystem の production code / tests は変更しないでください。
この run の対象は Issue contract refinement です。
Issue本文の更新は
issue-refinement-loopの canonical controlled transaction / issue-editor route に従ってください。raw
gh issue edit等で skill の transaction/readback gate を迂回しないでください。anchor comment を新規投稿し直さないでください。
既存の comment
5748838603を canonical anchor として使用してください。Issue body/title の mutation 後は、必ず live readback → fresh preflight → fresh review → readiness を実施し、stale な pre-mutation verdict を再利用しないでください。
Follow-up issue
refinement の結果、
と canonical review で確定した場合、Issue #2685 の既存契約および
issue-refinement-loopの dependency/follow-up materialization gate が許可する範囲で、実装Issueを自律的に起票するか既存Issueを再利用してください。実装Issueには
activity_terminalだけでなく、同じ root cause であるactivity_missing経路も取り込んでください。ただしこの run では implementation code の変更や
impl-review-loopの開始までは行わないでください。目的は Issue #2685 の refinement と、必要な follow-up implementation contract の materialization までです。
既存Issueが同じ root cause を既に所有している場合は duplicate Issue を作らず reuse してください。
最終出力
canonical
issue-refinement-loopが approved または正規の stop condition に到達するまで進めてください。終了時には GitHub 上の canonical termination/report 契約に従い、少なくとも以下を明示してください。
impl-review-loopはこの run では起動していないこと途中で人間へ通常の承認確認を求めず、canonical workflow が許す範囲で自律的に最後まで実行してください。
特に重要なのは、コメント本文をそのまま Issue に転記させるのではなく、
with_human_contextを「変更要求の authority」として使い、技術的主張自体は SubAgent の current-main 調査で再検証させる点です。これなら今回の OWNER comment の意図と、issue-refinement-loopの trust / mutation 境界の両方に沿います。squne121 commentedon Sep 20, 2026
issue-refinement-loop: 終了報告(operator_intervention_required)
human_escalation(termination_cause: operator_intervention_required、canonicalrun_root_review_pipeline.py produceのcanonical_step2_route: step_5_operator_intervention_requiredに基づく fail-closed 停止。本 run では bypass していません)with_human_contextlane)dc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95sha256:8233688d0e2f9e5cf3870196e8eb4daf90405335a2e54c442a89895ee1f2a6aasha256:98286320cfde0f1a22c66796f629933093bb52851bd32f3db9fdad8a2768fd42実施した調査・rewriteの要約
anchor comment(OWNER, comment
5748838603)の指摘を、codebase-investigatorSubAgent(read-only, 完了・結果join済み)とmain thread自身の直接検証(gh apiによるcomment本文取得、scripts/task-context/task_context_workflow_signals.py/.claude/skills/open-pr/scripts/open_pr.pyの直接読解、tests/task-context/配下の既存テスト直接確認)の両方で照合した。apply_workflow_signal()のimplementation_pr_observed分岐で、implementation is None(L363-364,deferred/activity_missing)がaccepted_implementationのdedupe_key検索(L377)より前に評価される。elif implementation["status"] != "ACTIVE"(L386-387,duplicate_noop/activity_terminal)も、accepted_implementationが別Taskに属するケースを含めて短絡し_validate_implementation_claims_tx()(L388)に到達しない。両経路とも同一のprecedence defect構造であることをコード直接読解で確認した。.claude/skills/open-pr/scripts/open_pr.py::emit_implementation_pr_observed()(L563-615)はCLAUDE_CODE_SESSION_IDベースのorigin解決とGitHub側PR↔Issue relation検証のみを行い、現在のセッションが束縛されているTaskとaccepted factの所有Taskの一致は検証しない。Issue 実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625(advisory-only化、CLOSED・実装済み)により、別Taskを指す入力があってもTask bindingは維持される。したがって記載のTask A/B/Cシーケンスは実運用でreachableと判断した。tests/task-context/test_workflow_signal_repair_regressions.py::test_given_released_claims_when_same_task_or_other_task_replays_accepted_fact_then_no_state_is_writtenはcross-Task conflictを検証するが、task_bのimplementation ActivityはACTIVEであり、terminal/missing状態でのcross-Task defectは既存テストのいずれにも直接のカバレッジがないことを確認した。gh api repos/squne121/loop-protocol/issues/comments/5748250792を直接fetchし、実際の本文がPR body test件数stale/non-required deploy check cancelled/AC8 canary未再実行の3件のみでcross-Task/activity_terminalへの言及が存在しないことを独立確認した。なお、調査過程でcodebase-investigatorSubAgentが一度この点について誤った報告(5748354743の内容を5748250792の内容として誤引用)をしたため、directgh apifetchで再検証し、anchor commentの主張が正しいことを確定させた。Issue本文のSourceセクションはこの検証結果に基づき「最初に指摘された」という断定を避ける記述へ書き換え済み。issue-editorSubAgent経由、controlled transaction、live readback一致確認済み)。到達した停止条件
書き換え後の fresh preflight は
STATUS: pass/NEXT_ACTION: proceedだったが、続くcanonical Step 2 review(run_root_review_pipeline.py produce、background実行・完了JSON join済み)が以下を返した。blocking_issuesの内訳:## Verification Commands内の5件のrgコマンドがbroad_search_path_unboundedとして blocked 判定(対象ファイルscripts/task-context/task_context_workflow_signals.pyが本Issueの## Allowed Pathsに列挙した具体パス集合に含まれていないため、baseline_vc_preflight.pyのcontainmentチェックでbroad扱いになった)$ gh issue view NEW_IMPLEMENTATION_ISSUE_NUMBERコマンドが実行不能でUnable to automatically classify exit codeとして分類不能になったこのうち
broad_search_path_unboundedは readiness map 上は本来needs_fix(body-author-fixable)に分類される既知カテゴリだが、分類不能な項目が同時に存在したため readiness 判定全体がhuman_judgmentに引き上がり、canonical_step2_routeがstep_5_operator_intervention_requiredを返した。本runの実行方針(オペレーター指示)は「genuine ... operator_intervention_required ... の場合は勝手に bypass しないでください」と明記しており、canonical routing table(
.claude/skills/issue-refinement-loop/SKILL.mdStep 2)も本ルートを『通常のStep 4 rewriteサイクルへは進めない』5番目の独立分岐として扱う設計になっているため、本runはここで自律rewriteループを継続せず停止する。unresolved blocker(次の実行のために必要な対応)
人間判断待ちの内容は技術的には body-author 側で解消可能に見える(Allowed Pathsへの
scripts/task-context/task_context_workflow_signals.pyの明記、およびプレースホルダーVCコマンドの$ gh issue view NEW_IMPLEMENTATION_ISSUE_NUMBERの除去/annotation)が、canonical routingが本ケースをoperator_intervention_requiredとして分離しているため、次のrefinement-loop起動時にこの2点を含めた追加rewriteの要否を人間側で判断されたい。follow-up 実装Issue
本stop conditionにより canonical review が
approveへ到達していないため、follow-up実装Issueの起票は行っていない(created: false,reused: false,not_needed: false— 判断ペンディング)。確認事項
codebase-investigator)は起動後、実際の完了・structured resultをjoin済み(fire-and-forgetではない)web-researcherは planner のweb_research_policy.required: falseのため起動していないimpl-review-loopは本runでは起動していないsqune121 commentedon Sep 20, 2026
推奨アクションは、前回の
operator_intervention_requiredを bypass せず、人間判断で blocker 修正を明示的に承認した新しい refinement run を開始することです。前回 run は canonical Step 2 のstep_5_operator_intervention_requiredで正しく停止しており、follow-up 実装Issueも未作成です。GitHub connector で live 状態も確認しました。現在の
mainは33a6ffbf450dd4132201c59f243d723cdeeabdd8で、前回のdc286d9f...から1 commit進んでいます。ただし変更対象はissue-refinement-loopの owner-reaction 系のみで、今回の defect 本体であるtask_context_workflow_signals.py/open_pr.pyは変わっていません。したがって、再調査を最初からやり直すより、fresh readback を行ったうえで次の contract repair に集中するのが適切です。## Allowed Pathsに少なくともscripts/task-context/task_context_workflow_signals.pyと.claude/skills/open-pr/scripts/open_pr.pyを具体パスとして明記し、必要ならtests/task-context/も read-only 調査対象として明記する。既存コードを検索するrgは baseline で成功する性質なので、各コマンドに# baseline-expect: passを付けるのが安全です。$ gh issue view NEW_IMPLEMENTATION_ISSUE_NUMBERは executable VC から削除し、実Issue番号確定後の live readback 要件を prose にするべきです。さらに canonical review が approve した場合だけ terminal/missing 両経路を含む follow-up 実装Issueを create/reuse し、調査: apply_workflow_signal()のimplementation_pr_observed分岐でcross-Task dedupeがactivity_terminal判定に先を越されるエッジケース #2685 自体では実装を始めません。そのまま ClaudeCode に貼るプロンプトです。
Issue #2685 の
issue-refinement-loopを、前回 run のoperator_intervention_requiredを解消する 新しい run として再開してください。対象:
調査: apply_workflow_signal()のimplementation_pr_observed分岐でcross-Task dedupeがactivity_terminal判定に先を越されるエッジケース #2685 (comment)
調査: apply_workflow_signal()のimplementation_pr_observed分岐でcross-Task dedupeがactivity_terminal判定に先を越されるエッジケース #2685 (comment)
このプロンプト自体を、前回
operator_intervention_requiredに対する operator decision として扱ってください。Operator decision
前回 run が
canonical_step2_route: step_5_operator_intervention_requiredで停止した判断は正当です。旧 run の結果を bypass・改竄・再分類しないでください。そのうえで、人間判断として 次の Issue body-author 側修正を行った上で、新しい canonical review を実施することを承認します。
broad_search_path_unboundedの解消## Allowed Pathsに、Verification Commands が直接参照する具体パスを明示してください。少なくとも以下を明記してください。
scripts/task-context/task_context_workflow_signals.py.claude/skills/open-pr/scripts/open_pr.pyregression coverage の read-only 調査に必要なら
tests/task-context/も明記してください。「read-only」「repository変更なし」という prose だけで checker containment を満たしたことにしないでください。
Allowed Paths は、この research Issue の read-only investigation scope と矛盾しない形にしてください。
placeholder VC の除去
$ gh issue view NEW_IMPLEMENTATION_ISSUE_NUMBERは削除してください。
「canonical approval 後に実際に create/reuse された Issue 番号を live readback し、リンク・scope・terminal/missing 両経路を確認する」
という conditional prose / handoff requirement として保持してください。
Verification Commands の baseline semantics
rgは baseline で exit 0 が期待される evidence/readback command です。docs/dev/dor.md/ checker contract を fresh に確認し、適用可能なら各コマンド直前に# baseline-expect: passを付与してください。
$command に個別に付けてください。baseline-expectを static safety blocker の bypass として使ってはいけません。Allowed Paths containment は独立に正しく直してください。# vc-role:を advisory metadata として追加して構いませんが、不要な仕組みは増やさないでください。前回の substantive refinement を維持
activity_terminalだけでなくactivity_missingも同一根因として扱う。current
duplicate_noop/activity_terminal→ expected
conflict/FACT_TASK_IDENTITY_CONFLICTcurrent
deferred/activity_missing→ expected
conflict/FACT_TASK_IDENTITY_CONFLICT5748250792を「この cross-Task warning の最初の指摘元」と再度断定しないこと。Freshness / current-main
前回 run の current-main SHA は
dc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95でした。
この再開 run では必ず
origin/mainを fresh fetch/readback し、current-main SHA を取り直してください。開始時点で main が前回 SHA から進んでいる前提で扱い、古い行番号を無検証でコピーしないでください。
main drift が対象ロジック
scripts/task-context/task_context_workflow_signals.py.claude/skills/open-pr/scripts/open_pr.pyに影響している場合は、current evidence に合わせて本文を更新してください。
影響していない場合も、そのことを evidence として明示してください。
Canonical workflow
.claude/skills/issue-refinement-loop/SKILL.mdの current main 版を正本として使用してください。57488386035748933140は前回 run の termination / handoff evidence として読むStep 2 は current contract どおり root-owned
run_root_review_pipeline.py produceを使用してください。
issue-reviewerSubAgent を独自起動して canonical Step 2 を代替しないでください。needs-fixが通常の autonomous rewrite route に返った場合は、loop_iteration_approval_gate.default_required: falseおよび
max_iterationsの範囲でreview → rewrite → fresh review
を人間確認なしで継続してください。
ただし、新しい run でも genuine
step_5_operator_intervention_requiredhuman_judgment_requiredに到達した場合は、それを bypass しないで停止・報告してください。
SubAgent
SubAgent を fire-and-forget にしないでください。
investigation
canonical planner が repository investigation を required / permitted と判定した場合は
codebase-investigatorSubAgent を起動し、少なくとも以下を current main で確認させてください。implementation_pr_observedの current precedenceactivity_missingactivity_terminal_validate_implementation_claims_tx()open_pr.py::emit_implementation_pr_observed()から signal apply までの reachabilitySubAgent を起動したら、必ず完了まで待ち、structured result を join してから次へ進んでください。
planner が investigation SubAgent 不要と明示した場合は、以前の OWNER anchor の指示どおり planner authority を prose で上書きして独自 dispatch しないでください。その場合は「planner が不要と判定したため investigation SubAgent は起動しなかった」と最終報告に明記してください。
Issue rewrite
Issue body の mutation は current canonical flow に従い
issue-editorSubAgent / controlled transaction を使用してください。issue-editorを起動した場合も、必ず completion を待って join してください。mutation 後は main thread 側で live Issue body を再取得し、期待 body/hash と一致することを独立確認してください。
SubAgent の報告を盲信せず、critical facts は main thread でも直接検証してください。
Rewrite の狙い
今回の rewrite は defect scope を再拡張するためではなく、前回 substantively 完了した refinement を canonical checker が決定論的に review できる body にするための contract repair です。
特に以下を満たしてください。
C9_runtime_applicability_present等の非blocking warning が current review でも出る場合は、research-only Issue として canonical template 上適切な最小修正で解消できるか確認してください。ただし、今回の blocker 解消と無関係な scope expansion はしないでください。Approval 後
fresh canonical review が
approveに到達し、current main でもと確定した場合のみ、Issue #2685 の dependency/follow-up materialization contract に従って implementation Issue を create または既存Issueを reuse してください。
implementation Issue には最低限以下を固定してください。
terminal / missing を同一 precedence defect として修正
conceptual ordering:
origin resolution
→ claim / Task consistency
→ accepted implementation fact ownership / metadata / dedupe
→ 新規 fact と確定した後だけ local Activity state (
activity_missing/activity_terminal)→ claim attach / event append
focused regression:
same-Task既存 semantics を壊さない regression
unnecessary daemon / ledger / DB schema / generic security harness は追加しない
作成・reuse 後は実Issueを live readback し、番号・URL・body・親子/依存関係を検証してください。
この #2685 refinement run では implementation 自体を開始しないでください。
impl-review-loopも起動しないでください。最終報告
最終報告には最低限、以下を含めてください。
operator_intervention_requiredを bypass せず、新runで operator decision を反映したことcreated / reused / not_neededauto mode なので routine な途中確認は求めず、canonical stop condition に到達するか、refinement と必要な follow-up materialization が完了するまで自律的に進めてください。
この形なら「前回停止を無視して続きをやる」のではなく、停止で要求された operator decision を入力にして新しい canonical run を開始するため、監査上も扱いやすいです。
squne121 commentedon Sep 20, 2026
issue-refinement-loop: 終了報告(approved)
approvedwith_human_contextlane)33a6ffbf450dd4132201c59f243d723cdeeabdd8(前回SHAdc286d9f23ab5d3e5ef2fc7ccea781e41be4cd95から1コミット進行。対象ファイル(scripts/task-context/task_context_workflow_signals.py/.claude/skills/open-pr/scripts/open_pr.py/tests/task-context/)への影響なしをgit diff --statとcodebase-investigatorの直接再読解の両方で確認済み)sha256:98286320cfde0f1a22c66796f629933093bb52851bd32f3db9fdad8a2768fd42sha256:b366f641a5e0a85ac6eabd1a66b92c1062c76337f993b206546d4f95cf42434aAllowed Paths blocker の解消内容
前回の
broad_search_path_unboundedは、## Allowed Pathsセクションの該当bulletが「reachability判断のためのread-only参照はpath1、path2まで許可する」というprose文中にpathを埋め込む形式だったため、checkerのpath抽出regex(^`path`$+任意paren)に一致せず、実質的にAllowed Pathsとして未登録だったことが原因と判明した。修正として、scripts/task-context/task_context_workflow_signals.py/.claude/skills/open-pr/scripts/open_pr.py/tests/task-context/をそれぞれ独立したbullet(`` -path(説明) ``形式)として明記した。ローカルでcontract_readiness_check.py --mode executeにより修正後本文がstatus: go`/exit 0であることを事前確認した上でrewriteを実行した。placeholder VC の解消内容
$ gh issue view NEW_IMPLEMENTATION_ISSUE_NUMBERをfenced bashブロックから削除し、「follow-up実装Issueをcreate/reuseした場合は実Issue番号をlive readbackし、リンク・scope・terminal/missing両経路の記載を確認すること(起票前の架空番号を記載しない)」という条件付きprose記述に置き換えた。これによりverification要件自体は削除せず、実行不能なexecutable commandとしてcheckerに渡すことを回避した。baseline annotation の disposition
5件の
rgコマンド全てに# baseline-expect: passを各コマンド直前(空行を挟まない連続commentブロック内)に付与した。これらは現在のcode/testに既に存在するsymbol/関数を確認するevidence/readbackコマンドであり、baseline実行でexit 0が期待されるためpassを選択した。broad_search_path_unboundedはstatic safety blockerでありbaseline-expectではbypassできないため、annotationはbypass目的ではなくAllowed Paths修正の補完として付与した。terminal / missing 両経路の current evidence(fresh再確認)
codebase-investigator(read-only、completion join済み)とmain thread自身の直接読解の両方で、current main (33a6ffbf...) 上でも以下が変わらず成立することを確認した。implementation is None(L363-364,deferred/activity_missing)はaccepted_implementation検索(L377)より前に評価され、cross-Task識別判定に到達しない。elif implementation["status"] != "ACTIVE"(L386-387,duplicate_noop/activity_terminal)は、accepted_implementationが別Taskに属する場合も含めて短絡し、_validate_implementation_claims_tx()(L388)に到達しない。dc286d9f...)からの評価に変更はない。reachability の fresh 判断
.claude/skills/open-pr/scripts/open_pr.py::emit_implementation_pr_observed()はcurrent main上でもCLAUDE_CODE_SESSION_IDベースのorigin解決とGitHub PR↔Issue relation検証のみを行い、Task所有権の一致は検証しないことを再確認した。Issue #2625(advisory-only化、実装済み・CLOSED)によりTask bindingは維持されるため、reachability = yesの判断を維持した。source provenance の状態
comment
5748250792を「この cross-Task warning の最初の指摘元」と断定しない記述を維持。実際の内容(PR body test件数stale/non-required deploy check cancelled/AC8 canary未再実行の3点)と、5748658065がこれをsource_urlとして参照しているが裏付けられない、という記述を保持した。SubAgent 起動・completion join 状況
codebase-investigator(read-only): 本runで2回起動(旧run1回・新run1回)。いずれも完了・structured resultをjoin済み。新run分では、旧runの5748250792内容誤引用(別commentとの取り違え)を含め、既存findingsをcurrent main上で再検証し、変更なしと確認。web-researcher: 新runでplannerがweb_research_policy.required: true(Out of Scopeの「新規daemon/ledger等追加禁止」記述をdispositive claimと誤検知)と判定したため起動。completion join済み。結果:not_applicable(scope宣言であり外部fact-check不要、planner heuristicの過剰検知と判断)。issue-editor: 本run内で1回起動(Allowed Paths/VC修正のrewrite)。完了・completion join済み。main thread側でも独立にlive readbackしSHA一致を確認。issue-creator: follow-up実装Issue起票のため1回起動。完了・completion join済み。main thread側でも独立にIssue #2690のlive readback(number/title/state/url/labels/body/親子関係)を実施し検証。canonical Step 2 最終route/verdict
run_root_review_pipeline.py produce(background実行・完了JSON join済み):Step 2.5
semantic_review_trigger.pyは全explicit signalsがfalse/0/emptyのためsemantic_review_applicable: falseと判定し、Step 2.5をスキップしてStep 4.5へ進んだ。follow-up 実装Issue
gh api repos/squne121/loop-protocol/issues/2685/sub_issuesで確認)scripts/task-context/task_context_workflow_signals.py,tests/task-context/unresolved blocker
なし。
impl-review-loop 起動状況
本run(および前回run)では
impl-review-loopを一切起動していない。Issue #2685の refinement と follow-up実装Issue #2690の起票までがこのrunのスコープである。squne121 commentedon Sep 20, 2026
PR #2692 がマージされ、子 Issue #2690(apply_workflow_signal() の implementation_pr_observed 分岐における cross-Task accepted-fact identity 判定の precedence 修正)が完了・クローズ済みです。
本 research Issue が特定した precedence defect(cross-Task dedupe が local Activity state 判定に先を越されるエッジケース)は、repair iteration を含め以下の2経路で是正されました:
FACT_TASK_IDENTITY_CONFLICTFACT_TASK_IDENTITY_CONFLICT(OWNER レビュー issuecomment-5749549802 で指摘された P1 precedence hole の追加是正)全 sub-issue(#2690)が closed のため、post-merge-cleanup による自動クローズです。