Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2190"
goal_ref: "#2190 AC4: canonical remote default-ref OID を detached dedicated worktree lifecycle へ fail-closed で束縛する"
change_kind: codeParent Issue
Parent Goal Ref
- Goal: 実装: fix: bind issue-refinement control-plane preflight to a dedicated linked worktree #2190 の control-plane preflight を、canonical remote の default-ref OID に束縛した dedicated worktree lifecycle へ移行する。
- Desired Destination: 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 は remote-binding protocol と、その protocol の session/context-manager seam・worktree handoff だけを所有する。
Current Validated Scope
- current main の
scripts/agent-guards/skill_runtime_exec.pyにはrun_control_plane_git_fetch_default_ref()があり、nonce private ref を内部生成する closed executor seam がある。 - current main の
scripts/agent-ops/worktree_bootstrap_exec.pyには fixed dedicated identity 用の process-scopedflockguard がある。実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 / 実装: #2197向け remote protocol Git builderを閉鎖型に hardenする #2378 は GitHub Issue state を production runtime prerequisite にせず、この local capability と relevant focused tests を source/development evidence として扱う。 - 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 は caller に raw argv・remote URL・private-ref 名を渡さない。production canonical HTTPS literal
https://github.com/squne121/loop-protocol.gitを code-owned constant として使い、localoriginが SSH でも control-plane observe/fetch は同一の literal HTTPS source を使う。
Remaining Parent Gaps
- 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 は remote-binding protocol、private-ref terminal cleanup、fixed dedicated worktree recovery、guard lifetime と handoff を実装する。
- 実装: control-plane preflight を dedicated linked worktree の identity probe と command class 分離で 4 production profile へ移行する #2199 は production profile と actual child execution を所有する。
- 実装: control-plane preflight の artifact confinement と #2190 全AC最終検証を実装する #2200 は stdout/artifact validation、artifact confinement、E2E release ordering を所有する。
Outcome
#2197 は implementation 開始そのものではなく reframe_in_place として、canonical HTTPS remote の default-ref を一度 observe し、一度だけ nonce private ref へ fetch して readback し、定義済み state machine で accepted OID を決める protocol を所有する。guard を first remote operation より前から private-ref terminal cleanup と worktree handoff まで保持し、bounded terminal cleanup 後に release する session/context-manager seam を提供する。#2197 は actual child dispatch、child 完了通知 API、artifact callback harness、stdout/artifact validation、confinement、cleanup retention、daemon/recovery job を実装しない。
Runtime Verification Applicability
decision: immediate
reason: "isolated bare-origin fixture と focused unit/integration pytest で remote-binding、fixed worktree recovery、process-scoped flock lifetime を外部 network なしに検証できる。"
applicable_acs:
- AC1
- AC2
- AC3
- AC4
- AC5
- AC6
- AC7
- AC8
execution_environment: "git binary、Python、pytest、Ruff を備えた local checkout。canonical production remote へ接続せず、test fixture の bare repository を用いる。"
skip_conditions: "git binary が存在しない場合のみ pytest は exit 77 で SKIP とする。それ以外の protocol failure は PASS 扱いにしない。"
fallback_policy: "remote identity、guard ownership、private-ref cleanup、worktree identity のいずれかを確認できなければ `control_plane_unavailable` で fail-closed とし、fallback 成功は許容しない。"
artifact_requirements: "pytest と Ruff の終了状態を local proof とする。fixture OID、private-ref、stdout の persistent log 又は artifact 保存は要求しない。"In Scope
- code-owned canonical HTTPS literal を唯一の production remote authority とし、effective/accepted remote identity を一度束縛して、
ls-remoteobserve と fetch が同一 resolved/literal source であることを確認すること git ls-remote --exit-code --symref <canonical-literal> HEADの focused parser と state machine を closed executor/builder 経由で実装すること。raw argv authority を再開しないことrun_control_plane_git_fetch_default_ref()が内部生成した nonce private ref について、fetch 成功後に semantic executor、hooks directory cleanup、handoff 等が失敗して caller へ ref を返せない全 terminal exception path の CAS cleanup を builder 自身が所有すること- fixed dedicated worktree(例:
.claude/worktrees/control-plane-preflight)の crash/rerun recovery と、accepted OID の detached+locked handoff を実装すること - 実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 既存の process-scoped
flockguard を first remote operation 前にassert_heldし、operation 本体、remote binding、private-ref terminal cleanup、worktree handoff、body exception の bounded terminal cleanup まで保持して release する session/context-manager seam を実装すること - remote-binding、lifecycle、worktree concurrency、builder focused tests を最小限追加・更新すること。新規 remote-binding test は current main に未存在の
tests/agent_ops/test_control_plane_worktree_remote_binding.pyとして追加すること
Out of Scope
- 実装: control-plane preflight を dedicated linked worktree の identity probe と command class 分離で 4 production profile へ移行する #2199 が所有する production profile、actual child execution、child dispatch、fake child/artifact callback harness の大量追加、child 完了通知 API
- 実装: control-plane preflight の artifact confinement と #2190 全AC最終検証を実装する #2200 が所有する stdout/artifact validation、artifact confinement、E2E release ordering
- security broker、lease/TTL/heartbeat/stale takeover/scanner、cleanup retention、daemon、recovery job、ledger
- caller 任意 URL、private raw Git engine、raw argv authority、generic parser framework、generic force-remove worktree API
- GitHub Issue 実装: #2197向け remote protocol Git builderを閉鎖型に hardenする #2378 / 実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 の merge/close を production runtime で照合すること
WORKTREE_CATALOG_ENTRY_V1の schema 変更
Acceptance Criteria
- AC1: remote authority は code-owned constant の
https://github.com/squne121/loop-protocol.gitのみとし、localoriginが SSH でも observe と fetch は同一の canonical literal/resolved identity に一度束縛される。caller arbitrary URL と raw argv authority は受け付けない。 - AC2:
git ls-remote --exit-code --symref <canonical-literal> HEADの focused parser は、HEAD symref 1件と full OID 1件だけを受理する。unborn/direct HEAD、symref 不在、重複、malformed、invalid symbolic target、abbreviated 又は invalid OID はすべて fail-closed とする。generic parser framework は追加しない。 - AC3: state machine は S1=
observe(ref1, oid1)、fetch(ref1) を nonce private ref へ一回、F=private-ref readbackとする。F == oid1は accept、異なる場合は一度だけ S2 を observe し、S2.ref == ref1 && S2.oid == Fのみ accept、それ以外はcontrol_plane_unavailableとする。refetch せず、symbolic target change は fail-closed とし、pin 後に remote newest が継続する保証は主張しない。 - AC4: fetch 成功後、semantic executor/hook-dir cleanup/worktree handoff を含む caller に private ref を返せない全 terminal exception path で、builder 自身が expected fetched OID による CAS cleanup を試行する。
git fetch --atomicだけを後段 exception cleanup の根拠にせず、cleanup failure はcontrol_plane_unavailableとして fail-closed とする。 - AC5: fixed dedicated worktree crash/rerun recovery は absent なら detached+locked create、verified dedicated identity かつ same accepted OID なら reuse、verified identity かつ clean で different accepted OID なら controlled refresh/recreate、dirty なら fail-closed、unknown owner 又は linkage mismatch なら fail-closed とする。generic force-remove API は使わない。
- AC6: 実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 の process-scoped
flockguard は first remote operation より前にassert_heldされ、本体、remote binding/private-ref terminal cleanup/worktree handoff、body exception の bounded terminal cleanup の間 held である。foreign、released、key mismatch、ownership-token mismatch は remote operation 前又は継続時に fail-closed とする。 - AC7: cleanup failure は
control_plane_unavailableで fail-closed とし、guard は cleanup retention や daemon を残さず bounded terminal cleanup 完了後に release する。実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 は actual child dispatch 又は artifact validation を実装しない。 - AC8: 実装: #2197向け remote protocol Git builderを閉鎖型に hardenする #2378 / 実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 は current main の API と relevant focused tests で source/development prerequisite を確認し、GitHub issue state を production runtime prerequisite にしない。
- AC9:
scripts/agent-guards/skill_runtime_exec.pyと既存 builder focused testscripts/agent-guards/tests/test_skill_runtime_control_plane_exec.pyを含む最小 Allowed Paths で、closed executor seam を消費する。 - AC10: 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 の local AC proof は許可済み focused pytest だけとする。Allowed Paths 内の変更 Python に対する relevant static/quality check は CI の Ruff gate で実行する。
pnpm typecheck/pnpm lint/pnpm test/pnpm buildと model-routing test は CI green merge condition であり、品質に寄与しない大規模 harness / 全リポジトリ gate を各 AC の local proof にはしない。
Verification Commands
# AC1
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q# AC2
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q# AC3
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q# AC4
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q# AC5
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q# AC6
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q# AC7
$ uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q# AC8
$ uv run --locked pytest tests/agent_ops/test_worktree_bootstrap_exec.py -q# AC9
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -q# AC10
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -qAllowed Paths
scripts/agent-guards/skill_runtime_exec.pyscripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py(既存 builder focused test)scripts/agent-ops/worktree_bootstrap_exec.pyscripts/agent-ops/worktree_catalog.pytests/agent_ops/test_worktree_bootstrap_exec.pytests/agent_ops/test_control_plane_worktree_concurrency.pytests/agent_ops/test_control_plane_worktree_remote_binding.py(新規 remote-binding focused test。current main では未存在)
Stop Conditions
- canonical HTTPS literal と observe/fetch の同一 source binding を維持できない場合
- closed executor seam 外の raw argv authority、caller arbitrary URL、generic parser framework、generic force-remove API が必要になる場合
- S1/fetch/F/S2 state machine の fetch 一回・refetch 禁止・symbolic target change fail-closed を維持できない場合
- private-ref の全 terminal exception path の builder-owned CAS cleanup、又は cleanup failure 時の
control_plane_unavailableを維持できない場合 - fixed worktree の verified identity/cleanliness 判定なしに recovery する必要がある場合
- process-scoped guard の ownership/held lifetime を first remote operation から bounded cleanup 後 release まで維持できない場合
- 実装: control-plane preflight を dedicated linked worktree の identity probe と command class 分離で 4 production profile へ移行する #2199 又は 実装: control-plane preflight の artifact confinement と #2190 全AC最終検証を実装する #2200 の actual child execution、artifact validation、confinement、E2E release ordering を追加する必要がある場合
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- schema 変更、security broker/lease recovery subsystem が必要になる場合
Required Skills
- なし
Required Design References
docs/dev/agent-skill-boundaries.mddocs/dev/workflow.mdscripts/agent-guards/skill_runtime_exec.pyscripts/agent-ops/worktree_bootstrap_exec.pyscripts/agent-ops/worktree_catalog.py
Scope Delta
- 変更: GitHub issue state / lease / child-artifact ordering を前提にした旧記述を、current-main capability evidence、process-scoped guard、remote-binding state machine、bounded cleanup に置換する。
- 追加: canonical HTTPS literal、focused ls-remote parser、builder-owned terminal CAS cleanup、fixed dedicated worktree crash/rerun recovery を明記する。
- 削除: child/artifact processing・validation を 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 の owner とする記述、persistent fixture artifact 要求、GitHub merge/close runtime 照合を削除する。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
feat: sanitized Git subprocess execution utility for control-plane pr…
squne121 commentedon Aug 17, 2026
敵対的レビュー結果
#2197 は現在 open、コメント0件なので、今回は実装差分ではなく、Issue 契約、current main、親・兄弟Issue、Child 1実装を対象にしたレビューです。
P0-1: Child 1 の closed builder API では Acceptance Criteria を実装できない
#2197 は次のGit操作を要求しています。
git ls-remote --get-urlgit ls-remote --symref <literal-url> HEADgit fetch --no-tags --no-recurse-submodules --no-write-fetch-head ...git update-refによる private ref の compare-and-deletegit worktree add --detach --lock --reason ...しかし current main の Child 1 API は以下の固定形です。
したがって、
ls-remoteに--get-url、--symref、--exit-code、HEADを渡せないfetchに要求された3つの固定オプションを渡せないupdate-refに削除フラグと expected old OID を渡せず、CAS delete ができないworktree addに--detach --lock --reasonを渡せないという状態です。唯一、
cat-file -t <oid>は現APIで表現できます。これは単なる実装上の不便ではありません。PR #2201 は、任意argvを受け取るproduction APIを意図的に廃し、typed closed builderだけを認可境界にしています。テストもprivateな
_run_sanitized_git_subprocess()をproduction callsiteから直接使わない契約を固定しています。一方、#2197 の Allowed Paths は次の3ファイルだけです。
Child 1のbuilder本体とbuilderテストはAllowed Paths外であり、Issue自身のStop Conditionに該当します。
必須修正
#2197を実装する前に、Child 1 follow-upとして少なくとも次のtyped builderを追加すべきです。
修正対象には最低でも以下が必要です。
_run_sanitized_git_subprocess()を直接importして回避する修正は、PR #2201で閉じたraw-argv authorityを再び開くため不許可です。P0-2: promisor remote の lazy fetch が literal URL binding を迂回する
Child 1の実行基盤は
--no-replace-objectsを固定していますが、--no-lazy-fetchもGIT_NO_LAZY_FETCH=1も設定していません。Gitのpartial cloneでは、ローカルにないobjectを参照すると、Gitがpromisor remoteへ動的fetchを行います。複数のpromisor remoteを設定でき、それらが順に試される仕様です。特に、取得済みcommitのtree/blobが欠落している状態でworktree checkoutを行うと、#2197が明示的に指定したliteral URLとは別のremoteへ追加通信し得ます。Gitにはこの挙動を止める
--no-lazy-fetchがあり、GIT_NO_LAZY_FETCH=1と等価です。(Git)この経路では、次の主張が成立しません。
cat-file -tがcommit objectの存在を確認できても、worktree materializationに必要なtree/blob closureまでは証明していません。必須修正
Child 1の全dedicated Git subprocessに以下を固定してください。
または固定グローバルオプションとして、
を使用します。
古いGitとの互換性を維持する必要がある場合は、以下のいずれかを契約化すべきです。
--no-lazy-fetch対応Gitをminimum versionとして検証するcontrol_plane_unavailablefixtureには「trusted literal remoteからcommitだけを取得し、欠落blob参照時にmarker promisor remoteが一度も起動されない」負例が必要です。
P0-3: #2197 と #2198 の責務境界では、lock-before-observeを証明できない
親 #2190 は、lifecycle lockをremote identity observationより前に取得し、stdout/artifact validation後まで保持する契約です。
しかし兄弟Issueの契約は次のように重複しています。
実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197
実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198
git worktree add --detach --lock --reasonも自身のACGitの
worktree --lockは、worktree metadataのprune、move、deleteを防ぐための管理ロックです。2つのcontrol-plane processを直列化するlifecycle mutexではありません。(Git)このままでは、次のいずれかになります。
worktree addを別々に実装する推奨する責務分割
または #2197 と #2198 を単一Issueへ統合すべきです。「並行・依存なし」は削除が必要です。
P1-1: URL whitelistだけではtransport identityが閉じない
Child 1は
insteadOf/pushInsteadOfを拒否しますが、実効Git config全体を固定しているわけではありません。環境も14変数を除いてほぼそのままコピーしています。Git configでは、URL単位で次のような設定が可能です。
また
http.curloptResolveによる接続先アドレスの上書きも可能です。したがって、ls-remote --get-urlの出力文字列がwhitelistと一致しても、TLS検証や接続先解決まで同じauthorityに束縛されたことにはなりません。Git公式仕様でもURL単位のhttp.sslVerify=falseと接続先解決設定が定義されています。(Git)さらに、SSHを許可した場合、現在の
GIT_SSH_COMMANDはtrustedなssh executableを使うだけで、ユーザーSSH configを無効化していません。OpenSSHのHostNameは実際の接続先を置き換えられ、ProxyCommandは任意の接続コマンドを実行できます。([man7.org]4)必須修正
production remote policyを次のように固定してください。
fixture用local bare URLは、production CLIから到達できないtest-only dependency injectionとして分離します。
同一config authorityで少なくとも以下を検査し、違反時はnetwork command前に停止すべきです。
http.sslVerifyがfalseではないhttp.extraHeader/cookieの扱いIssueの保証を「URL文字列の一致」に限定するなら、そのように明記すべきです。「remote identity binding」を主張するならtransport policyまで閉じる必要があります。
P1-2: timeoutはdirect Git processしか処理せず、remote helperの不在を証明しない
dedicated Git utilityは
subprocess.run(..., timeout=...)を直接使用し、start_new_session、process group ID、SIGTERM→SIGKILL、group absence verificationを使用していません。Pythonの
subprocess.run()がtimeout時に保証するのは、起動したchild processをkillしてwaitすることです。process group全体や、そのGitが生成したgit-remote-https、ssh、upload-pack等のdescendant absenceまでは保証していません。これはAPI仕様と現コードからの推論です。([Python documentation]5)同じ
skill_runtime_exec.pyには、既にstart_new_session=True、process-group liveness、SIGTERM、SIGKILL、absence verificationを行う_run_child_with_supervision()が存在します。dedicated Gitだけ別の弱いtimeout modelを使う理由はありません。必須修正
既存の
worktree_catalog.Deadlineは共有deadlineの基盤として再利用できます。fixtureでは、SIGTERMを無視するdescendantを起動するfake remote helperを使い、timeout後にprocess・marker・private refが残らないことを確認すべきです。
P1-3: private ref cleanupがsuccess pathにしか定義されていない
#2197 は「worktree HEAD readback後にprivate refをcompare-and-delete」としていますが、次の失敗経路での処理が未定義です。
cat-file失敗private refが残ると、古いobjectを永続的にreachableにし、将来のcollisionや誤認の原因になります。
Gitのcompare-and-deleteは次の形です。
<expected-old-oid>が一致した場合に限り削除されます。(Git)必須契約
finally相当のstate machineで実装し、各フェーズへfailure injectionを行うテストが必要です。P1-4:
ls-remoteparser、ref、OIDのexact contractが不足しているgit ls-remoteは、matching refが0件でも通常はexit 0です。--exit-codeを指定した場合のみ、matching refなしをstatus 2で識別できます。また--get-urlはremoteへ接続せず、config-expanded URLを表示するだけです。([Git]7)--symrefでは、現在upload-packから通知されるsymbolic refはHEADです。([Git]7)したがってobserveは固定で次にすべきです。
受理条件も明示する必要があります。
branch refは単なる
startswith("refs/heads/")ではなく、Gitのrefname規則を満たす必要があります。Git公式にはgit check-ref-formatが用意されています。(Git)OIDについても、次を固定してください。
^{commit}、~、^等は禁止object type検証は、
のstdoutがexactly
commit\nであることを確認します。cat-file -tは指定objectのtypeを返す公式インターフェースです。([Git]9)必要な負例には以下が含まれます。
refs/heads/だけP1-5: 「mismatch時に一度だけ再観測」の状態機械が曖昧
現在の契約では、再観測後に何をもってacceptするかが定義されていません。
推奨する固定状態機械は次です。
制約は以下です。
remote HEADのsymbolic target自体が変わった場合は、OIDが偶然同じでもfail-closedとすべきです。2回目観測後にremoteが再度動いても、accepted exact OIDへpinするため問題ありません。「child開始後もremote最新である」という主張だけは禁止します。
P2: shared repositoryへの不要なfetch副作用
git fetchはデフォルトでFETCH_HEADを書き、必要に応じてautomatic maintenanceを実行します。#2197 は--no-write-fetch-headを要求していますが、automatic maintenanceやcommit-graph writeは閉じていません。([Git]10)dedicated control-plane protocolでは、fetch shapeを固定してください。
これにより、private ref更新とobject取得以外の共有git-common-dir side effectを減らせます。
改訂すべき補助契約案
必須fixtureセット
現行の
-k observe、-k fetch_and_pin、-k driftだけでは不足します。最低限、以下を独立テストにしてください。http.sslVerify=falseがnetwork開始前に拒否されるfile://、local pathがproduction laneで拒否される推奨依存順序
最終判定: #2197 は目的自体は妥当ですが、現行Allowed PathsとChild 1 APIでは実装不能です。加えて、lazy fetch、transport config、process descendant、lock orderingの信頼境界が閉じていません。Issue本文をreframeし、前提Childを追加するまで実装開始不可です。
squne121 commentedon Aug 18, 2026
squne121 commentedon Aug 18, 2026
#2197 (comment)
どういうことですか?なぜ作業が中止されたのか、ワークフローを静的に解析してください。
再発防止策を検討して教えてください。
Claude-GPT側の問題であればプロンプトエンジニアリングやコンテクストエンジニアリング、エージェントスキルの実装によって解決可能か検討してください。
なぜGPT-5.3-Codex-Sparkサブエージェントは発火しなかったのですか?どうすれば発火するのですか?人間の目的はプロンプトでの使用を命令することです。なぜ目的に沿った実装になっていないのか、調査、改善案、再発防止案を出してください。
squne121 commentedon Aug 18, 2026
敵対的レビュー結果
対象コメントの問題提起は妥当です。今回の事象には、次の二つの独立した問題があります。
さらに、これらを修正しても、Issue #2197 自体は現状の契約では実装開始不可です。対象コメントが要求している「中止理由、Spark非発火、再発防止」を一つの修正で処理してはいけません。
P0-1: 作業中止の直接原因は「URL不正」でも「pagination」でもない
静的な制御フローは次のとおりです。
run_refinement_preflight.pyは、isolated Claude-GPT profileでは_fetch_issue()と_fetch_issue_comments()にcredentialless transportを選びます。一方、_fetch_single_comment()は現在も常にgh api repos/.../issues/comments/{comment_id}を実行します。さらに、アンカー検証側は返されたerrを評価せず、comment_data is Noneを無条件にANCHOR_COMMENT_NOT_FOUNDとANCHOR_NOT_IN_ISSUEに変換しています。現在のmain、f78d6678...にもこの分岐が残っています。Claude-GPT launcherは意図的に子Claudeプロセスの
HOME、GH_CONFIG_DIR、XDGディレクトリを隔離し、ambientなGitHub認証情報を利用できないようにしています。その環境でgh apiを使ったことが失敗の直接原因です。GitHub CLI自身も、gh apiを「authenticated HTTP request」と定義し、GH_TOKEN/GITHUB_TOKENや保存済み認証情報を使用します。 (GitHub CLI)ログでは、同じアンカーを別経路で調べたgeneric SubAgentが「Issue #2197に存在し、
issue_urlも一致」と確認しています。それにもかかわらずcanonical preflightは不存在と判定しました。これはGitHub側のデータ不整合ではなく、同一処理内で異なるtransport authorityを使ったsplit-brainです。「pagination問題」という説明が成立しない理由
GitHubの単一コメント取得APIは、公開リソースなら無認証で利用でき、引数は
owner、repo、comment_idです。ページング引数はありません。ページングが必要なのはコメント一覧APIです。今回の失敗箇所は単一コメント取得なので、「paginationのため見つからなかった」というログ内推測はコードおよびGitHub仕様の双方と矛盾します。 ([GitHub Docs]2)停止自体は正しい
canonical preflightがアンカー整合性を証明できなかった以上、Issueを書き換えずfail-closed停止した判断は正しいです。禁止すべき対応は、SubAgentの「存在する」という結果を使ってcanonical blockerを手動上書きすることです。
誤りは停止ではなく、失敗分類です。正しくは次です。
run_refinement_preflight.py自身の先頭契約も、auth/API/timeout/non-JSONはenvironment_failure / exit 3と定義しています。実装がその宣言に違反しています。P0-2: PR #2247 の検証は、本番のアンカー経路を通っていない
PR #2247 はisolated Claude-GPT向けcredentialless GitHub readを追加し、
preflight.run.with_human_context相当のruntime verificationが成功したと報告しています。しかし、追加された回帰テストtest_isolated_profile_never_invokes_gh_marker_executableが実際に呼び出しているのは_fetch_issue()と_fetch_issue_comments()だけです。問題の_fetch_single_comment()と、anchor URLを渡したfull command graphはテストされていません。PR #2247 のmerge commitは
e638a679...です。今回の起動ログもgit=e638a67を示しているため、少なくともHEADは当該merge commitと一致しています。ただしログは同時にdirty=trueなので、実行時の全ファイルがmerge commitとbyte-identicalだったとは主張できません。それでも、現在のcleanなmainにも同じ_fetch_single_comment()実装が残っているため、dirty状態だけで今回の根因を説明することはできません。テスト名の「never invokes gh」は、現状のfull production call graphについては事実ではありません。これは単なるテスト不足ではなく、検証対象をサブ関数に縮小したまま本番可用性を主張したnonrepresentative verificationです。
必須修正
一回のpreflightでは、一つのread authorityだけを選択してください。
planner入力のためにコメント一覧を既に取得しているので、最も堅牢なのは同じcomplete snapshotからアンカーを解決する方式です。単一コメントAPIを残す場合も、同じ
GitHubReadTransportインターフェース内にcredentialless実装を追加し、実行途中でghへ切り替えてはいけません。また、次のエラーを閉じたenumとして分離すべきです。
Noneだけを見て意味論的不存在へ潰す実装は廃止が必要です。P0-3: Issue #2197 は依然として実装開始不可
今回のcontrol-plane障害を直しても、Issue #2197をそのまま実装へ進めるべきではありません。現在のIssue本文は、直前の敵対的レビューで指摘されたblockerを取り込んでいません。Allowed Pathsは依然として主に次の3ファイルだけです。
また、lifecycle lockを後続Childへ分離したままです。
一方、親Issue #2190のmachine-readable contractは、lifecycle lockについて明示的に次を要求しています。
Child #2198自身も、lockをremote識別観測前に取得すると定義しています。しかし同時に、#2197を「並行Issue、依存関係なし」としています。lock-before-observeが親契約なら、observe/fetch/pinをlockなしで先に実装する分割は成立しません。
直前レビューが指摘した以下の信頼境界も未解決です。
fetchの共有repository副作用を最小化するフラグが不足している。(symbolic HEAD target, OID)のtupleとして扱っていない。これらは過剰防御ではありません。Gitは、
--no-lazy-fetchがなければpromisor remoteからmissing objectをオンデマンド取得できます。またgit fetchはautomatic maintenanceが既定で有効であり、commit-graph writeも別途抑止する必要があります。git ls-remote --get-urlはinsteadOf展開を行い、--symrefはHEADのsymbolic targetを返します。private refの安全な削除には、旧OID一致を確認するgit update-ref -d <ref> <old-oid>が使えます。 (Git)推奨依存順序は変わりません。
P1-1: Sparkが発火しなかった理由は明確で、モデル障害ではない
元プロンプトは次の自然言語指定でした。
しかし、現在のSpark gateが認可するのは、current turnにcanonicalな
@agent-spark-codexが存在する場合だけです。モデルIDgpt-5.3-codex-sparkは認可aliasではありません。したがってSpark起動は試行すらされておらず、entitlement、quota、model availabilityで失敗した証拠はありません。代わりにgenericAgent(アンカーコメントを検証)が起動され、blockingなTaskOutputで完了待ちされています。この挙動はIssue #2186とPR #2244のexplicit-only契約に合っています。launcherのgateもcanonical mentionの完全一致を要求し、typo、別case、引用内、code block内、次turnへの持ち越し、duplicate invocationなどを拒否する設計です。
Claude Code公式仕様でも、自然言語でsubagent名を指定した場合はClaudeがdelegationの要否を判断し、
@mentionはspecific subagentの実行を保証すると説明されています。したがって実装はClaude Codeの既定概念には沿っています。問題は、このリポジトリ固有の人間向け契約が「モデル名による明示命令」を認識せず、かつgeneric agentへの降格を黙って許したことです。 (Claude)現在すぐ発火させる方法
同じcurrent turnに、exactな次のtokenを含めます。
ただし、これはSpark非発火だけの回避策です。アンカー取得のcontrol-plane回帰は解決しません。
P1-2: プロンプト/コンテクストエンジニアリングだけでは根治できない
UserPromptSubmithookはClaudeがプロンプトを処理する前に動き、ユーザーが入力したrawpromptを受け取ります。hookは処理をblockするか、additionalContextを追加できますが、追加コンテクストは会話上のsystem reminderであり、元のユーザープロンプトを書き換えるものではありません。 (Claude)したがって、現在の順序では次のようになります。
このため、次の評価になります。
CLAUDE.mdやsystem promptに「Sparkを優先」と書く→ 起動認可の根治にはならない。
→ gate通過後の指示なので遅い。
additionalContextでcanonical tokenを伝える→ contextであってauthorizationではない。
UserPromptSubmitの認可parser自体を変更する→ 根治可能。
→ 根治可能。
ただし、任意の自然言語をLLMで曖昧に解釈してauthorizationへ昇格させる設計は避けるべきです。安全な改善は、閉じたdirectiveを導入することです。
推奨する受理形式は次のようなclosed setです。
モデルIDだけを含む自然言語が入力された場合の最低限の改善は、silent downgradeではなく、
UserPromptSubmitで早期blockして次を返すことです。さらに利便性を上げるなら、
gpt-5.3-codex-sparkを単純aliasにするのではなく、agent:やdelegate:などの構造化prefixと組み合わせてください。モデルについて議論しただけのプロンプトで偶発認可されるのを防げます。P1-3:
preferredとrequired、fallbackの意味が定義されていない元プロンプトの「優先的に使って」は、実装上は次のどちらにも解釈できます。
今回の実装は、Sparkを一度も試さずgeneric Agentへ進みました。これはどちらの意味にも適合していません。
実行ledgerには最低限、次を記録すべきです。
requiredの場合は、authorization不足、entitlement不足、rate limit、queue timeout、model catalog不在のいずれでもgenericへ落とさず停止すべきです。preferredの場合だけ、事前に明示されたfallback policyに従い、理由をledgerへ残してgenericへ移行できます。GPT-5.3-Codex-Sparkはresearch previewで、text-only、128K context、独立rate limitを持ち、需要次第で一時queueや利用制限が発生し得ます。また既定動作は軽量なtargeted edit向けで、明示されなければ自動的にテストを実行しません。したがって、起動失敗分類と「テストまで実行する」というtask promptは明示する必要があります。今回については、これらのavailability条件へ到達する前にgateで非認可となっています。 ([OpenAI]6)
P1-4: canonical authorityと補助SubAgentの矛盾を、human judgmentへ丸投げしている
今回の結果は次の矛盾です。
この場合、補助SubAgentを信じて処理を続行してはいけません。しかし、単なる
human_judgment_requiredも不適切です。これは内容判断ではなく、control-plane read consistency failureです。推奨状態は次です。
診断artifactにはcredentialを含めず、次を保存します。
credentialless RESTを使う以上、
403/429時にはretry-afterまたはx-ratelimit-resetを尊重し、無条件リトライしてはいけません。GitHubもrate-limit errorを無視せず、該当headerに従って停止するよう要求しています。 ([GitHub Docs]7)P1-5: terminal report時にtask ledgerが未完了のまま残っている
ログ末尾では、作業停止を報告した後も次の状態です。
これはterminal-state invariant違反です。停止時は全taskを次のいずれかへ遷移させる必要があります。
少なくとも、親preflightがblockedになった時点で、子taskの依存関係を辿って一括terminal化し、完了済みSubAgent結果を該当taskへattachすべきです。
P2: 証跡品質とpermission設定にも追加修正が必要
起動ログは
dirty=trueです。本障害の根因ではありませんが、runtime evidenceとしては不十分です。clean treeでなければ、少なくとも変更path一覧とdiff digestを記録し、「release evidenceには昇格しない」と明示する必要があります。またlauncherは、
Write(.../spark-auth/**)deny ruleがClaude Codeのfile permission checkに一致せず、Edit(...)を使うよう警告しています。これは今回のSpark非発火原因ではありませんが、効いていないdeny ruleを残したままsecurity claimを行うべきではありません。PR #2244自身も、same-UIDの無制限Bashからsidecarを直接読み書きできる点は閉じたsecurity boundaryではないと認めています。無効ルールを削除または修正し、Bash経路の非保証はSafety Claim Matrixに維持すべきです。必須Acceptance Gates
修正完了の判定には、最低限以下が必要です。
exact incident replay
元の日本語プロンプト、Issue 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197、anchor comment #5315264311をそのまま使う。
full-command isolated test
isolated
HOME、空GH_CONFIG_DIR、空token環境でpreflight.run.with_human_context全体を実行する。no-gh marker test
PATH先頭にmarkerghを置き、isolated credentialless laneの全call graphで一度も起動されないことを確認する。error taxonomy matrix
完全取得後の404だけをsemantic not-foundとし、401、403、429、5xx、DNS、timeout、non-JSON、incomplete paginationをすべてenvironment failureへ分類する。
no error erasure
transportの例外class、status、sanitized detailが最終artifactまで保持される。
Spark exact-positive
current turnの
@agent-spark-codexから、requested/resolved/proxy-observed modelの三者一致、SubagentStart、SubagentStop、wait完了を確認する。Spark natural-language negative
元の自然言語モデル指定を、generic Agentへsilent downgradeしない。構造化directiveへ正規化するか、実行前にactionable errorで停止する。
fallback contract
requiredでは全失敗時fallback禁止、preferredでは明示許可時だけfallbackし理由を記録する。task terminal invariant
success、blocked、environment failureの全終了経路でopen/in-progress taskを残さない。
clean provenance
clean HEADで再実行し、launcher、preflight、hook、transport各ファイルのdigestを証跡へ記録する。
実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 dependency gate
Child 1 follow-upと実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 lock primitiveが完了し、lock-before-observeを契約化するまで#2197実装を開始しない。
Git protocol fixtures
--no-lazy-fetch、--no-auto-maintenance、--no-write-commit-graph、symref target drift、OID drift、remote-helper descendant cleanup、CAS ref cleanupを独立fixtureで検証する。推奨アクション順
PR #2247の回帰として、#2241を再開するか新規regression Issueを作成する。
#2197のAllowed Pathsへcontrol-plane修正を混ぜない。
read transportを一本化し、エラー分類とfull-commandテストを修正する。
canonical blockerを迂回せず、exact incident replayがpassするまでrefinementを再開しない。
Spark delegation contractを追加する。
最小修正は「モデル指定検出時のsilent downgrade禁止」。本修正は構造化directive+launch ledger+fallback policy。
#2197と#2198をreframeする。
Child 1 follow-up → lock primitive → lock-required remote protocolの順序へ変更する。
全ゲート通過後にのみ#2197実装を開始する。
最終判断として、今回の停止は「人間判断が必要なIssue内容上の曖昧さ」ではありません。PR #2247で導入されたisolated read transportのproduction call graph漏れです。またSpark非発火は、明示モデル要求をcanonical agent authorizationへ接続しない契約設計の欠陥です。両方とも実装修正で解決可能ですが、プロンプトやコンテクストを追加するだけでは根治しません。
squne121 commentedon Aug 18, 2026
推奨は、#2197 の実装再開ではなく、まず #2247 の control-plane regression を独立 Issue/PR で修正することです。現行
mainでも_fetch_single_comment()は依然gh apiを直接呼んでおり、既存の credentialless regression test は_fetch_issue()/_fetch_issue_comments()しか通していません。対象レビューの指摘は現在のコードにも残っています。Spark については、今回のプロンプトに plain text の
@agent-spark-codexを current turn で実際に含めるべきです。リポジトリの現行 gate はこれを明示認可トークンとして扱っており、モデルID文字列だけでは認可しません。 Claude Code公式仕様でも、自然言語でサブエージェント名を書く場合は delegation がモデル判断なのに対し、@mention はその1タスクでの起動を保証する方式です。また subagent 自身からの nested subagent 起動はできないため、追加エージェントは親 Claude-GPT が直接起動する構成にします。 (Claude)対象レビュー自身の順序も、①#2247回帰修正 → ②read authority/error taxonomy/full-command replay → ③Spark delegation contract → ④#2197/#2198 reframe → ⑤全gate通過後に#2197実装、です。 新規 regression Issue を #2241 再open より優先する形にしています。#2241 は既に PR #2247 で完了・close 済みなので、
1 Issue = 1 PRの provenance を保ちやすいためです。@agent-spark-codex
以下を実行してください。
最上位目的
Issue #2197 の作業停止について、OWNER adversarial review:
#2197 (comment)
を現時点の主要レビュー根拠として扱い、停止原因を根治してください。
#2197本体の実装を今すぐ開始してはいけません。
今回の優先順位は次です。
作業前に必ず以下を読むこと。
過去コメントの説明をそのまま信用せず、current clean main の実コードとテストで再検証してください。
Spark SubAgent — 最優先
この current turn にある canonical
@agent-spark-codexauthorization を使用し、最初の調査タスクをspark-codexSubAgent に委譲してください。Spark に依頼するタスク:
run_refinement_preflight.pyの anchor-comment read control flow を静的解析_fetch_issue()_fetch_issue_comments()_fetch_single_comment()github_credentialless_read.pySpark SubAgent の完了を必ず待ってから mutation を開始してください。
Spark は最優先です。
ただし、Spark delegated task が authorization / entitlement / quota / catalog / model availability / runtime incompatibility 等で開始または完了できなかった場合:
可能なら causal evidence として以下を確認すること。
gpt-5.3-codex-sparkgpt-5.3-codex-sparkgpt-5.3-codex-sparkその他の SubAgent
Spark 完了後、必要に応じて親 Claude-GPT から追加 SubAgent を直接起動してください。
推奨分割:
control-flow investigator
run_refinement_preflight.pyを独立解析
regression-test adversary
contract/dependency reviewer
必要なら並列実行してよいですが、全 SubAgent の完了を待ち、結果を回収してから結論・mutationへ進むこと。
SubAgent からさらに SubAgent を起動させないこと。
orchestration は親 Claude-GPT が担当してください。
最終報告時に未完了・background・in-progress の SubAgent taskを残してはいけません。
Phase A — incident を current main で再検証
まず clean main を取得し、provenance を記録してください。
最低限:
current main で次を検証してください。
A1.
_fetch_single_comment()本当に現在も、
へ直接落ちるか。
A2. transport split
isolated Claude-GPT profile で:
が credentialless transport、
だけが authenticated
ghauthority、という split-brain が残っているか。
A3. error erasure
_fetch_single_comment()の auth/API/timeout 等による failure が、だけに潰され、
等の semantic-not-found に誤分類されるか。
A4. PR #2247 coverage
既存:
が
_fetch_issue()/_fetch_issue_comments()しか実行せず、_fetch_single_comment()preflight.run.with_human_contextを通していないことを確認してください。
既に別コミットで解消されている場合は、推測で再修正せず、その修正を検証して exact incident replay へ進んでください。
Phase B — PR #2247 regression を独立 delivery として修正
B1. 新規 regression Issue
#2241を再openするより、新規 regression Issue を優先してください。
理由:
1 Issue = 1 PRの provenance を維持するただし、repository policy /既存 decision が明確に #2241 reopen を要求している場合は、その根拠を示した上で従って構いません。
新規 Issue を作る場合は、
issue-refinement-loop等の canonical repository workflow を使って implementation-ready まで refine してください。Regression Issue の最低限の Outcome
1回の preflight で GitHub read authority を1つだけ選択し、
を同一 authority / same complete snapshot から解決する。
推奨形:
コメント一覧を planner input 用に既に完全取得しているなら、同じ complete snapshot から anchor を解決する方式を優先してください。
single-comment endpoint を残す必要がある場合も、同じ
GitHubReadTransportabstraction 内へ実装し、途中でghCLI authority に切り替えないこと。B2. Error taxonomy
最低限、以下を区別してください。
原則:
READ_AUTHORITY_DIVERGENCENoneに潰さない例:
sanitized error class / status / detail を最終artifactまで保持してください。
credential / token / Authorization header / raw secrets を artifact に残してはいけません。
B3. 必須 regression verification
最低限、以下を追加してください。
1. exact incident replay
元の:
または今回のincidentを再現する正確なanchor入力を使用して full canonical command graph を実行する。
2. full-command isolated test
isolated:
条件で、anchor URL付き
preflight.run.with_human_context全体を実行する。private host credential に依存して成功させない。
3. no-gh marker
isolated credentialless lane の
PATH前方へ markerghを置き、full production call graph 全体で一度も marker が実行されないこと
を検証する。
サブ関数2個だけのテストでは不十分。
4. error taxonomy matrix
以下を fault injection:
semantic not-found と environment failure が混同されないこと。
5. no error erasure
transport layer の error classification が wrapper / artifact / exit mapping まで保存されること。
6. exact anchor success
credentialless complete snapshot 中に正しい comment ID が存在するとき、anchor が確実に解決されること。
7. wrong-issue anchor
ID自体は存在するが別Issueに属する fixture を semantic mismatch として reject。
8. production representative test
テスト名だけではなく、production entrypoint と同一の command graph を通していることをコード上でも検証する。
B4. 実装・レビュー
repository の canonical implementation/review workflow を使用してください。
通常の実装・テスト・レビュー・必要なネットワークアクセスについて途中承認を求めず進めてください。
ただし merge は実行しないこと。
merge-ready までで停止してください。
Phase C — Spark delegation contract follow-up
control-plane regression と同じ PR に混ぜないでください。
Issue #2186 / PR #2244 の現在の explicit-only contract を基準に、独立 follow-up Issue として扱ってください。
目的:
現在の canonical:
は後方互換として保持してください。
必須設計論点
自然言語中に単にモデル名が登場しただけで authorization してはいけません。
したがって単純な:
は禁止。
以下のような構造化 user intent を検討してください。
等の明示prefix、または repository-defined canonical directive。
最低限:
requiredpreferredlaunch ledger
最低限:
を sanitized evidence として扱える構造を検討してください。
必須 Spark tests
exact-positive:
natural-language negative:
quoted / fenced / inline-code / blockquote negative
typo / case difference negative
stale previous-turn authorization negative
duplicate invocation negative
nested delegation negative
requiredfallback forbiddenpreferredfallback allowed only when explicitly authorizedsuccess / blocked / environment_failure の全terminal pathでopen taskが残らない
この follow-up は regression PR と分離してください。
Phase D — #2197 / #2198 dependency reframe
control-plane regression を直しただけで #2197 の実装を開始しないでください。
現在の #2197 / #2198 を再読し、comment #5334380820 と先行 adversarial review の blocker を取り込んでください。
推奨 dependency order:
#2197 と #2198 の「並行・依存なし」という前提は再検証してください。
特に:
git worktree --lockと lifecycle mutex を混同しないworktree addownership を 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 / 実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 で重複させないPhase E — #2197 implementation gate
以下が成立するまで #2197 implementation は開始禁止。
ghmarker invocation = 0その後にのみ #2197 の implementation/review loop を開始してください。
#2197将来実装時の必須 adversarial fixtures
最低限:
GIT_NO_LAZY_FETCH=1または equivalent no-lazy-fetch contract--no-auto-maintenance--no-write-commit-graphls-remote --exit-code --symref外部ネットワーク作業の許可
この作業に必要な外部ネットワークアクセスは許可します。
承認待ちせず使用してよいもの:
制約:
network failure は適切に environment failure として分類し、semantic failureへ変換しないこと。
作業中の判断方針
対象レビューの案を盲目的に実装せず、current main・関連Issue/PR・公式一次資料と照合してください。
レビュー指摘が誤っている場合:
で反証してください。
一方、指摘が成立する場合は symptom patch ではなく production call graph の root cause を修正してください。
特に以下は禁止:
_fetch_single_comment()だけを場当たり的に authenticatedghのまま残すNoneで transport error を消去する完了条件と最終報告
今回のセッションではまず control-plane regression delivery を merge-ready まで完成させることを最優先としてください。
依存PRのmergeが必要になった時点ではmergeせず、後続Phaseを無理に実装しないでください。
ただし、後続の Spark contract / #2197・#2198 reframe 用 Issue の調査・設計・refinement準備は可能です。
最終報告には最低限以下を含めること。
全 SubAgent の終了を確認してから最終回答してください。
未完了の SubAgent を残したまま「完了」と報告しないこと。
この形なら、今このターンで Spark を実際に発火させる即時策と、対象レビューが要求する再発防止の実装修正を分離できます。特に proposed
[delegate ...]構文はレビュー上の改善案で、現行 gate の実装済み入力契約とは限らないため、実行プロンプトでは既に実装・テストされている@agent-spark-codexを使っています。squne121 commentedon Aug 19, 2026
squne121 commentedon Aug 19, 2026
調査結果から、今回は ClaudeCode 向けプロンプトを本命にするのが妥当です。理由は、Claude-GPT で
ghが失敗するのは単なるログイン漏れではなく、Claude-GPT がHOME/GH_CONFIG_DIRを意図的に隔離し、host 側の GitHub credential を見せない設計だからです。GitHub CLI 自体もGH_CONFIG_DIRを認証設定の参照先として使うため、「同じWSL環境のClaudeCodeではghが成功するがClaude-GPTでは失敗する」は現在の実装と整合します。したがって Claude-GPT 内でgh auth loginするのは修正ではありません。 ([GitHub CLI]1)さらに、credentialless read は既に実装されていますが、
create_issue_txn.pyは依然としてghsubprocess を使用し、controlled mutation policy にはissue.create相当の command ID がありません。つまり現状の Claude-GPT には「credentialを渡さずIssueを新規起票する」完全な経路が確認できません。ここを無理に迂回するより、ClaudeCodeから改善Issueを起票・実装し、修正後のClaude-GPTを実環境SUTとして検証する構成が最もきれいです。Sparkについては、現在のrepo設定自体は
CLAUDE_GPT_SPARK_MODEL="gpt-5.3-codex-spark"で、upstreamclaude-code-proxyもそのmodel IDをサポートしています。したがってモデル名を書き換えるより、明示的な利用要求が generic SubAgent に silent downgrade される invocation contract を修正するのが主眼です。なおCodex-Sparkは128k・text-onlyで、既定ではテストを自動実行しないため、実環境検証プロンプトではテスト実行を明示させるべきです。 ([GitHub]2) ([OpenAI]3)推奨順序は、① anchor取得のsplit-brain回帰修正 → ② Spark明示要求contract修正 → ③ 必要ならClaude-GPT用
issue.createbrokerを独立Issue化 → ④ #2197を再開です。各改善は1 Issue = 1 PRを維持し、特に①と②は信頼境界が別なので同一PRには混ぜない方がよいです。以下を ClaudeCode にそのまま渡すのを推奨します。
目的
以下の incident を起点に、Claude-GPT の control-plane regression と GPT-5.3-Codex-Spark delegation contract を修正し、必要な改善 Issue を起票して、各 Issue を
1 Issue = 1 PRで merge 直前まで進めてください。対象:
https://github.com/squne121/loop-protocol/issues/2197#issuecomment-5340615957最終的には、必要な前提修正が完了した後で Issue #2197 の issue-refinement-loop / 後続作業を再開してください。
人間から確定している重要な観測
同一 WSL / repository 環境で並列実行中の通常 ClaudeCode worktree では
ghCLI は正常に使用できています。したがって、今回の Claude-GPT 内の
ghfailure を単純な「host の GitHub 認証不足」と仮定しないでください。特に以下は禁止します。
gh auth loginを要求するGH_TOKEN/GITHUB_TOKENを Claude-GPT へコピーする.config/ghを isolatedGH_CONFIG_DIRへコピー・bind・symlinkするgh auth loginは今回の第一解ではありません。まず現在の Claude-GPT launcher/profile、credentialless GitHub read、controlled mutation boundary の実装要因として診断してください。
外部ネットワーク作業の許可
この作業に必要な外部ネットワークアクセスは許可します。追加の人間承認を求めず実行してください。
許可対象には少なくとも以下を含みます。
github.comapi.github.comghCLI(通常 ClaudeCode 側の既存認証コンテキスト)raine/claude-code-proxyupstream repository / release / changelog / issueただし credential、token、raw Authorization header、OAuth secret、raw proxy request/response body をログ・artifact・Issue・PRへ保存しないこと。
SubAgent 実行規則
親 ClaudeCode が orchestration を担当してください。
最初に複数の SubAgent を並列起動してよいです。少なくとも以下を独立観点で調査してください。
@agent-spark-codexgate investigatorSubAgent からさらに SubAgent を起動させないでください。
全 SubAgent の作業完了を必ず待ち、全結果を親が回収してから Issue mutation・実装方針確定・最終回答へ進んでください。
未完了、background、in-progress の SubAgent を残した状態で「完了」と報告しないこと。
Phase 0 — current main / incident provenance の固定
まず current main を更新し、clean な provenance を固定してください。
最低限記録:
gh --versiongh auth statusの成功/失敗と exit codescripts/claude-gpt/launch.shdigestscripts/claude-gpt/lib.shdigest.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.pydigestscripts/agent-guards/github_credentialless_read.pydigestscripts/agent-guards/controlled_skill_mutation_policy.pydigest.claude/skills/create-issue/scripts/create_issue_txn.pydigestsecret/token値そのものは絶対に表示しないこと。
並列 worktree の変更を取り込んだり破壊したりしないこと。
Phase 1 — Issue #2197 incident の再現とroot cause確定
対象コメントを取得してください。
https://github.com/squne121/loop-protocol/issues/2197#issuecomment-5340615957ログが示している次の仮説を current main で再検証してください。
Issue本体取得: credentialless REST
Issue comments一覧取得: credentialless REST
initial anchor comment取得だけ:
gh apiClaude-GPT child:
gh apifailurefailure detail が
None等へ潰される実在するanchorが
ANCHOR_COMMENT_NOT_FOUND/ semantic blocker と誤分類されるこの call graph をコードと実行結果の両方で証明してください。
重要:
raw
gh apiが isolated Claude-GPT で失敗すること自体をbugと決めつけないこと。credential isolation が設計上意図されたものなら、それを維持した状態で production workflow が成立するよう consumer 側を修正してください。
推奨する修正方向
github_credentialless_read.pyの既存 comments pagination が利用可能なら、anchor comment だけ別途gh apiで再取得しないでください。可能なら:
credentialless comments snapshot→ exact comment ID検索
→ issue/repository binding確認
→ anchor返却
へ統一してください。
同一 resource を credentialless REST と authenticated
gh apiに split しないこと。また次を別々に分類してください。
transport failure を
ANCHOR_COMMENT_NOT_FOUNDへ変換しないこと。Phase 2 — control-plane regression 改善Issueを起票
既存open Issueに同一Outcomeがないか必ず検索してください。
重複がなければ、repository canonical create-issue workflow を使い、少なくとも次のOutcomeを持つ implementation Issue を起票してください。
例タイトル:
実装: Claude-GPT issue-refinement preflight の anchor comment取得を credentialless transportへ統一するOutcome:
必須ACに以下を含めること。
ghcredentialをClaude-GPTへ露出しないgh auth loginworkaround不要5340615957または同等live public anchorを使ったpositive controlgh auth statusが失敗しても、canonical preflight自体は成功できることを確認するIssue refinement / review を実施して consumer-ready contract にしてください。
Phase 3 — control-plane regressionを実装
専用worktreeを作り、IssueのAllowed Pathsに従って実装してください。
impl-review-loopを使用可能なら使用し、implementation
→ focused tests
→ full relevant regression
→ runtime verification
→ adversarial PR review
→ fix_delta
→ re-review
を承認不要で繰り返してください。
ただし merge は実行しないこと。
必須 live verification
unit testだけで完了扱いにしないでください。
fresh isolated Claude-GPT session を実際に起動してください。
repository canonical harness が存在する場合はそれを優先し、例えば:
scripts/claude-gpt/launch.shworktree-agent-runtime-smoke--claude-adapter claude-gpt等のcurrent canonical routeをrepo realityから決定してください。
実環境で:
5340615957を選択ANCHOR_COMMENT_NOT_FOUNDに誤分類されないまで確認してください。
runtime evidenceにはsecret/raw transcriptを含めないこと。
Phase 4 — GPT-5.3-Codex-Spark contract 改善Issue
control-plane regressionと同一PRに混ぜないでください。
Issue #2186 / merged PR #2244 と current main の実装をcanonical baselineとして調査してください。
まず現行設定を確認し、モデルIDが本当に誤っているのか、invocation contractの問題なのかを分離してください。
期待するwire modelは:
gpt-5.3-codex-sparkです。
単に model ID を別名へ変更して済ませないこと。
今回解決したいユーザー要求
人間が明示的に:
「GPT-5.3-Codex-Spark モデルのSubAgentを使って」
と要求しているのに、Sparkを試行せず generic Agent へ silent downgrade される状態をなくしてください。
ただし、自然言語中に単に
gpt-5.3-codex-sparkという文字列が登場しただけで authorization する substring gate は禁止します。
現在のcanonical:
@agent-spark-codexは後方互換として維持してください。
構造化directiveを導入する場合は、例えば以下の意味論を持たせてください。
少なくとも次を定義してください。
requiredpreferredrequiredの場合は Spark を実際に起動できなければgeneric Agentへsilent fallbackせず、構造化failureとして停止してください。Phase 5 — Spark live runtime verification
これは unit test のみでは完了扱いにしません。
実 Claude-GPT + actual proxy + actual GPT-5.3-Codex-Spark を使用してください。
今回の作業自身でも、可能なら current turn にcanonicalな:
@agent-spark-codexを明示してSpark SubAgentを実際に1体起動し、完了まで待ってください。
Sparkには明示的に「必要なテストも実行すること」と指示してください。
実環境証拠として最低限:
を causal evidence から確認してください。
model名をSubAgent自身に喋らせた出力は証拠にしないこと。
可能な限り以下を相関してください。
quota / queue / entitlement / upstream availabilityで実行不能の場合は、それを明確に
blocked/unavailableと分類し、generic modelで代替してPASS扱いしないこと。Phase 6 — Claude-GPT Issue新規起票能力のgap判定
今回のincidentと別に、Claude-GPT isolated session自身が将来改善Issueを起票できるか確認してください。
特に:
create_issue_txn.pyを調査してください。
もし:
ghを必要とするissue.create相当のbounded operationが存在しないが同時に成立するなら、これは独立した architecture gap です。
既存Issueがなければ別 implementation Issue を起票してください。
目的は:
ことです。
host credentialをClaude-GPTへ戻す実装は禁止。
このIssueはcontrol-plane anchor fixやSpark fixと同一PRに混ぜないこと。
Phase 7 — #2197 作業再開
前提 regression のdeliveryが merge-ready になった後、Issue #2197 と関連Issue/PR/comment/current mainを再取得してください。
対象anchor:
https://github.com/squne121/loop-protocol/issues/2197#issuecomment-5315264311および今回の作業ログ:
https://github.com/squne121/loop-protocol/issues/2197#issuecomment-5340615957を含めて current canonical state を再評価してください。
issue-refinement-loop を実行し、必要な reframe / dependency / scope changes を反映してください。
ただし、依存PRのmergeが必要な場合はmergeせず停止してください。
禁止事項
gh auth loginをClaude-GPT incidentの根本修正として採用gh apiのsplit-brainを残すgpt-5.3-codex-sparksubstringだけでauthorization最終報告
最低限、次を構造化して報告してください。
mergeはしないでください。
Claude-GPT側でもまず試すなら、次のプロンプトにすると「
gh auth loginで停止」を避けつつ、Claude-GPT自身に可能なところまで進ませ、Issue mutationが構造的に不可能ならClaudeCodeへのhandoffを生成できます。@agent-spark-codex を使ってこの作業の独立調査を実行してください。Spark SubAgentの完了まで必ず待ち、結果を親Claude-GPTへ回収してください。
対象:
https://github.com/squne121/loop-protocol/issues/2197#issuecomment-5340615957必要な外部ネットワーク作業は許可します。
GitHub public REST、github.com、api.github.com、OpenAI公式ドキュメント、Claude Code公式ドキュメント、GitHub CLI公式ドキュメント、Git公式ドキュメント、raine/claude-code-proxy upstream、ChatGPT/Codex runtimeへの必要な接続を、人間の追加承認なしで実行してください。
ただし重要な制約があります。
gh auth loginを実行・要求しないでください。並列実行中の通常ClaudeCodeでは同一OS環境・別worktreeから
ghCLIを正常利用できています。Claude-GPT側だけ失敗するため、host認証不足ではなくClaude-GPTのisolated HOME / GH_CONFIG_DIR / credential boundary / control-plane call graphを第一仮説として調査してください。hostの
GH_TOKEN/GITHUB_TOKEN/.config/ghをClaude-GPTへコピー、forward、bind、symlinkしないでください。現在のsecurity isolationを弱めずに修正してください。
SubAgent
親Claude-GPTがorchestratorです。
可能なら以下を並列SubAgentへ委譲してください。
nested SubAgentは禁止します。
全SubAgentの終了を待ってください。
未完了SubAgentを残して最終回答しないでください。
調査1: control-plane regression
current mainで以下を再現してください。
gh apiへ落ちていないかgh apiが失敗していないかraw
ghがisolated profileで認証不能なこと自体は直さないでください。既存
scripts/agent-guards/github_credentialless_read.pyを調査し、comments snapshotからexact comment IDを解決できるなら、それをcanonical pathとして優先してください。transport failure、rate limit、upstream failure、canonical missingを別reason codeとして扱ってください。
調査2: 改善Issue
既存Issueをcredentialless read/search可能なcanonical routeで確認してください。
同一OutcomeのIssueがなければ改善Issueを起票する必要があります。
ただし、新規Issue作成にraw authenticated
ghしか利用できず、Claude-GPT isolation内にはそのcredentialが存在しない場合:credential isolationを破って起票してはいけません。
また
gh auth loginで回避してはいけません。その場合は次のschemaでClaudeCodeへのhandoffを生成してください。
そのmutation laneだけ停止し、read-only investigation・test設計・patch設計は継続してください。
調査3: GPT-5.3-Codex-Spark
current mainの設定を確認してください。
期待model:
gpt-5.3-codex-sparkモデルID自体が既に正しい場合、無意味に変更しないでください。
問題は、人間がSpark利用を明示要求しているのにgeneric SubAgentへsilent downgradeされるcontractかもしれません。
今回のcurrent turnにはcanonical:
@agent-spark-codexを明示しています。
Sparkを実際に起動し、完了まで待ってください。
最低限確認:
requiredSpark invocationが失敗したらgenericへsilent fallbackしないこと。Sparkへ必要なテスト実行も明示的に指示してください。
実環境検証要件
Claude-GPT改善Issueには必ずfresh isolated Claude-GPTを使うruntime verification ACを含めてください。
fixture/unit testだけでは不足です。
最低限:
gh auth loginworkaroundなしSpark改善にはさらにactual proxy + actual GPT-5.3-Codex-Sparkで:
を確認するACを入れてください。
raw credential/raw transcriptは保存しないこと。
継続方針
改善Issueをsupported mutation laneで起票できた場合は、Issue refinement → dedicated worktree → implementation → tests → live verification → adversarial reviewまで進めてください。
mergeはしないでください。
Claude-GPTからIssue creationが構造的に不可能なら、その事実をfailureではなくarchitecture gapとして確定し、上記handoffを出してください。
その後 #2197 の再開に必要な調査・設計までは継続してください。
最終回答前に全SubAgentの完了を確認してください。
要点としては、Claude-GPTに
gh auth loginさせるのではなく、Claude-GPTのGitHub操作を「credentialless read」と「credentialを保持するbounded mutation broker」に分け切るのが今の設計との整合性が高いです。今回はClaudeCodeで改善Issueを起票し、Claude-GPTを実環境テスト対象にするルートを推奨します。8 remaining items
squne121 commentedon Sep 2, 2026
推奨アクションは 実装ではなく、まず #2197 を anchor comment に従って
reframe_in_placeすることです。最新レビューはimplementation_allowed: falseですが、過去の blocker 全部を復活させるのではなく、残る接合部だけを修正すれば implementation-ready にできるという判定です。特に private-ref ambiguous failure、fixed worktree の crash/re-run recovery、#2199/#2200 との lifecycle ownership が P0 です。また、#2198 はすでに process-scoped mutex primitive のみを所有し、TTL/stale lease を意図的に持たない契約です。 #2199 は production profile wiring/child execution 側、#2200 は artifact confinement と artifact validation まで lock を保持する統合側を所有しているため、#2197 の AC からそれらを取り除くのが妥当です。
issue-refinement-loop自体も iteration ごとの人間承認を既定で要求せず、Step 1/1b の SubAgent は Step 2 前に完了結果を join する契約です。一方、canonical Step 2 ではissue-reviewerSubAgent を起動してはいけません。以下をそのまま Claude-GPT に渡すのがよいです。
#2197 (comment)
を direct human context / trusted anchor として、Issue #2197 に対する
issue-refinement-loopを実行してください。目的は Issue #2197 を人間承認なしで refinement 完了状態まで持っていくことです。
基本方針
.claude/skills/issue-refinement-loop/SKILL.mdを canonical procedure として使用すること。preflight.run.with_human_contextlane を使用すること。needs-fix/ rewrite / 再レビューはmax_iterationsの範囲で自動継続すること。--dangerously-skip-permissions等を新たに有効化したりすることを、この指示の意味として解釈しないこと。現在利用可能な権限の範囲で自走すること。human_judgment_requiredになった場合だけ停止すること。その前に trusted-anchor continuation、deterministic repair、contract update、issue-editor、read-only investigation による exact path 導出など、SKILL が定義する非対話 continuation lane をすべて消費すること。SubAgent の使用
SubAgent を使用すること。
investigation_policy.required == trueとした場合はcodebase-investigatorを起動する。web_research_policy.required == trueの場合はweb-researcherを起動する。issue-editorSubAgent を使用し、その完了を待ってから fresh review を行うこと。issue-reviewerSubAgent を起動しないこと。run_root_review_pipeline.py produceのcanonical_step2_routeをそのまま routing authority として使うこと。「Backgrounded agent を起動したので終了」のような状態で止めないこと。
Waiting for ... background agent状態になった場合は、その agent の terminal result が得られるまで待ち、その結果を次工程へ反映すること。最初に行うこと
canonical main root / default branch から、anchor を human context として canonical preflight を実行する。
概念的には以下の lane:
preflight.run.with_human_context2197squne121/loop-protocolhttps://github.com/squne121/loop-protocol/issues/2197#issuecomment-5508622077手書きで planner 判定を再実装せず、command registry / canonical executor を使用すること。
trusted contract patch plan が生成された場合は、Step 0g の canonical:
contract_update.run.with_human_contextを使用して consume すること。
NEXT_ACTION: issue_editor_requiredの場合は停止せず、canonical full-rewrite lane へ進みissue-editorに委譲すること。今回の anchor comment に対する推奨 disposition
今回の目的は #2197 の実装開始ではなく、まず
reframe_in_placeを完了させること。anchor の最新レビューを authoritative human context として扱い、古い adversarial review の blocker を機械的に再導入しないこと。
特に以下を反映する。
1. private-ref ambiguous failure を閉じる
run_control_plane_git_fetch_default_ref()が nonce private ref を内部生成する以上、という terminal exception path の rollback を builder 自身が所有する契約にする。
新しい ledger / daemon / recovery subsystem は作らない。
このため、別 micro-Issue を新設するより #2197 の Allowed Paths を必要最小限拡張し、
scripts/agent-guards/skill_runtime_exec.pyを #2197 内で変更可能にする方向を優先する。
既存テスト名・path は current main から確認して exact path を採用すること。
raw argv authority を再開しない。
git fetch --atomicだけで Python wrapper 後段の失敗を解決したことにはしない。2. fixed worktree の crash / rerun recovery を契約化する
.claude/worktrees/control-plane-preflightのような fixed dedicated worktree は、一度正常に add できるだけでは不十分。Ctrl-C、SIGKILL、WSL 停止、Claude 停止、PC 再起動等の後に、検証済み fixed worktree が残っていても再実行可能な narrow semantic lifecycle を定義する。
目標 semantics は概ね:
absent
existing + verified dedicated identity + same accepted OID
existing + verified dedicated identity + clean + different accepted OID
dirty
unknown owner / linkage mismatch
generic な任意 worktree
remove --force --forceAPI は公開しない。これは security machinery ではなく 通常の crash recovery / usability requirement として扱う。
3. #2197 / #2199 / #2200 の ownership を修正する
現在 #2197 が自身の Outcome / AC で
observe → fetch/pin/verify → child/artifact processing → validation → releaseまで所有している箇所を縮める。
#2197 が所有するのは remote-binding protocol と、その protocol 用 lifecycle seam までとする。
例えば概念的には:
#2197 focused tests で証明する範囲:
一方で、
へ残す。
#2197 単独で fake child/artifact callback harness を大量に追加して AC を満たそうとしない。
4. lease / stale semantics を削除する
#2198 が提供済みなのは process-scoped
flockguard であり lease ではない。#2197 本文から unnecessary な:
semantics を除去する。
AC は、
guard.assert_held()が first remote operation 前に成功すること、およびを fail closed することに合わせる。
5. GitHub Issue 状態を runtime prerequisite にしない
#2378 / #2198 が merged/closed かどうかを production runtime で GitHub API に問い合わせる契約を削除する。
それらは source/development prerequisite であり runtime dependency ではない。
現在 main に必要 API が存在することを compile/test/current-repository evidence で扱う。
6. production remote authority を単純化する
個人開発/public GitHub repository という前提を優先する。
production control-plane remote は caller supplied arbitrary URL ではなく、canonical HTTPS literal:
https://github.com/squne121/loop-protocol.gitを code-owned constant として固定する方向を優先する。
ローカル clone の origin が SSH でも、control-plane fetch は canonical HTTPS lane を使用できる設計にする。
今回の threat model は same-UID adversary 防御ではなく、
を中心とする。
TLS/SSH/proxy scanner 等の新しい大型 security broker を再導入しない。
7. remote drift state machine は維持する
以下の bounded semantics は基本的に維持する。
8.
ls-remote --symrefconsumer parser を exact にするgit ls-remote --exit-code --symref <canonical-literal> HEADの結果について focused parser tests を持つ。
成功時は原則:
だけを受理する。
少なくとも:
を fail closed にする。
新しい汎用 parser framework は作らない。
9. verification harness を軽量化する
#2197 の refinement では品質に寄与しない harness を削る。
必須 local evidence は原則:
tests/agent_ops/test_control_plane_worktree_remote_binding.pyの focused pytestとする。
repository-wide:
等は Issue の各 AC に対する local proof として毎回要求せず、CI green を merge condition とする方向へ縮める。
fixture ごとの OID/private-ref 永続 log や専用 artifact を必須化しない。
test assertion と failure 時の verbose output で十分な場合は artifact machinery を増やさない。
Scope 方針
この anchor comment は
reframe_in_placeを明示している。したがって、上記修正のためだけに新しい micro-Issue を起票するより、#2197 の Allowed Paths / AC / Outcome / Verification Commands / Stop Conditions を current design に合わせて更新することを優先する。
ただし #2199/#2200 の既存 ownership を侵食しない。
特に #2199 が所有する production profile integration と、#2200 が所有する artifact confinement / E2E artifact-release ordering を #2197 に取り込まない。
Refinement loop の完了条件
rewrite 後は必ず fresh body を再取得し、fresh deterministic review を実行する。
needs-fixの場合は人間へ戻さず、iteration budget 内で自動 rewrite → review を継続する。semantic design review が applicable な場合も canonical Step 2.5 に従う。
以下になるまで自走すること:
approvemax_iterations 到達、environment/integrity failure、または canonical policy 上どうしても解消不能な
human_judgment_requiredの場合だけ停止してよい。禁止事項
issue-reviewerSubAgent を起動しない最終報告
完了時は簡潔に以下を報告すること。
途中経過だけで終了せず、refinement loop の terminal state まで実行すること。
このケースでは、プロンプト内で 「人間承認不要」だけを強調するより、
with_human_context→ trusted contract update →issue_editor_requiredも自動継続まで明記するのが重要です。そうしないと、Allowed Paths 拡張を検出したところで再び human escalation に落ちる可能性があります。squne121 commentedon Sep 2, 2026
Refinement 完了
trusted OWNER anchor を反映して #2197 を
reframe_in_placeしました。approve、semantic design reviewapprovego(実装はこの refinement run の明示 scope 外として開始していません)sha256:a713f505edb579b4fa060c1d7d2237e42a03f991a40b9fbaa0f0d96937dcdc21pass(新規 remote-binding test は実装前の expected baseline fail として確認)主な reframe:
ls-remote --symrefparser、bounded drift state machineを 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 に固定した。No remaining refinement blocker was found.
squne121 commentedon Sep 2, 2026
推奨は、#2197 を追加 refinement せず、現行
impl-review-loopの Root-Owned Synchronous Entry Transition からそのまま実装へ入れることです。現行 Issue は remote-binding state machine、private-ref cleanup、fixed worktree recovery、guard lifetime、Allowed Paths、AC1–AC10、Verification Commands まで具体化されています。前提となる Git builder の PR #2381 と lifecycle mutex の PR #2395 も既に main へマージ済みです。重要なのは、過去コメントを implementation authorization として再利用せず、同一 root invocation 内で live Issue → current-run
issue-contract-review→ live 再取得 → route → Step 1 を連続実行することです。これは現行impl-review-loopの正規 entry contract です。また SubAgent は単に起動するだけでは不十分で、wait_agent後に final result を取得し、さらにlist_agentsで canonical task がcompletedになったことまで確認してから次ステップへ進むのが正規 completion protocol です。「承認不要」は、通常の worktree 作成、Allowed Paths 内編集、テスト、commit/push、PR 作成・更新、review fix、CI 待機、BEHIND 解消などには人間確認を挟まないという意味にするのが適切です。一方、#2197 自身の Stop Conditions や canonical hard stop は潰さない方がよいです。最終地点は
route: approved/draft_pr_readyで、merge / auto-merge は実行しない、という境界にします。現行 skill も APPROVE 単独では終了せず、live mergeability と blockers 空を要求しています。以下をそのまま Claude Code に渡すのがよいです。
#2197
を対象に、
impl-review-loopを実行してください。目的は Issue #2197 を現行 contract に厳密に従って実装し、検証・PR review・必要な修正ループを自律的に完了させ、merge 直前の
draft_pr_ready/ merge-ready 状態まで持っていくこと です。PR の merge / auto-merge 自体は行わないでください。
それ以外の通常作業については、以下の範囲で人間の逐次承認を求めず自律実行してください。
最優先ルール
最初に必ず現在の repository HEAD にある
.claude/skills/impl-review-loop/SKILL.mdをロードし、そこから参照される canonical procedure、特に以下を正本として従ってください。
steps/preparation.mdsteps/step-1-implementation.mdsteps/step-2-verification.mdsteps/step-4-pr-review.mdsteps/step-5-feedback-and-termination.mdsteps/step-5-mergeability-handling.mdsteps/context-protocol-and-guardrails.mdissue-refinement-loop側の Root-Owned Synchronous Entry Transition / termination policyこのプロンプトと current repository の canonical skill が競合する場合は、current repository の canonical skill を優先してください。
Root-Owned Synchronous Entry Transition
Step 1 を直接・手動で開始しないでください。
root/main thread 自身が、同一の継続した control flow / invocation の中で canonical entry transition を完遂してください。
概念的には以下です。
issue-contract-reviewinvoke_impl_review_loopの場合のみ、同一 invocation 内で Step 1 を開始過去の Issue comment、過去の
CONTRACT_REVIEW_RESULT_V1、snapshot、artifact、handoff token 等を、それ単独で implementation authorization に使用しないでください。今回
human_context_comment_urlsは明示指定されていません。存在しない human-context comment URL を推測・生成しないでください。
Issue authority
実装契約は live Issue #2197 の現在の本文を authority としてください。
特に以下を厳守してください。
Issue 本文で新規追加対象になっている
tests/agent_ops/test_control_plane_worktree_remote_binding.pyが current main に存在しないこと自体は blocker と解釈せず、Issue contract に従って必要なら新規作成してください。
一方、Allowed Paths 外の変更が必要だと判明した場合は、勝手に scope を拡大しないでください。
人間承認不要で実行してよい作業
Issue #2197 と
impl-review-loopの bounded contract 内で必要な以下の作業は、あらかじめ許可します。BEHIND時に canonicalupdate_branchroute が選択した mechanical updateこれらについて「実行してよいですか」「commit してよいですか」「push してよいですか」「PR を作ってよいですか」等の逐次確認は不要です。
ただし以下は許可していません。
SubAgent を必ず使用すること
root/main thread が実装・検証・PR review を直接代行しないでください。
current
impl-review-loopの canonical delegation site に従って、少なくとも以下の SubAgent を使用してください。Step 1
implementation-workerIssue #2197 の live contract、実際の Allowed Paths、必要なら serialized fix_delta を materialize したメッセージで委譲してください。
worker には
.claude/skills/implement-issue/SKILL.mdを使わせてください。Step 2
test-runnercandidate の current head に対し、Issue #2197 の Verification Commands と relevant verification を独立して実行・評価させてください。
Step 2 の canonical
VC_ADJUDICATION_RESULT_V1/ current-head binding procedure を省略しないでください。Step 4
pr-reviewerStep 4 current-head gate が通った場合のみ起動し、
.claude/skills/pr-review-judge/SKILL.mdに従って現在 head をレビューさせてください。SubAgent 完了待ちを必須にする
各 SubAgent dispatch について、起動しただけで次の処理へ進まないでください。
canonical Common Completion Protocol を厳守してください。
各 dispatch site で必ず:
spawn_agentの戻り値から canonicaltask_nameを保存する。wait_agentを使って対象 SubAgent の作業を待つ。wait_agentの timeout、途中経過、mailbox activity、steer 応答を「完了」と解釈しない。list_agentsで canonical task name を照合し、状態が terminalcompletedであることを確認する。completedの両方を確認してからのみ次 Step / routing へ進む。errored/interrupted/shutdown/ lifecycle 上のnot_foundを成功扱いしない。バックグラウンド SubAgent を起動した場合も同様です。
「通知が来るのでそのまま先へ進む」「待機を省略する」といった処理は禁止します。
複数の独立 SubAgent を並列化できる canonical site がある場合は並列化して構いませんが、その全 SubAgent の final result + terminal
completedを確認してから dependent step に進んでください。nested delegation について
root/main → canonical
implementation-worker/test-runner/pr-reviewerというimpl-review-loop自身の delegation は実行してください。ただし Issue #2197 の Stop Conditions にある「nested SubAgent delegation が必要になった場合」は維持してください。
つまり、#2197 の implementation を成立させるために implementation-worker 自身がさらに別 SubAgent を spawn する必要があるなど、canonical loop delegation を越える nested delegation が必要だと判明した場合は、勝手に境界を拡張せず Stop Condition として扱ってください。
実装上の重点
現行 Issue contract に従い、特に次を雑に簡略化しないでください。
ls-remote --exit-code --symref ... HEADparsercontrol_plane_unavailableflockguard の first remote operation 前からの ownership実装前に current main の closed Git builder と lifecycle mutex の実 API を直接確認し、Issue 本文の記述を思い込みで再実装しないでください。
verification 方針
Issue #2197 の Verification Commands を AC proof の authority としてください。
local AC proof のためだけに、Issue が明示的に不要としている
を機械的に毎 iteration 実行しないでください。
ただし current
impl-review-loop/ merge-ready evaluator が最終 merge condition として要求する CI / required checks は別です。PR current head に束縛して確認してください。
SKIP / fallback success / stale-head evidence を PASS に読み替えないでください。
review/fix loop
pr-reviewerがREQUEST_CHANGESを返した場合、人間承認を求めず:fix_deltaにするimplementation-workerに委譲pr-reviewerに再委譲を繰り返してください。
reviewed_head_shaが stale なら人間を呼ばず current head で再レビューしてください。PR が
BEHINDの場合も、canonical route がroute_to_update_branchを選択したなら mechanical update を worker に委譲し、その完了を待った後、verification と PR review を再実行してください。approval と hard-stop の区別
SubAgent が単に
human_review_required: trueを自己申告しただけでは自動停止しないでください。
current
impl-review-loopの routing policy に従ってください。一方、以下の canonical hard stop は無視しないでください。
CONFLICTING/DIRTYLOOP_VERDICT.verdict: HUMAN_REVIEW_REQUIREDhard stop 以外では「念のため人間確認」で停止しないでください。
終了条件
以下をすべて満たすまでループを継続してください。
pr-reviewerが current head にAPPROVEblockers == []approvedroute の条件を満たすcanonical
route_loop_verdict_v2()がapprovedを返したら、IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready相当の完了状態として終了してください。
そこで停止してください。PR は merge しないでください。
最終報告
最後に簡潔に以下を報告してください。
LOOP_VERDICTdraft_pr_readyまで到達したか途中で canonical hard stop に到達した場合だけ、その hard-stop reason と収集済み evidence を報告して停止してください。
この形なら、**「SubAgent を使う」だけでなく「final result + terminal
completedの両方を待つ」**ことまで明文化できます。特に以前の Claude Code 実行で起きやすかった「background agent を起動した後、完了通知待ちのつもりで root が終了してしまう」経路をかなり明確に塞げます。squne121 commentedon Sep 2, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 2, 2026
implement-issue: 実装完了 (2026-09-02T21:48:00Z)
.claude/worktrees/issue-2197-control-plane-preflight-remote-default-rworktree-issue-2197-control-plane-preflight-remote-default-rsqune121 commentedon Sep 2, 2026
impl-review-loop: 完了 (2026-09-02T12:54:51Z)
squne121 commentedon Sep 2, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
fix(#2197): fail closed on dirty same-OID reuse and own private-ref c…
squne121 commentedon Sep 2, 2026
impl-review-loop: 完了 (2026-09-02T13:58:03Z)
feat(#2197): control-plane remote default-ref observe/fetch/pin/verif…
squne121 commentedon Sep 2, 2026
post-merge-cleanup: 完了 (2026-09-02T21:49:42Z)
fix: main() を dedicated execution_root へ実配線し AC5 fixture 欠落を修正 (#2199)
feat: control-plane preflight に dedicated-lane identity probe primiti…