Repository navigation
実装: Claude main-session agent identity と creator/editor Skill Read evidence を runtime smoke に追加する - #2047
Merged
Conversation
…idence を runtime smoke に追加する (#2046) run_worktree_agent_runtime_smoke.py に main-session agent identity (SessionStart hook 由来の requested/observed 分離)、candidate Agent definition binding (project-discovery/hermetic 両 lane)、Skill evidence の declaration/preload/canonical_read 分離、canonical Read receipt (tool_use_id 一致必須)、hermetic no-mutation lane の mutation boundary (settings digest・mutation-capable tool event 検出)、settings provenance を追加する。すべての status は declared/observed/derived_from_observed/ unavailable のいずれかで、model の自己申告やマーカー文字列単体を observed に昇格させない。 issue-creator/issue-editor persona に対する fake-runtime deterministic CI test (test_claude_main_session_agent_runtime_evidence.py) と、 明示的な RUNTIME_SMOKE_CANDIDATE_WORKTREE 環境変数で resolve する real-runtime lane (test_issue_creator_editor_runtime_smoke.py 新規、 test_issue_editor_runtime_smoke.py の #1734 固定 worktree 参照を解消) を追加する。production settings lane (#1881) への昇格禁止を明示する。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
10 tasks
Contributor
Preview URLPreview removed (PR #2047 closed). |
worktree-agent-runtime-smoke skill配下の新規追加見出し3箇所が日本語比率0を満たさずCI failしていたため、既存表記と整合する日本語併記を追加する。 Refs #2046
…e fallback を除去する PR #2047 のレビュー過程で実 Claude Code CLI (2.1.226) に対して hermetic lane / main-session identity を実行し、以下2件の実挙動不一致を発見した。 1. `claude --agents` はファイルパスでなく JSON リテラル文字列を要求する(`--help` で確認)。従来実装はファイルパスをそのまま渡しており、hermetic lane が exit 1 で必ず失敗していた。ファイル内容を読み込んで渡すよう修正。 2. SessionStart hook の `hook_name` suffix(例: `SessionStart:startup`)は起動理由(startup/resume/clear)であり、agent persona 名ではないことを実 invocation で確認した。従来実装はこれを main-session identity の観測値として誤採用しており、`status: observed` の偽陽性を生んでいた(本 Issue の Owner adversarial review が最も懸念していた失敗モード)。SessionStart 由来の identity 観測は、hook 自身が明示的に emit する embedded JSON payload(`agent_type` フィールド)のみに限定し、hook_name suffix を identity source として扱わないよう修正。現在この repo には該当する SessionStart hook script が存在しないため、`main_agent_identity.observed` は現状 `unavailable` に fail-closed される(AC1 の意図通り)。 234 passed, 2 skipped(既存テスト回帰なし)。ruff clean。 Refs #2046
Owner
Author
LOOP_VERDICTpr-review-judge によるレビュー結果を記録する。 verdict: APPROVE
reviewed_head_sha: "7fbe84a46c1c4a209d57ee5e2bcd91403449f720"
blockers: []
warnings: []確認済み事項:
mergeability・review・required checks が満たされたため、squash merge へ進める。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyの summary schema に main-session agent identity(main_agent_identity)・candidate Agent definition binding(agent_definition)・Skill evidence 分離(skill_evidence: declaration/preload/canonical_read)・canonical Read receipt・hermetic no-mutation lane の mutation boundary(mutation_boundary)・settings provenance(settings_provenance)を追加した。すべての新規 status フィールドはdeclared/observed/derived_from_observed/unavailableのいずれかを取り、model 自己申告やマーカー文字列単体をobservedに昇格させない(fail-closed)。--hermetic-agent-definition)は project-discovery の--agent <name>lookup の代わりに、candidate Agent 定義から決定論的に生成した session-local--agentspayload(tools: ["Read"]固定)と session-local--settings(mutation-capable tool を deny)でclaudeを起動し、mutation-capable tool_use event が 1 件でも観測されれば run 全体を FAIL(exit 1)にする。issue-creator/issue-editorpersona に対する fake-runtime deterministic CI test(scripts/agent-ops/tests/test_claude_main_session_agent_runtime_evidence.py、新規 30 test)と、RUNTIME_SMOKE_CANDIDATE_WORKTREE環境変数で明示的に resolve する real-runtime lane test(.claude/agents/tests/test_issue_creator_editor_runtime_smoke.py新規、test_issue_editor_runtime_smoke.pyは#1734固定 worktree 参照を解消)を追加した。.claude/skills/worktree-agent-runtime-smoke/SKILL.md/references/claude-code.md/references/evidence-hygiene.mdを新規 flag・evidence 構造で更新した。bf2c661b→7fbe84a4):claude --agentsは JSON リテラル文字列を要求するが、ファイルパスをそのまま渡しており hermetic lane が常に exit 1 で失敗していた。ファイル内容を読み込んで渡すよう修正。SessionStarthook のhook_namesuffix(SessionStart:startup)は起動理由(startup/resume/clear)であり agent persona 名ではないことを実 invocation で確認した。これを main-session identity のobserved値として誤採用しておりstatus: observedの偽陽性を生んでいた(本 Issue の Owner adversarial review が最も懸念していた失敗モード)。SessionStart 由来の identity 観測を、hook 自身が emit する embedded JSON payload(agent_typeフィールド)のみに限定し、hook_name suffix を identity source として扱わないよう修正。現 repo には該当 SessionStart hook script が存在しないためmain_agent_identity.observedは現状unavailableに fail-closed される(AC1 の意図通り)。本 PR は #2046 を解決し(Closes #2046)、#1978 を参照する(Refs #1978)。
受け入れ条件の達成状況
main_agent_identity.requested/observed/matchedを追加。real invocation でobservedが誤ってstatus: observedになる bug を発見・修正し、hook 欠落時は正しくunavailableに fail-closed することを確認済み。agent_definition.intended_repo_path/intended_sha256/binding_modeを追加。hermetic lane は--agentsの inline JSON 修正後、real invocation でbinding_mode: hermetic・hermetic_payload_sha256・hermetic_agent_nameを伴い exit 0 で成功することを確認済み。project-discovery lane はstatus: unavailable。skill_evidence.declaration(declared)/preload(unavailable)/canonical_read(observed 条件付き) を分離。preload を observed と偽装しない実装をコードで確認。_PERSONA_CANONICAL_SKILL_PATHで issue-creator→create-issue/SKILL.md、issue-editor→edit-issue/SKILL.mdを対象化。tool_use/tool_result ペアからのみobservedになる(marker-only は不可)ことをコードで確認。mutation_boundaryを追加。real invocation(hermetic lane)でsettings_source: session_local_generated・mutation_capable_tool_event_count: 0・status: observedを確認済み。test_claude_main_session_agent_runtime_evidence.py(30+ test)が negative scenario を含めて全 PASS。candidate_worktree_fixtureがtest_run_worktree_agent_runtime_smoke.pyに追加され、.claude/worktrees/issue-1734-...の固定参照を撤去。real-runtime lane はRUNTIME_SMOKE_CANDIDATE_WORKTREE環境変数による明示指定。declared|observed|derived_from_observed|unavailableの4値のみ。raw transcript/prompt/reasoning は summary.md に含まれない。production_settings_laneフィールドが常時記録され、実装: minimal harness の permission/runtime safety boundary を復旧する #1881 merge 前提であることを明示(real invocation で文言確認済み)。検証コマンド結果
worktree
.claude/worktrees/issue-2046-claude-main-agent-evidence(head7fbe84a4)で実行:Allowed Paths 遵守
gh pr diff --name-only 2047で得た変更ファイル 9 件を以下に列挙する。いずれも Issue #2046 の## Allowed Paths(10 パス宣言)内に収まっており、宣言外への変更は無い:scripts/agent-ops/run_worktree_agent_runtime_smoke.py(本体)scripts/agent-ops/tests/test_claude_main_session_agent_runtime_evidence.py(新規テスト)scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py(既存テスト更新).claude/agents/tests/test_issue_creator_editor_runtime_smoke.py(新規テスト).claude/agents/tests/test_issue_editor_runtime_smoke.py(既存テスト更新).claude/skills/worktree-agent-runtime-smoke/SKILL.md(skill 本体更新).claude/skills/worktree-agent-runtime-smoke/references/claude-code.md(参照資料更新).claude/skills/worktree-agent-runtime-smoke/references/evidence-hygiene.md(参照資料更新).github/ci/python-test-plan.json(CI 対象 note 追記)Allowed Paths 外への変更は無い。Scope Delta も無い。
Runtime Verification Evidence(実 runtime 検証証跡)
Issue #2046 の
Runtime Verification Applicability: decision=immediate, applicable_acs: AC7に基づき、real Claude Code CLI で issue-creator / issue-editor それぞれ project-discovery lane と hermetic lane を実行した(tested_head:7fbe84a4相当のfix適用後の worktree、resolved_executable:/home/squne/.local/share/claude/versions/2.1.226)。issue-creator の結果(project-discovery lane、修正後の head で実行):
issue-editor の結果(hermetic lane、
--hermetic-agent-definition、修正後の head で実行):real runtime結果: PASS(両 persona、両 lane で exit 0 に到達。runtime unavailable の SKIP 77 経路はコードで確認済みだが本環境では real runtime が available だったため未発火)。fake-runtime deterministic test(AC6)の PASS をこの real runtime PASS の代替にはしていない。
Schema Change Applicability
WORKTREE_AGENT_RUNTIME_SMOKE_RESULT_V1の summary へ純粋な追加フィールド(main_agent_identity/agent_definition/skill_evidence/mutation_boundary/settings_provenance/production_settings_lane)のみを追加し、既存フィールドの rename・削除・型変更は行っていない。既存の programmatic consumer(このリポジトリ内では.claude/agents/tests/の real-runtime lane test とscripts/agent-ops/tests/の deterministic test のみで、いずれも本 PR で追加・更新した)は新フィールドの有無に依存しないため、consumer migration は不要。Schema Consumer Inventory
N/A
reason:
Schema Change Applicability: not_schema_change(純粋な追加フィールドのみで既存 consumer の migration が不要なため)。Safety Claim Matrix
Notes
.claude/agents/tests/に real-runtime lane を追加/更新したが、既定ではRUNTIME_SMOKE_CANDIDATE_WORKTREE環境変数が未設定のため SKIP する(.github/ci/python-test-plan.jsonの既存 directory target で自動的に収集されるが、実claudeCLI が利用可能かつ環境変数が明示された場合のみ実行される)。.github/ci/python-test-plan.jsonはnotesへ本 Issue の説明エントリを追加したのみで、targetsは変更していない(新規テストファイルは既存のscripts/agent-ops/tests//.claude/agents/tests/directory target で既にカバーされているため)。--agentsinline JSON化、SessionStart hook_name fallback 撤去)は commit7fbe84a4に含まれる。既存 234 テストへの回帰なし。