Repository navigation
Closed
Labels
Description
Parent Issue
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2192"
goal_ref: "#2192 の Child 4(#2237, PR #2293)で production 経路に配線された Agent invocation adapter を実 Claude CLI で統合検証する follow-up"
change_kind: mixedParent Goal Ref
- Goal: 継続的 retrospective Skill(
.claude/skills/agent-retrospective/)を、run boundary・source authority・mutation boundary・public/private artifact 境界が確定した状態で実現する(導入: Claude-GPT運用ログの継続的レトロスペクティブと改善提案を行う agent-retrospective Skill を確立する #2192 参照) - Desired Destination: 導入: Claude-GPT運用ログの継続的レトロスペクティブと改善提案を行う agent-retrospective Skill を確立する #2192 の Child Issues すべてがマージされ、
.claude/skills/agent-retrospective/が MVP として動作する状態。本 Issue はその前提となる Agent invocation adapter の実 CLI 整合性確認(および発見された不整合の最小修正)を担う
Current Validated Scope
.claude/skills/agent-retrospective/scripts/tests/test_run_retrospective_live_cli.pyの新規追加(実claudeCLI を起動する production-shaped 統合テスト).claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.shの新規追加(SKIP exit 77 wrapper。-o addopts=と-m claude_liveを明示指定).claude/skills/agent-retrospective/scripts/schemas/observer_result_v1.schema.json/evaluation_result_v1.schema.jsonの新規追加(production canonical schema asset。このscripts/schemas/はrun_retrospective.pyの--schema-dir既定値であり、CLI--json-schemaに渡す wire-contract schema 専用のディレクトリである。既存の.claude/skills/agent-retrospective/schemas/(validate_retrospective_schema.pyが参照する、永続化された run/improvement-candidate schema 用)とは別名前空間であり、混同しない).claude/skills/agent-retrospective/scripts/run_retrospective.pyのbuild_agent_invocation_argv()/invoke_agent()に対する、live verification で発見された adapter 境界内の最小修正(発見された場合のみ)pyproject.tomlのデフォルト pytest filter にclaude_livemarker を追加(not github_live and not claude_live)。既存のgithub_liveに倣い、markers = [...]配列にもclaude_live: ...の説明エントリをドキュメント整合のため追加する.github/ci/python-test-plan.jsonのruntime_verification_only_markersにclaude_liveを追加
Remaining Parent Gaps
- 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238(run 永続化・agent_retro_index/v1 統合)は completed(closed)。現行 main にも persistence 実装と production wiring が存在する
- 検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239(security boundary・evaluation・live smoke)は Claude Code / Claude-GPT 両ランタイムでの Skill 全体の live smoke を別途カバーする予定であり、本 Issue とは対象範囲が異なる。検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239 は本 Issue の修正済み live adapter contract によって blocked である(本 Issue は
build_agent_invocation_argv()/invoke_agent()という Agent invocation adapter 単体の CLI 整合性検証と、そこで発見された最小修正に限定する)
Outcome
current main のコミット済み agent 定義・JSON Schema asset を用い、production と同じ invoke_agent(..., policy=DelegatedAgentPermissionPolicy(...)) 経路が実 Claude CLI で正常に round-trip することを operator-run local smoke で検証する。検証で adapter 不整合が判明した場合は、adapter 境界内の最小修正を同一 Issue・同一 PR で行う。WSL2/Linux の operator-run local smoke として実行可能。通常の required CI では実行しない。
Runtime Verification Applicability
- decision: immediate
- reason: "
build_agent_invocation_argv()/invoke_agent()が実 Claude CLI の実際のフラグ受理・応答形式と整合するかはプロセス起動・I/O を伴わなければ検証できないため、docs/dev/runtime-verification-policy.md の適用対象になる" - 対応 AC: AC5, AC6, AC7(
<!-- runtime-verification: true -->タグ付与、SKIP exit 77 / fallback FAIL 実装、実行証跡を PR に添付)。AC3(marker 登録)/ AC4(schema 存在)は静的検証(rg/test -f)のみで判定可能なため、本ポリシーの動作検証 AC には該当しない
applicable_acs: AC5, AC6, AC7
execution_environment: "WSL2/Linux, operator-run local smoke, claude CLI binary + default HOME subscription login"
skip_conditions: "claude binary not in PATH; claude auth status exit != 0; pre-invocation auth unavailability"
fallback_policy: "SKIP は PASS へ昇格しない。invocation開始後の failure は exit 1 の FAIL とする。"
artifact_requirements: "tested HEAD、resolved claude binary path、claude --version、case名、verdict、exit code を記録したログを PR に添付する"
In Scope
in_scope:
- production-shaped invoke_agent live round-trip
- actual retrospective-runtime-observer resolution
- committed observer/evaluator JSON Schema assets
- invalid agent fail-closed probe
- invalid schema fail-closed probe
- claude_live pytest marker integration
- thin exit-77 wrapper
- minimal adapter correction discovered by live verificationOut of Scope
out_of_scope:
- full agent-retrospective run
- Claude-GPT runtime
- persistence mutation
- security negative matrix
- redaction expansion
- new GitHub Actions job
- generic worktree/runtime harnessAcceptance Criteria
- AC1:
.claude/skills/agent-retrospective/scripts/tests/test_run_retrospective_live_cli.pyが新規に存在する - AC2:
.claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.shが新規に存在し、claudeバイナリまたは認証情報が利用不可の場合にのみ SKIP(exit 77)を宣言する。それ以外の invocation 開始後の失敗は SKIP へ変換せず exit 1 の FAIL として扱う - AC3:
claude_livepytest marker が登録され、pyproject.tomlのデフォルト filter(not github_live and not claude_live)と.github/ci/python-test-plan.jsonのruntime_verification_only_markersにより、通常の required CI では live case が収集対象外になる - AC4: canonical な
.claude/skills/agent-retrospective/scripts/schemas/observer_result_v1.schema.jsonとevaluation_result_v1.schema.jsonが存在し、両方とも valid な JSON Schema である(既存 mock harness に parity テストを追加する) - AC5: 正常系として、production policy 付き
invoke_agent(request, policy=DelegatedAgentPermissionPolicy(run_id=run_id))を実際のretrospective-runtime-observeragent・committed observer schema・nonce-bound prompt で呼び出し、実claudeCLI が exact nonce-bound structured output を返すことを検証するテストが PASS する(result.status == "ok"、result.exit_code == 0、result.reason_code is None、result.structured_output == expected_payload、result.raw_stdout_excerpt is Noneの完全一致で判定する) - AC6: 異常系として、存在しない agent 名を渡した実 CLI 呼び出しに対し
invoke_agent()がstatus != "ok"かつ business payload なしで終了することを検証するテストが PASS する - AC7: 異常系として、不正な
--json-schemaを渡した実 CLI 呼び出しに対しinvoke_agent()が fail-closed になることを検証するテストが PASS する(exact stderr / exact exit code には依存しない) - AC8: 実行証跡(tested HEAD、resolved
claudebinary path、claude --version、case 名、verdict、exit code)を記録したログが PR に添付される - AC9: live verification で発見された
build_agent_invocation_argv()/invoke_agent()の adapter 境界内不整合は、同一 Issue・同一 PR で最小修正される - AC10: 既存の mock harness ベーステスト
.claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.pyが本 Issue の変更によって全件 PASS する(破壊されない)
Verification Commands
# AC1
# baseline-expect: fail
$ test -f .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective_live_cli.py# AC2
# baseline-expect: fail
$ test -x .claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.sh# AC3
# baseline-expect: fail
$ rg -n "not claude_live" pyproject.toml# AC4
# baseline-expect: fail
$ test -f .claude/skills/agent-retrospective/scripts/schemas/observer_result_v1.schema.json# AC4b
# baseline-expect: fail
$ test -f .claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.json# AC5
# preflight-scope: runtime_only
$ .claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.sh --select real_claude_cli_production_policy_round_trip# AC6
# preflight-scope: runtime_only
$ .claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.sh --select real_claude_cli_invalid_agent_name_error_handling# AC7
# preflight-scope: runtime_only
$ .claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.sh --select real_claude_cli_invalid_schema_fail_closed# AC8
# baseline-expect: fail
$ test -f artifacts/2301/live-cli-verification-log.txt# AC9
# baseline-expect: pass
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -q# AC10
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py -qAllowed Paths
.claude/skills/agent-retrospective/scripts/run_retrospective.py.claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py.claude/skills/agent-retrospective/scripts/tests/test_run_retrospective_live_cli.py.claude/skills/agent-retrospective/scripts/tests/verify_run_retrospective_live_cli.sh.claude/skills/agent-retrospective/scripts/schemas/observer_result_v1.schema.json.claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.jsonpyproject.toml.github/ci/python-test-plan.json
Stop Conditions
- adapter、CLI schema asset、live-test選択設定を越えて、collector、persistence、evaluation semantics、security boundaryの変更が必要になった場合のみ停止する。
- 動作検証 AC の VC が SKIP(exit 77)を返した場合(実行環境不可のためエスカレーション)
- fallback 経由でのみ「成功」する場合(FAIL として扱い、実行環境を確認)
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/runtime-verification-policy.md
- .claude/skills/agent-retrospective/SKILL.md
Scope Delta(任意)
N/A
Source
- origin: post-merge-cleanup
- source_pr: 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2293
- dedupe_key: follow-up:squne121/loop-protocol:pr/2293:1
Activity
squne121 commentedon Aug 23, 2026
判定
REQUEST_CHANGES — reframe_in_placeIssue #2301 の目的である「実 Claude CLI による adapter 検証」は必要です。PR #2293 では、99件の hermetic test と一度の
APPROVEを通過した後に、実CLIとの不一致――--agent欠落、schema path と schema本文の取り違え、metadata wrapper とstructured_outputの取り違え――が敵対的レビューで発見されました。mock-only 検証では再発防止にならないため、live verification 自体を削除すべきではありません。一方、現在の Issue 契約はその目的を確実に達成できません。調査時点の
mainは0e2bd0fe1cf76ca9d73d1585ff1ab3e15f96c7b7です。Blocker
P0-1 — 不整合を発見するIssueなのに、発見した不整合を修正できない
Issue は次の三つを同時に規定しています。
run_retrospective.pyは Allowed Paths に含まれるproduction logic の変更は Out of Scope
live testでproduction不整合が見つかったら、別Issueへ分割して停止する
その停止理由には「Allowed Pathsを超えるため」とある
run_retrospective.pyは既に Allowed Paths 内なので、最後の説明は形式的にも矛盾しています。さらに、#2239 は #2301 を hard dependency として扱っているため、「テスト追加済みだが adapter は壊れたまま」という状態で #2301 を完了させると依存グラフが虚偽になります。必須修正
build_agent_invocation_argv()/invoke_agent()と、その直接依存するschema assetの最小修正を本Issueに含めてください。停止条件は次の境界にするべきです。
Issueタイトルも次が正確です。
別Issueを増やす必要はありません。
P0-2 — 新しいpytestがshell wrapperを迂回してrequired CIから直接実行される
既定の
python-testは.claude/skills/agent-retrospective/scripts/tests/をディレクトリ単位で収集します。したがって、予定されているtest_run_retrospective_live_cli.pyは、shell wrapperを経由せずrequired CIから直接収集・実行されます。現在、デフォルトから除外されるruntime-only markerはgithub_liveだけです。このままでは二つの失敗形があります。
pytest側で
skipすると、wrapperのexit 77契約を通らず、CI上は緑になるskipしなければ、required CIがClaude認証・ネットワーク・課金可能な推論へ依存する
既存のCI selection実装には、外部runtime専用テストを通常CIから除外しつつ、変更テスト未収集として誤検知しない仕組みが既にあります。新しいハーネスを作る必要はありません。
必須修正
pytest marker
claude_liveを追加pyproject.tomlのデフォルトfilterをnot github_live and not claude_liveに変更.github/ci/python-test-plan.jsonのruntime_verification_only_markersにclaude_liveを追加live testの全caseを
claude_liveにするpytest test内では
skip/xfailを使用しないwrapperだけが事前条件不足を
exit 77に分類するwrapperは
-o addopts=と-m claude_liveを明示して実行するしたがって、次の二つをAllowed Pathsへ追加する必要があります。
新しいGitHub Actions jobやrequired checkは不要です。
P0-3 — AC3はproduction-shaped invocationを通さずに達成できる
現行production pathでは、
run_cli()が毎回DelegatedAgentPermissionPolicyを生成し、そのpolicyを付けてinvoke_agent()を呼びます。policy付きの場合、argvには--disallowedToolsが追加され、child environmentもallowlistで削減されます。ところが現在のAC3は、次の実装でも達成可能です。
または、
これでは次を検証しません。
productionの
--disallowedToolsproductionの環境変数削減
promptのstdin供給
cwd=repo_rootactual project agentの解決
--no-session-persistenceproduction wrapper parser
特に、現行コードはdeny ruleをcomma-joinedな1引数として渡していますが、公式CLI referenceの例は複数ruleを別引数として提示しています。comma形式が現在も受理されるかは、まさにlive testで確認すべき接触面です。公式には
--agent、--disallowedTools、--json-schema、--no-session-persistenceがそれぞれ現在のCLI surfaceとして定義されています。(Claude)AC3は以下に固定すべきです。
さらにrequestは以下を満たす必要があります。
direct
subprocess.run()はwrapperのpreflight用途以外では禁止し、合否判定は必ずproductioninvoke_agent()の戻り値で行うべきです。P0-4 — 「CI/ローカルで実行可能」というOutcomeが現行認証契約と一致しない
現行policyがchildへ渡す一般環境変数は
PATH、HOME、LANG、LC_ALL、TZに限定されています。公式のCI・script向け認証方法であるCLAUDE_CODE_OAUTH_TOKENは渡されません。カスタムcredential locationに必要なCLAUDE_CONFIG_DIRも渡されません。公式には、非対話CI用tokenは
claude setup-tokenで発行し、CLAUDE_CODE_OAUTH_TOKENとして渡します。一方、Linuxの通常ログインcredentialは既定で$HOME/.claude/.credentials.jsonに保存されます。つまり現行adapterで自然に成立するのは、主として既定HOMEを使ったローカルsubscription loginです。(Claude)個人趣味開発の前提では、ここでCI token passthroughやsecret管理を追加する必要はありません。Outcomeを次へ縮小する方が合理的です。
分類は次のように固定してください。
状況 | 判定 -- | -- claude がPATHにない | SKIP, exit 77 claude auth status がexit 1 | SKIP, exit 77 actual invocation開始前の明確な認証不可 | SKIP, exit 77 invocation開始後のtimeout、network、rate limit、model error、invalid wrapper | FAIL, exit 1 exact structured output一致 | PASS, exit 0claude auth statusはJSONを返し、ログイン済みなら0、未ログインなら1という公式契約があります。ただし、これだけで実model invocation成功を保証したことにはなりません。(Claude)P0-5 — productionが参照するcanonical schema assetが存在しない
これはIssue本文に記載されていない、現行mainの実装資産上のblockerです。
main()の既定--schema-dirはscripts/schemas/です。run_cli()はそこから次の二つを読みます。しかし、現行mainの
scripts/配下一覧にはschemas/ディレクトリがありません。repository全体のexact searchでも、これらの名前はコードとtest内の参照しか見つかりません。SKILL.mdも
--schema-dir <observer/evaluator 用 JSON Schema ファイルの配置ディレクトリ>というplaceholderを要求するだけで、生成元・canonical path・生成手順を定義していません。したがって、live testが
tmp_pathに簡易schemaを書いて成功しても、証明できるのは「fixture schemaならCLIが動いた」だけです。production entrypointが使えることは証明できません。推奨修正
次を本Issueに追加してください。
少なくとも正常系live testは、temporary schemaではなくcommit済みの
observer_result_v1.schema.jsonを直接使用します。既存mock testにも、両schemaがvalid JSON Schemaであり、dataclassのrequired top-level fieldと一致する最小parity testを追加するべきです。production schemaを本Issueで追加しない場合は、Outcomeから「production」「MVP前提」を削除し、#2239のhard dependencyも解除する必要があります。推奨はschema assetを本Issueで追加する方です。
P1 findings
P1-1 — 正常系oracleが弱すぎる
「
structured_outputがdictだった」だけでは不十分です。default agentがschemaに従って返しても通るため、named agent、prompt transport、値のbindingを十分に検証できません。公式には
--output-format json --json-schemaの結果はmetadata wrapperとなり、business payloadはstructured_outputに格納されます。また--agentはmain session全体へ、そのagentのsystem prompt、tool restriction、modelを適用します。(Claude)正常系は、実際の
retrospective-runtime-observerを使うのが最小です。このagentはtools: []、model: haikuで、実行中のmutationや追加調査を必要としません。schemaで以下を
const固定してください。assertionは次の完全一致です。
モデルのproseやtoken count、session IDには依存させないでください。
P1-2 — invalid-schemaがIn ScopeにあるのにACがない
In Scopeには「存在しないagent名 / 不正な
--json-schema」の二つがありますが、AC4はinvalid agentだけです。invalid-schemaも残すなら、ACを独立させてください。ただし、exact stderrやexact exit codeは固定しない方がよいです。公式仕様ではinvalid schemaの挙動がv2.1.205で変更されており、それ以前はschemaを無視してunstructured outputを返していました。現在はinvalid schemaでエラー終了します。(Claude)
安定したoracleは次です。
stderrの完全一致は不要です。
2026年8月23日時点の公式npm packageは
2.1.241ですが、Issueにこのversionを固定する必要はありません。実行証跡へ実際のversionを記録するだけで十分です。(npm)P1-3 — #2238に関する記述がstale
#2301 の Remaining Parent Gaps は #2238 を未着手のように扱っていますが、#2238 は既にclosedです。現行mainにもpersistence実装とproduction wiringがあります。
この段落は削除し、現在の依存関係を次に更新するべきです。
P1-4 — generic runtime harnessへの接続は過剰
repositoryには既に、worktree identity、Herdr lifecycle、process group、cleanup receipt、0/1/77を扱う大規模なcross-runtime smoke runnerがあります。これは #2301 のadapter単体確認には過剰です。
#2301では次だけで足ります。
pytest live test
claude_livemarker20〜50行程度のthin shell wrapper
artifacts log
1回の正常推論
client-sideで失敗するinvalid-agent / invalid-schema probe
新しいworktree manager、GitHub Actions、hook、receipt schema、runtime brokerは追加しないでください。広いsecurity/live-smoke harnessは #2239 に残すべきです。
推奨する改訂契約
Outcome
In Scope
Out of Scope
改訂AC
claude_livemarkerが登録され、通常CIではlive caseが収集対象外になる。canonical observer/evaluator schema assetが存在し、JSON Schemaとしてvalidである。
wrapperはbinary/auth unavailableの場合だけ
SKIP:とexit 77を返す。actual invocation開始後の失敗はすべてexit 1であり、SKIPへ変換しない。
production policy付き
invoke_agent()が実CLIでexact nonce-bound structured outputを返す。invalid agentが
status != okかつbusiness payloadなしで終了する。invalid schemaがfail-closedになり、exact stderrには依存しない。
証跡にtested HEAD、resolved binary path、
claude --version、case、verdict、exit codeを記録する。検出したadapter不整合は同じPR内で修正可能である。
既存mock harnessが全件PASSする。
改訂Allowed Paths
最終評価
実 Claude CLI自体の起動は行っておらず、今回の判定はcurrent GitHub資産、関連Issue/PR/comment、現行production code、および公式Claude Code仕様に基づく契約レビューです。
# 判定REQUEST_CHANGES — reframe_in_placeIssue #2301 の目的である「実 Claude CLI による adapter 検証」は必要です。PR #2293 では、99件の hermetic test と一度の
APPROVEを通過した後に、実CLIとの不一致――--agent欠落、schema path と schema本文の取り違え、metadata wrapper とstructured_outputの取り違え――が敵対的レビューで発見されました。mock-only 検証では再発防止にならないため、live verification 自体を削除すべきではありません。一方、現在の Issue 契約はその目的を確実に達成できません。調査時点の
mainは0e2bd0fe1cf76ca9d73d1585ff1ab3e15f96c7b7です。Blocker
P0-1 — 不整合を発見するIssueなのに、発見した不整合を修正できない
Issue は次の三つを同時に規定しています。
run_retrospective.pyは Allowed Paths に含まれるrun_retrospective.pyは既に Allowed Paths 内なので、最後の説明は形式的にも矛盾しています。さらに、#2239 は #2301 を hard dependency として扱っているため、「テスト追加済みだが adapter は壊れたまま」という状態で #2301 を完了させると依存グラフが虚偽になります。必須修正
build_agent_invocation_argv()/invoke_agent()と、その直接依存するschema assetの最小修正を本Issueに含めてください。停止条件は次の境界にするべきです。
Issueタイトルも次が正確です。
別Issueを増やす必要はありません。
P0-2 — 新しいpytestがshell wrapperを迂回してrequired CIから直接実行される
既定の
python-testは.claude/skills/agent-retrospective/scripts/tests/をディレクトリ単位で収集します。したがって、予定されているtest_run_retrospective_live_cli.pyは、shell wrapperを経由せずrequired CIから直接収集・実行されます。現在、デフォルトから除外されるruntime-only markerはgithub_liveだけです。このままでは二つの失敗形があります。
skipすると、wrapperのexit 77契約を通らず、CI上は緑になる既存のCI selection実装には、外部runtime専用テストを通常CIから除外しつつ、変更テスト未収集として誤検知しない仕組みが既にあります。新しいハーネスを作る必要はありません。
必須修正
claude_liveを追加pyproject.tomlのデフォルトfilterをnot github_live and not claude_liveに変更.github/ci/python-test-plan.jsonのruntime_verification_only_markersにclaude_liveを追加claude_liveにするskip/xfailを使用しないexit 77に分類する-o addopts=と-m claude_liveを明示して実行するしたがって、次の二つをAllowed Pathsへ追加する必要があります。
新しいGitHub Actions jobやrequired checkは不要です。
P0-3 — AC3はproduction-shaped invocationを通さずに達成できる
現行production pathでは、
run_cli()が毎回DelegatedAgentPermissionPolicyを生成し、そのpolicyを付けてinvoke_agent()を呼びます。policy付きの場合、argvには--disallowedToolsが追加され、child environmentもallowlistで削減されます。ところが現在のAC3は、次の実装でも達成可能です。
または、
これでは次を検証しません。
--disallowedToolscwd=repo_root--no-session-persistence特に、現行コードはdeny ruleをcomma-joinedな1引数として渡していますが、公式CLI referenceの例は複数ruleを別引数として提示しています。comma形式が現在も受理されるかは、まさにlive testで確認すべき接触面です。公式には
--agent、--disallowedTools、--json-schema、--no-session-persistenceがそれぞれ現在のCLI surfaceとして定義されています。([Claude]1)AC3は以下に固定すべきです。
さらにrequestは以下を満たす必要があります。
direct
subprocess.run()はwrapperのpreflight用途以外では禁止し、合否判定は必ずproductioninvoke_agent()の戻り値で行うべきです。P0-4 — 「CI/ローカルで実行可能」というOutcomeが現行認証契約と一致しない
現行policyがchildへ渡す一般環境変数は
PATH、HOME、LANG、LC_ALL、TZに限定されています。公式のCI・script向け認証方法であるCLAUDE_CODE_OAUTH_TOKENは渡されません。カスタムcredential locationに必要なCLAUDE_CONFIG_DIRも渡されません。公式には、非対話CI用tokenは
claude setup-tokenで発行し、CLAUDE_CODE_OAUTH_TOKENとして渡します。一方、Linuxの通常ログインcredentialは既定で$HOME/.claude/.credentials.jsonに保存されます。つまり現行adapterで自然に成立するのは、主として既定HOMEを使ったローカルsubscription loginです。([Claude]2)個人趣味開発の前提では、ここでCI token passthroughやsecret管理を追加する必要はありません。Outcomeを次へ縮小する方が合理的です。
分類は次のように固定してください。
claudeがPATHにないSKIP, exit 77claude auth statusがexit 1SKIP, exit 77SKIP, exit 77FAIL, exit 1PASS, exit 0claude auth statusはJSONを返し、ログイン済みなら0、未ログインなら1という公式契約があります。ただし、これだけで実model invocation成功を保証したことにはなりません。([Claude]1)P0-5 — productionが参照するcanonical schema assetが存在しない
これはIssue本文に記載されていない、現行mainの実装資産上のblockerです。
main()の既定--schema-dirはscripts/schemas/です。run_cli()はそこから次の二つを読みます。しかし、現行mainの
scripts/配下一覧にはschemas/ディレクトリがありません。repository全体のexact searchでも、これらの名前はコードとtest内の参照しか見つかりません。SKILL.mdも
--schema-dir <observer/evaluator 用 JSON Schema ファイルの配置ディレクトリ>というplaceholderを要求するだけで、生成元・canonical path・生成手順を定義していません。したがって、live testが
tmp_pathに簡易schemaを書いて成功しても、証明できるのは「fixture schemaならCLIが動いた」だけです。production entrypointが使えることは証明できません。推奨修正
次を本Issueに追加してください。
少なくとも正常系live testは、temporary schemaではなくcommit済みの
observer_result_v1.schema.jsonを直接使用します。既存mock testにも、両schemaがvalid JSON Schemaであり、dataclassのrequired top-level fieldと一致する最小parity testを追加するべきです。production schemaを本Issueで追加しない場合は、Outcomeから「production」「MVP前提」を削除し、#2239のhard dependencyも解除する必要があります。推奨はschema assetを本Issueで追加する方です。
P1 findings
P1-1 — 正常系oracleが弱すぎる
「
structured_outputがdictだった」だけでは不十分です。default agentがschemaに従って返しても通るため、named agent、prompt transport、値のbindingを十分に検証できません。公式には
--output-format json --json-schemaの結果はmetadata wrapperとなり、business payloadはstructured_outputに格納されます。また--agentはmain session全体へ、そのagentのsystem prompt、tool restriction、modelを適用します。([Claude]3)正常系は、実際の
retrospective-runtime-observerを使うのが最小です。このagentはtools: []、model: haikuで、実行中のmutationや追加調査を必要としません。schemaで以下を
const固定してください。{ "schema_version": "observer_result/v1", "run_id": "<random nonce>", "base_sha": "<tested HEAD>", "source_set_digest": "<random digest>", "observer_id": "retrospective-runtime-observer", "evidence_ref": "<random evidence nonce>", "findings": [] }assertionは次の完全一致です。
モデルのproseやtoken count、session IDには依存させないでください。
P1-2 — invalid-schemaがIn ScopeにあるのにACがない
In Scopeには「存在しないagent名 / 不正な
--json-schema」の二つがありますが、AC4はinvalid agentだけです。invalid-schemaも残すなら、ACを独立させてください。ただし、exact stderrやexact exit codeは固定しない方がよいです。公式仕様ではinvalid schemaの挙動がv2.1.205で変更されており、それ以前はschemaを無視してunstructured outputを返していました。現在はinvalid schemaでエラー終了します。([Claude]1)
安定したoracleは次です。
stderrの完全一致は不要です。
2026年8月23日時点の公式npm packageは
2.1.241ですが、Issueにこのversionを固定する必要はありません。実行証跡へ実際のversionを記録するだけで十分です。([npm]4)P1-3 — #2238に関する記述がstale
#2301 の Remaining Parent Gaps は #2238 を未着手のように扱っていますが、#2238 は既にclosedです。現行mainにもpersistence実装とproduction wiringがあります。
この段落は削除し、現在の依存関係を次に更新するべきです。
P1-4 — generic runtime harnessへの接続は過剰
repositoryには既に、worktree identity、Herdr lifecycle、process group、cleanup receipt、0/1/77を扱う大規模なcross-runtime smoke runnerがあります。これは #2301 のadapter単体確認には過剰です。
#2301では次だけで足ります。
claude_livemarker新しいworktree manager、GitHub Actions、hook、receipt schema、runtime brokerは追加しないでください。広いsecurity/live-smoke harnessは #2239 に残すべきです。
推奨する改訂契約
Outcome
In Scope
Out of Scope
改訂AC
claude_livemarkerが登録され、通常CIではlive caseが収集対象外になる。SKIP:とexit 77を返す。invoke_agent()が実CLIでexact nonce-bound structured outputを返す。status != okかつbusiness payloadなしで終了する。claude --version、case、verdict、exit codeを記録する。改訂Allowed Paths
最終評価
実 Claude CLI自体の起動は行っておらず、今回の判定はcurrent GitHub資産、関連Issue/PR/comment、現行production code、および公式Claude Code仕様に基づく契約レビューです。
[-]実装: agent-retrospective の Agent invocation adapter を実 Claude CLI で統合検証する[/-][+]検証・修正: agent-retrospective の production Agent invocation adapter を実 Claude CLI で確認する[/+]squne121 commentedon Aug 23, 2026
issue-refinement-loop: approved
Issue #2301 の本文品質レビューが完了しました(issue-refinement-loop 実行、anchor comment: https://github.com/squne121/loop-protocol/issues/2301#issuecomment-5386767825)。
対応した OWNER 指摘(reframe_in_place, REQUEST_CHANGES)
claude_livepytest marker・pyproject.toml/.github/ci/python-test-plan.jsonの CI 分離設定を追加し、Allowed Paths に反映invoke_agent(request, policy=DelegatedAgentPermissionPolicy(run_id=run_id))を明示要求する記述に固定observer_result_v1.schema.json/evaluation_result_v1.schema.json) の新規追加を Allowed Paths / AC4 に追加追加で解消した項目
baseline-expectannotation)を修正(jq/python3 -m系をtest -fへ、.shwrapper 呼び出しにpreflight-scope: runtime_onlyを付与、baseline-expect: goをpassに修正)claude_livemarker のドキュメント整合注記追加)を全て解消Final Gate
issue-reviewerVERDICT: approve(deterministic checker 全 pass)assessment: clear, findings 0件issue-contract-review(execute mode, baseline evidence, HEADf6a882cc):CONTRACT_REVIEW_RESULT_V1.status: go(全 VC が想定通り分類: AC1/2/3/4/8 = expected_fail、AC5/6/7 = skipped(runtime_only)、AC9/10 = expected_pass)body_sha256:
sha256:804eef7d0e17b84e53cf794be752496d0dac78bb6fb30d826dc580aa56eab099squne121 commentedon Aug 23, 2026
implement-issue: 実装完了 (2026-08-23T22:07:55Z)
194ac42e25df08fb21d07e8b60abc794acb811cd).claude/worktrees/issue-2301-agent-invocation-live-cliworktree-issue-2301-agent-invocation-live-cli動作検証(AC5〜AC7、実 claude CLI 2.1.241)
実行環境(claude バイナリ + 認証済み subscription login
subscriptionType: max)が利用可能だったため SKIP せず実際に実行し、3 ケース全て PASS しました。SKIP パス(
PATHを制限し claude バイナリ不在を再現)も手動確認:exit 77。AC9: 発見した adapter 境界内不整合と最小修正
claude -p --agent <custom-subagent> --output-format json --json-schema ... --no-session-persistence実行は、--agentを伴わない schema-less 実行と異なり、応答 wrapper にstructured_outputフィールドを含めないことを実 CLI で確認しました(schema 適合 JSON は wrapper のresultテキストに markdown fence 付きで含まれる)。この結果、修正前のinvoke_agent()は実--agent呼び出しを常にmalformed_output/missing_structured_outputとして扱っていました。run_retrospective.pyに_structured_output_from_result_fallback()を追加し、structured_outputが欠落している場合のみresultテキストから JSON を抽出し、渡した schema ファイルへjsonschema.validate()で独立に再検証してから受理するようにしました(structured_outputが存在する場合は従来どおりそちらを優先。schema 不適合/JSON parse 不能な場合は従来どおりmalformed_outputのまま)。Verification Commands(AC1-4, AC8, AC10)
全て PASS:
AC1
test -f .../test_run_retrospective_live_cli.pyAC2
test -x .../verify_run_retrospective_live_cli.shAC3
rg -n "not claude_live" pyproject.tomlAC4
test -f .../schemas/observer_result_v1.schema.json/evaluation_result_v1.schema.jsonAC8 実行証跡ログ作成(
artifacts/2301/live-cli-verification-log.txt、gitignore 対象のためローカルのみ・PR body に全文転記)AC10
uv run --locked pytest .../test_run_retrospective.py -q→129 passed(122 既存 + 7 新規 schema parity テスト)後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup。follow-up: 検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239(Skill 全体の live smoke、本 PR の修正済み adapter contract を前提に着手可能)。
fix: PR #2324 OWNER REQUEST_CHANGES を反映し adapter/live検証を修正する (#2301)
test: agent-retrospective の実 claude CLI 統合検証を追加し adapter を最小修正する (#2301…