Repository navigation
実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する - #2745
Conversation
…ical Task Context DBへunscopedで書き込む問題を解消する (#2744) orchestrate_runtime_smoke() を Task Context 自身の runtime 検証における唯一の canonical orchestration entrypoint として明文化・回帰保護する。 - 新規: tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py (AC1) orchestrate_runtime_smoke() が子 generic runner 呼び出し argv へ常に --task-context-scope runtime_smoke と run-scoped isolated --task-context-state-root の両方を渡すことを検証する deterministic な回帰テスト。 - 新規: tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py (AC2, runtime-verification) disposable な shadow canonical root(一時 XDG_STATE_HOME)上で orchestrate_runtime_smoke() を実際の real subprocess として 実行し、execution_runs/events/runtime_locations/projection_outbox の row identity/content delta で isolation を検証する。project hooks は有効なまま。 - scripts/task-context/task_context_runtime_smoke_verifier.py: orchestrate_runtime_smoke() に任意の canonical_task_id/canonical_activity_id パラメータを追加(デフォルト None、既存の default 挙動は不変)。ライブ実行で execution_runs ロールアップを caller の既存の canonical Task/Activity に 正しく attribute できるようにする最小限の内部シーム調整(この実装で live に 実行するまで、orchestrate_runtime_smoke() には呼び出し元が皆無で、この roll-up が isolated seed の id を canonical DB に対してそのまま再利用しようと して常に NotFoundError で落ちる欠陥があった)。 - .claude/skills/worktree-agent-runtime-smoke/SKILL.md: Task Context 自身の runtime 検証では generic runner を direct unscoped で呼ばず、必ず canonical entrypoint (orchestrate_runtime_smoke()) を経由することを normative MUST として明記。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
…拠の証跡ログ出力を追加 (#2744) runtime-verification-policy.md ## 4 証跡保存フォーマットに従い、 artifacts/runtime-verification-AC2-<timestamp>.log へ PASS/FAIL 判定・ canonical DB delta・isolated DB 到達確認を機械可読形式で書き出す。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ke-canonical-entrypoint
Preview URLPreview removed (PR #2745 closed). |
判定: |
| ID | 優先度 | Finding | 主な影響 |
|---|---|---|---|
| F1 | P1 | runtime hookがDBへ何も書かなくても、AC2がPASSできる | 隔離の回帰を検出できない |
| F2 | P1 | runner_argv_extraで隔離先を上書きでき、新テストも見逃す |
正規入口を使っても隔離保証が崩れる |
| F3 | P1 | 新liveテストに既存のclaude_liveマーカーがない |
通常の回帰テストが実Claudeを起動し、利用枠・時間を消費する |
| F4 | P2 | 正規入口の既定呼び出しが、実行後のNotFoundErrorを温存 |
正しい入口を選んでも、必要引数を知らないcallerが失敗する |
| F5 | P2 | pytest.skip()をVCのexit 77として扱っている |
検証未実施が終了コード0になり、機械判定の契約と食い違う |
F2・F4の基礎となる実装上の問題は以前から存在します。今回新しく導入した回帰とは区別しますが、それらを残したまま「唯一の正規入口として回帰保護できた」と結論づける点が問題です。
F1 — AC2は「runtime hookが実際に隔離先へ書いた」ことを検証していない
対象:
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py
test_given_disposable_shadow_canonical_root_when_orchestrate_runtime_smoke_runs_live_then_canonical_tables_unaffected_and_isolated_root_receives_writes()
現在のliveテストがisolated側で確認している肯定的な証拠は、seedのtask_id・activity_idに対応する行の存在です。しかし、その行はorchestrate_runtime_smoke()がClaude起動前に実行するinvoke_smoke_seed()で作成されています。したがって、これはseed処理の成功を示しますが、Claudeのruntime hookが動作して書き込んだ証拠ではありません。
さらに、実際に偽陽性へつながる既存経路があります。task_contextctl.py::_dispatch()は、hook payloadにherdr_tab_idがなければ、DBを開く前に次の結果を返します。
{"decision": "pass", "reason_code": "observe_only_non_herdr"}新テストはXDG_STATE_HOMEとTask Contextのscope/rootを調整しますが、hookに書き込みを発生させるためのHerdr identityを準備していません。hook adapter自身はHERDR_TAB_IDを環境変数から取得するため、非Herdrの通常シェルでは、hookが実行されてもobserve-onlyで終わる経路に入ります。
この場合、次の組み合わせが成立します。
isolated側のseed行は存在する
Claude自体は正常終了する
runtime hookはDBへ何も書かない
canonical側には親プロセスによる予定どおりのroll-upだけ追加される
→ 現在のAC2判定はPASSできる
また、テストはresult.runner_returncodeとresult.canonical_deltaを確認する一方、result.status・statusline_evidenceを確認していません。runner_evidenceの存在自体も必須にしていないので、orchestratorが返した失敗や証拠欠落を、AC2側が取りこぼす構造です。
Claude Codeの公式仕様でも、hookエラーのすべてがセッション失敗になるわけではありません。したがって、CLIの終了コード0をTask Context hookの成功に代用できません。:chatgpt-content-reference{index="10"}
推奨修正
必要なのはhookをfail-closed化することではなく、テスト側で「実際に書いた」証拠を要求することです。
run固有のテスト用identityと既存のisolated fixtureを使い、実Claudeから得たsession IDに対応するexecution_runsやhook由来の行が、isolated DBへ追加されたことを確認してください。seed作成時点とruntime終了時点を分けて観測すれば、事前投入した行をruntimeの成果と誤認しなくなります。
合格条件は、次の論理にするべきです。
必要なruntime hookの実動作が観測された
かつ、その書き込み先がisolated側だった
かつ、canonical側には予定外の差分がなかった。
/clearなど今回のAC2外のシナリオまで全件必須にする必要はありません。ただし、AC2に必要な証拠の欠落やobserve-onlyを、隔離成功として扱ってはいけません。
F2 — runner_argv_extraで隔離先を上書きできる
対象:
scripts/task-context/task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()
tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.pyのextra argvテスト
orchestratorの引数構築は、予約されたscope/rootの後ろにcallerの追加引数を連結しています。
"--task-context-scope", config.RUNTIME_SMOKE_SCOPE_VALUE,
"--task-context-state-root", str(state_root),
*(runner_argv_extra or []),一方、generic runnerの両オプションは、通常のargparse.add_argument(..., default=None)です。重複した値付きオプションを拒否する専用actionではありません。
したがって、例えば次の追加引数で、実効的なrootを上書きできます。
runner_argv_extra=[
"--task-context-state-root",
"/tmp/shadow-canonical-root",
]同じオプション定義を使った、DBやClaudeに触れない最小再現をこちらで実行した結果は、次のとおりでした。
first-occurrence check: /tmp/isolated-root
effective parsed root: /tmp/shadow-canonical-root
これはargparseの通常の値保存動作と整合します。:chatgpt-content-reference{index="13"}
ところが新しい回帰テストは、
argv[argv.index("--task-context-state-root") + 1]で最初の出現位置だけを検査しています。追加引数も--max-turns 3という非競合ケースだけです。テストの説明には「追加引数がcanonical carrierをshadowしてはならない」とありますが、その反例を試していません。
「argv内に正しいフラグが存在する」と「子プロセスがその値を使う」は別です。
推奨修正
Task Context側で、scope/rootの予約ペアを追加引数より後に確定させるなど、callerの追加引数で予約値が変わらない構造にしてください。そのうえで、同じオプションを追加引数に含める否定テストを追加し、最初の文字列ではなく実効値を確認します。
これはgeneric runnerへの制限追加ではありません。Task Context自身が所有する2値の整合性を、自分の入口で維持する修正です。
なお、#2744の現在の契約は「既存のargv構築ロジックを変更しない」としています。この反例がある以上、その前提だけは狭く修正する必要があります。汎用runnerの既定動作や他のcallerへ影響を広げる理由にはなりません。
F3 — 通常のpytest実行で、実Claudeが起動してしまう
対象:
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py
比較対象:pyproject.toml
リポジトリには、すでに実Claudeを使うテストを通常実行から除外する仕組みがあります。
addopts = "--import-mode=importlib -m 'not github_live and not claude_live'"しかし、新しいliveテストにはpytest.mark.claude_liveが付いていません。テスト関数はClaudeの存在と--versionの成功を確認すると、そのままreal subprocessへ進みます。
そのため、例えば通常の、
uv run pytest tests/task-context/ -vでも、Claudeが利用可能なら実際のモデル呼び出しが発生します。さらに#2744の検証手順には全体スイートとliveファイル単体の両方があるため、そのまま順に実行するとlive検証が重複します。
これはセキュリティの問題というより、回帰テストのたびに利用枠を消費し、認証状態・通信状態・モデル応答時間へ依存するようになる、明確な開発体験の後退です。
推奨修正
既存の分類に合わせて、モジュールに以下を付けます。
pytestmark = pytest.mark.claude_livelive実行時だけ、明示的に選択します。マーカーと-mによる選択はpytest標準機能なので、新しい仕組みは不要です。:chatgpt-content-reference{index="20"}
# 通常の回帰テスト:実Claudeを使わない
uv run pytest tests/task-context/ -v
# 明示的なlive実行
uv run pytest -m claude_live \
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -v後者はテスト選択の修正例です。VCとしてのexit 77の扱いは、次のF5の修正も必要です。マーカーだけ付け、既存live VCを変更し忘れると、今度はliveテストがdeselectされるので、両方を同時に直してください。
F4 — 「必ず使え」とした入口の既定呼び出しが、実処理後に失敗する
対象:
scripts/task-context/task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()
.claude/skills/worktree-agent-runtime-smoke/SKILL.md
追加された引数は、両方とも省略可能です。
canonical_task_id: str | None = None
canonical_activity_id: str | None = None省略すると、isolated DBで生成したランダムなTask/Activity IDを、canonical DBのroll-upに再利用します。実canonical DBにはそのIDがないため、通常はNotFoundErrorになります。PR本文と追加docstring自身も、この問題を明記しています。
特に悪いのは、親Task/Activityの妥当性が確認されるのが、seed作成と実Claude起動を終えた後であることです。片方だけ指定した場合も、それぞれ独立してfallbackするため、canonicalとisolatedのIDが混ざります。
これは今回初めて生じたバグではありません。ただし今回のSkill変更では、この関数を必須の正規入口にしています。それにもかかわらず、省略不可である実質的な前提はSkillの変更箇所に説明されていません。
推奨修正
「以前から壊れていた省略時挙動」を互換性として保存する必要性は弱いです。PR自身が既存callerの不在を説明しているので、両IDを必須キーワード引数にし、canonical側の存在・対応関係を子プロセス起動前に確認する形を推奨します。
人間にUUIDを手入力させるのではなく、callerが既存のcurrent Task/Activityを取得して渡すようにし、Skillへ短い呼び出し例を追加すれば十分です。synthetic Taskをcanonical側へ新規作成・importして帳尻を合わせる修正は避けるべきです。
F5 — pytest.skip()では、VCのexit 77にならない
対象:
liveテストのCLI不在分岐・runnerのEXIT_SKIP分岐
現在は、CLIが利用できない場合も、generic runnerがexit 77を返した場合も、最終的にpytest.skip()へ変換しています。
しかし、#2744とリポジトリのruntime verification policyが要求しているのは、VC自身の終了コード77とstdoutのSKIP:プレフィックスです。
こちらでpytest.skip()だけを含むテストを最小再現として実行した結果は、
1 skipped in 0.05s
process_exit_code: 0
でした。pytestの画面には正しくSKIPPEDと表示されますが、プロセスの終了コードは0です。pytest標準の終了コードに、このリポジトリ独自の「環境不足=77」という対応はありません。:chatgpt-content-reference{index="29"}
また、初期SKIPやorchestratorのtimeoutは、後段のログ保存用tryへ入る前に終了するため、現在の_write_runtime_verification_log()では記録されません。
推奨修正
通常pytestのSKIPと、live VCの結果を分けてください。明示的なlive VCの入口で、許可された環境不足をSKIP:+77として返し、失敗は1、実検証成功だけを0にします。
リポジトリにはすでに、
.claude/skills/agent-retrospective/scripts/tests/
verify_run_retrospective_live_cli.sh
という実装例があり、preflight・exit 77・明示的なclaude_live選択を実装しています。このパターンに合わせればよく、global pytest pluginや新しい汎用判定基盤は不要です。ただし、SKIP可能な条件は#2744自身の契約に合わせてください。
今回、変更を広げなくてよい部分
#2570の元の事故は、unscopedなstructured実行によりproduction Taskへexecution_runs・events・runtime_locations・projection_outboxの行が追加されたというものです。今回のshadow canonical DBとrow identity/content deltaによる検証は、その事故に対して適切な方向です。行数比較へ戻す必要はありません。足りないのは、書き込み元の実動作を確かめる側です。
また、#2568/PR #2708で分離したgeneric runnerのtransport責務は維持すべきです。汎用runnerの全呼び出しをfail-closedにする、通常のoperator hookをブロッキングにする、承認ステップを増やす、といった対策は今回の解決には不要です。
PR本文のscope coverageにある古いhead SHAについても、既存コメントでadvisory扱いになっています。今回のマージ判断を止めるべきなのは、そのメタデータではなく上記の実装・検証上の問題です。
推奨する着地点は、「通常テストは実Claudeを起動しない」「明示的なlive canaryは、runtime hook由来のisolated書き込みを証明する」「専用入口の予約値と必須入力を実行前に確定する」の3点です。 新しいセキュリティ基盤や広い検証マトリクスではなく、このPRの小さな修正で狙うべき内容です。
検証範囲
PR差分、#2744の本文・関連コメント、#2568、PR #2708、#2570の事故報告、関連する設定・hook・CLI・pytest資産を確認し、Claude Code・pytest・Pythonの公式資料と照合しました。こちらで実行したのはpytestのSKIP終了コードとargparseの重複オプションの最小再現です。リポジトリ全体のテストや、認証済み実Claudeによるlive検証を再実行したわけではありません。PR記載のlive PASSは提出された証跡として確認していますが、そのテストが十分な判定条件を持つかについて、上記の問題があります。GitHubへの投稿・変更は行っていません。
|
確認した範囲では、起点は PR #2745 ではなく実装 Issue #2744 にするのが適切です。 また、コメント 修正方針は、generic runnerへ責務を広げず、既存4 Allowed Paths内で処理するのがよいです。特にF5は新しい汎用harnessを作るより、既存liveテストファイル内で「pytest用テスト」と「明示live VC entrypoint」を分離し、後者だけが 以下を、すでに auto mode で起動している Claude Code にそのまま渡す想定です。 PR #2745 / Issue #2744 の実装・検証・PRレビューループを再開してください。 対象:
目的: 重要: 開始時に必ず live state を再取得してください。
観測時点では PR #2745 の review対象 head は Root-owned entry
root/main thread が単一の継続 invocation の中で、
までを連続して実行してください。 過去の artifact、contract snapshot、comment、digest 等を Step 1 authorization として代用しないでください。 今回のPRレビューコメントは human context として扱ってください。
ただし raw HTML / raw comment body を implementation-worker の命令文としてそのまま連結しないでください。 最初に contract consistency を解消するコメント5816561294には、現在の #2744 contract と狭い不整合があります。 特に:
これらについて、reviewer finding を満たすために必要な 最小限の contract refinement を current-run contract review 内で正規化してください。 generic runner Task Context semantics を generic runner に逆流させないこと。 可能な限り現在の Allowed Paths:
の4ファイル内に収めてください。 F5のためだけに新しい汎用harness、global pytest plugin、generic runner modificationを追加しないでください。 live VCについては、必要なら
を分離する構造を優先してください。 machine-readable live VC は repository policy に従い、
を保持してください。 通常pytest上の fix_deltaPR comment F1 — runtime hook の実書き込みを証明する現在の AC2 が isolated DB の seed row の存在だけでPASSしないようにしてください。 Claude起動前の live検証では run固有identityを用意し、実Claude sessionから得た session ID 等に結び付く 合格条件は少なくとも:
のANDとしてください。
F2 — runner_argv_extra による予約値shadowを防ぐTask Context canonical entrypointが所有する:
を caller の generic runner自体のargument semanticsは変更しないこと。 予約pairを最終的に確定する、または予約optionの競合をcanonical entrypoint側で扱う等、最小変更で実効値を固定してください。 deterministic regressionには必ず adversarial case を追加してください。 例: 単に F3 — live test を通常回帰テストから分離する
通常の
では real Claude model invocation が発生してはいけません。 明示live VC時だけ real Claudeを起動してください。 通常回帰 suite と live VC を連続実行して、同じlive呼び出しを無意味に二重消費しないよう Verification Commands も整合させてください。 F4 — canonical Task/Activity を実行前に確定する
両者は canonical roll-up に必要な入力として一貫して扱い、
等を、seed作成やreal Claude subprocess起動より 前 に検出してください。 不正入力で実Claude利用枠を消費した後 人間にUUIDを手入力させる設計にはしないでください。 synthetic canonical Taskを新規作成して帳尻を合わせないこと。 F5 — pytest skip と live VC exit 77 を分離する
通常pytest上では通常のpytest semanticsを維持して構いません。 一方、明示的なlive VC入口では:
にしてください。 preflight SKIPやtimeout等も、runtime verification evidence/logging contractから抜け落ちないようにしてください。 既存の SubAgent execution requirementscontrol-plane/root自身が implementation / test / review を代行しないでください。 Step 1: Step 2: Step 4: 各SubAgentを起動したら、そのSubAgentのterminal resultが返るまで必ず待ってください。
SubAgentがまだrunningなら待機を継続してください。 同一iterationで次ステップへ進むのは、直前SubAgentの最終結果を取得・検証した後だけにしてください。 Issue #2744 の Stop Conditions にある Existing PR resumeEvidence-Based Landing Disposition を必ず実行し、PR #2745 が current Issue #2744 の正規existing candidateとして成立するなら:
を使用してください。 新しいworktree / branch / PRを重複作成しないこと。 既存 canonical worktree / branch:
とのidentityをlive stateで確認してください。 PR review commentはtop-level conversation commentであり、現時点のGitHub submitted review / inline review threadの存在を勝手に仮定しないでください。 commentの技術的findingsをfix_deltaへ正規化して扱い、その後はcurrent headに対して独立pr-reviewerを走らせてください。 Verificationimplementation-worker完了後、test-runner SubAgentに current head を独立検証させてください。 最低限:
を current Issue contract に従って評価してください。 AC2 live verificationでは、本物の 必ず disposable shadow canonical root + run-scoped isolated root を使用してください。 project hooksはproduction同様に有効に保ってください。 production canonical DBへの誤writeを検知した場合は、Issueのhard Stop Conditionどおり即停止し、table / row / evidenceを報告してください。 Step 2 の Review loopStep 4では current head に対して fresh reviewerの:
のみをreview conventionとして使用し、mergeabilityはroot/control-planeがlive GitHub stateから独立取得してください。
修正後は同じreview結果を再利用せず、Step 2 → Step 4 をcurrent headで再実行してください。 stale reviewed headなら人間へ聞かず current headで再reviewしてください。 BEHINDなら skill contractに従い update_branch → verification → reviewを行ってください。 artifact freshness / scope-rollup / advisory telemetryのみを理由に人間承認へ止めないでください。 SubAgentの単なる Autonomy / stop policy途中の通常判断について「進めてよいですか」「修正してよいですか」と質問しないでください。 auto modeの権限内で、reversibleでscope内の実装、テスト、commit、branch publish、PR更新、再reviewは自律実行してください。 ただし、impl-review-loop / Issue #2744 が定義する実hard gateは迂回しないでください。 特に以下はhard stopとして扱ってください。
それ以外のwarning/advisory artifact不備だけで停止しないでください。 PR publishing既存PR #2745 を更新してください。 branch publish時は remote head / local head / branch identityをreadbackし、non-fast-forwardやscope contamination時にforce pushへ暗黙fallbackしないでください。 PR本文の:
等が変更後のcurrent head / current Issue contractとstaleになっている場合は更新してください。 特に旧head SHAや、旧AC2が十分だったかのようなclaimを残さないでください。 runtime verification evidenceは、seed writeではなく actual runtime-hook-derived isolated write を証明する内容へ更新してください。 Merge boundaryPRを mergeしないでください。 実装・検証・fresh PR reviewを反復し、reviewer verdictとlive mergeabilityについて skill上到達可能な merge直前状態まで進めてください。 GitHub Draft stateの扱いは現行 最終報告には少なくとも:
を含めてください。 説明だけして終了せず、今から実際に loop を開始してください。 一点だけ注意すると、現在の |
…k/Activity attribution, live hook-write evidence, claude_live opt-in, SKIP(77)/FAIL(1)/PASS(0) entrypoint OWNER review (#2745 (comment)) found 5 findings against the Issue #2744 implementation; this addresses all five within the Issue's unchanged Allowed Paths: - F1 (P1): the AC2 live isolation test now sets a synthetic HERDR_TAB_ID before driving the real run (task-contextctl's dispatcher otherwise short-circuits every hook as observe_only_non_herdr, never opening the isolated DB at all) and asserts a real runtime-hook-authored `events` row landed in the isolated DB, plus result.status=="pass" and result.runner_evidence is not None. Confirmed against two real live runs in this environment: the hook chain genuinely fires (SessionStart / UserPromptSubmit / Stop / SessionEnd, 4 real events rows, a real native_operator execution_run) -- this positive evidence was previously entirely absent from this test. - F2 (P1): orchestrate_runtime_smoke() now places the reserved --task-context-scope/--task-context-state-root pair AFTER runner_argv_extra in the child argv (argparse last-flag-wins), so a caller-supplied runner_argv_extra can no longer shadow the canonical carrier values the generic runner actually parses. Added an adversarial regression test that parses the captured argv with the generic runner's own real build_parser() and asserts the EFFECTIVE parsed value, not just argv's first textual occurrence. - F3 (P1): the live isolation test module is now pytest.mark.claude_live, matching this repo's existing opt-in convention for real-CLI-invoking tests (pyproject.toml's default addopts already deselect it). Note: with this marker, Issue #2744's own single-file VC invocation (`pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -v`) now exits 5 ("no tests ran" -- deselected) unless `-m claude_live` is passed explicitly; test-runner should use `-o "addopts=" -m claude_live -v <file>` to actually execute it. - F4 (P2): canonical_task_id/canonical_activity_id are now required (previously Optional, defaulting to a reuse of the run's own isolated seed ids that could never resolve against a real canonical DB). Both are validated against canonical_conn (service.get_task/get_activity + task_id cross-check) BEFORE any seed/subprocess side effect, not after. SKILL.md documents that callers must pass an existing current Task/Activity, never a human-typed UUID. - F5 (P2): pytest.skip()'s normal SKIPPED/exit-0 semantics under ordinary pytest collection are unchanged. A new, same-file (no new file outside Allowed Paths) `if __name__ == "__main__":` entrypoint provides the documented SKIP(77)/FAIL(1)/PASS(0) contract for direct invocation (`python3 tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py`). Initial-SKIP, generic-runner-EXIT_SKIP, and orchestrator-timeout branches now all persist a runtime-verification-policy.md evidence log too (previously only the PASS/FAIL branches did). Known open finding (not part of this fix_delta, flagged for follow-up): live execution twice reproduced `result.status == "fail"` due to a pre-existing, deterministic `collect_statusline_evidence()` timing gap -- it always queries statusLine strictly AFTER invoke_generic_runner's blocking subprocess.run() has returned, by which point a single-turn `-p --max-turns 2` Claude session has already ended and its binding is already SUSPENDED, so the query can never observe a non-degenerate render. This is unrelated to F1-F5 and outside this Issue's Allowed Paths/Out of Scope (generic runner + statusline timing redesign); it means the AC2 live test will currently FAIL end-to-end pending a follow-up Issue or an explicit OWNER decision on how result.status should treat this sub-check for the structured single-turn lane. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Fix delta 適用(レビュー F1〜F5、https://github.com/squne121/loop-protocol/pull/2745#issuecomment-5816561294)commit eac0749 で以下を実施しました(Allowed Paths 4 ファイルのみ)。
追加で判明した既知の未解決事項(本 fix_delta のスコープ外・follow-up 要)本環境で実 |
…own statusline timing violation Previous iteration's `assert result.status == "pass"` in test_runtime_smoke_verifier_live_shadow_isolation.py failed deterministically against a real claude CLI single-turn structured lane, because orchestrate_runtime_smoke() calls collect_statusline_evidence() only after the blocking generic-runner subprocess.run() completes -- by then the Claude session (including SessionEnd) has already ended, so statusline_evidence.status always reports "executed_degenerate" instead of "executed" (known limitation from #2568 / PR #2708, tracked separately in a follow-up issue). Fixing that timing itself is Out of Scope for Issue #2744 (no changes to orchestrate_runtime_smoke()'s argv construction/responsibility boundary or to the generic runner), and Issue #2744's actual AC2 text never required statusline_evidence to be "executed". Narrow the assertion so a non-"pass" result.status is only tolerated when result.violations is exactly the single known statusline timing violation; any other violation still fails closed as a real regression. Verified against a real claude CLI run (`uv run pytest -o "addopts=" -m claude_live -v tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py`): PASSED, with the persisted AC2 artifact log showing result_status="fail" and result_violations containing exactly the known statusline timing violation string. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…plicable として扱う (#2749) * fix: 完了済み structured runtime-smoke の post-session statusLine を not_applicable として扱う (#2747) orchestrate_runtime_smoke() が collect_statusline_evidence() から "executed_degenerate" を受け取った場合に限り、これを not_applicable として 再解釈し、単独では aggregate result.status を fail にしないようにした。 "failed"/"skipped" は引き続き violations に含め fail にする既存の fail-closed 挙動を維持する。collect_statusline_evidence() 自体の leaf semantics は変更していない。 あわせて test_runtime_smoke_verifier_live_shadow_isolation.py に残っていた PR #2745 由来の _KNOWN_STATUSLINE_TIMING_LIMITATION 特例を撤去し、通常の result.status == "pass" を oracle とする形に書き換えた。回帰テストを test_runtime_smoke_verifier.py に追加した (executed_degenerate → not_applicable、failed/skipped → 引き続き fail、 executed → 既存 semantics 不変、runner failure が not_applicable に マスクされないことの確認)。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: executed_degenerate の not_applicable 再解釈を rendered=="Unbound" に限定する OWNER レビュー指摘(PR #2749 comment)により、collect_statusline_evidence() が "executed_degenerate" を返した際、rendered の内訳(Unbound/Degraded/空文字)を 区別せず一律 not_applicable にしていた問題を修正する。 .claude/hooks/task_context/statusline.py の "Degraded" は exit code 0 で表現される genuine な DB/query/transport failure であり、これを not_applicable に丸め込むと 本物の障害を見逃す。rendered=="Unbound" の場合のみ not_applicable への再解釈を行い、 "Degraded"/空文字は既存の fail-closed 分岐(violations 追加)へフォールスルーする。 回帰テストとして rendered in ["Degraded", ""] のケースで aggregate status が "fail" のまま維持されることを検証する parametrize テストを追加する。 Refs: #2747 Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Test <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
orchestrate_runtime_smoke()(scripts/task-context/task_context_runtime_smoke_verifier.py)を、Task Context 自身の runtime 検証における唯一の canonical orchestration entrypoint として明文化・回帰保護しました。orchestrate_runtime_smoke()が子 generic runner の argv へ常に--task-context-scope runtime_smokeと run-scoped isolated--task-context-state-rootの両方を渡すことを検証する deterministic な回帰テストを新規追加しました。XDG_STATE_HOME)上でorchestrate_runtime_smoke()を実際の real subprocess として実行し、execution_runs/events/runtime_locations/projection_outboxの row identity/content delta 比較で isolation を検証する live テストを新規追加しました。project hooks は無効化せず有効なまま実行しています。.claude/skills/worktree-agent-runtime-smoke/SKILL.mdに、Task Context 自身の runtime 検証では generic runner を direct unscoped で呼ばず、必ず canonical entrypoint を経由することを normative MUST として明記しました。orchestrate_runtime_smoke()にはこれまで実際の呼び出し元が皆無で、live 実行するとexecution_runsroll-up が isolated smoke-seed の id をそのまま canonical DB に対して再利用しようとして常にNotFoundErrorで落ちる欠陥がありました。今回の live 検証(AC2)で初めて顕在化したため、テスト容易性のための最小限の内部シーム調整として、orchestrate_runtime_smoke()に任意のcanonical_task_id/canonical_activity_idパラメータ(デフォルトNone、既存 default 挙動は不変)を追加し、caller が自身の既存 canonical Task/Activity へ正しく attribute できるようにしました。argv 構築ロジック・generic runner との責務境界(実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568/PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708)自体は変更していません。Checks
pnpm typecheckpnpm lintpnpm testpnpm buildSchema Change Applicability
not_schema_changeorchestrate_runtime_smoke()はリポジトリ内に他の呼び出し元が存在しない内部 Python 関数であり、追加したcanonical_task_id/canonical_activity_idは両方デフォルトNoneの純粋additiveなキーワード引数です。producer-consumer 境界をまたぐ machine-readable contract(JSON/YAML schema)ではありません。Schema Consumer Inventory
N/A(
not_schema_changeのため)。Safety Claim Matrix
このセクションは runtime verification に触れる PR のため記載します。
orchestrate_runtime_smoke()経由で live runtime-smoke を実行する限り、子 generic runner 起動 argv は常に--task-context-scope runtime_smokeと run-scoped isolated--task-context-state-rootを含み、real canonical Task Context DB(~/.local/state/loop-protocol/...)への想定外書き込みが発生しないことを、deterministic 回帰テスト(AC1)と real subprocess による live 検証(AC2)の両方で確認したuv run pytest tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py -vPASS。AC2:uv run pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -vPASS(artifacts/runtime-verification-AC2-*.logに row identity/content delta 証跡を保存、PR 本文下部に inline 引用).claude/skills/worktree-agent-runtime-smoke/SKILL.mdに、Task Context 自身の runtime 検証では generic runner を canonical entrypoint 経由で呼び出すことを normative MUST として明記した。generic runner 自体の--task-context-scope/--task-context-state-root解釈・デフォルト挙動(#2568/PR #2708 の責務境界)は変更していないrg -nF "generic runner を直接 unscoped で呼ばず、必ず canonical entrypoint" .claude/skills/worktree-agent-runtime-smoke/SKILL.mdHIT記載ルール確認:
Not controlledは本 PR の 2 claim いずれも空欄です(claim の射程を実装済みの境界に厳密に限定しているため)。generic runner 自体を fail-closed 化する設計(Issue #2744 body 記載の選択肢 b)は、trusted OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/2744#issuecomment-5813327260)による disposition で明示的に不採用と決定済みであり、本 PR のスコープにも Out of Scope にも含まれません。Runtime Verification Evidence(動作検証証跡)
AC2(
<!-- runtime-verification: true -->)の証跡(artifacts/runtime-verification-AC2-20260924T132235Z.log、worktree-local・未コミット):主要な観測値(
--- Output ---より抜粋):events_delta/runtime_locations_delta/projection_outbox_delta: いずれもadded: [] removed: [] mutated: [](shadow canonical 側は完全に無変化)execution_runs_delta.added: ちょうど 1 行のみ(run_kind: runtime_smoke,binding_id: null,task_id/activity_idは事前作成した canonical Task/Activity と一致)isolated_task_row_present/isolated_activity_row_present: 両方true(synthetic smoke-seed writes は isolated 側に実際に着地)canonical_delta.status:pass(forbidden_tables 4 種すべてpass)Notes
M4: Upgrade Loop (v0.4.x)の境界に影響しません(Task Context 自身の runtime 検証手順の回帰保護のみ)claudeCLI subprocess で実行し、結果は本 PR に inline 引用済みです。orchestrate_runtime_smoke()の未使用に起因する潜在的NotFoundErrorを発見し、Allowed Paths 内・generic runner の責務境界を変更しない範囲で追加パラメータにより解消しました(詳細は Summary 参照)。