Repository navigation
Open
Labels
phase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "impl-review-loop preparation Step 2.5 の scope-rollup-runner capture が unquoted ISO8601 timestamp の datetime 誤変換・SubAgent による非 verbatim 転記で反復して fail-closed する問題を解消する"
change_kind: workflowParent Issue
none(単独改善)
Parent Goal Ref
- Goal: なし(単独改善のため親 Issue なし)
- Desired Destination: なし
Current Validated Scope
- .claude/skills/impl-review-loop/scripts/parse_scope_rollup_run_result.py の YAML パースを timestamp-safe にする
- .claude/hooks/capture_scope_rollup_final_response.py の YAML パースを timestamp-safe にする
- .claude/agents/scope-rollup-runner.md に timestamp クォート必須化・raw stdout verbatim 転記の明示指示を追加する
- 上記変更を回帰させる新規 pytest を追加する
Remaining Parent Gaps
- なし。ただし agent_type_mismatch / hook_unavailable が特定の起動経路で頻発する根本原因(SubAgent 起動方法と SubagentStop hook 発火条件の不整合の可能性)は本 Issue のスコープ外であり、必要なら follow-up の調査 Issue で扱う。
Outcome
parse_scope_rollup_run_result.py と capture_scope_rollup_final_response.py が、ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 marker 内のクォートなし ISO8601 timestamp(ネストされた result.payload 内も含む)を PyYAML の datetime 自動変換に晒さず常に文字列として扱い、TypeError を送出せず決定論的な reject を返すよう修正され、かつ scope-rollup-runner.md に timestamp フィールドの二重引用符必須化と executor raw stdout の verbatim 転記を明示する指示が追加された状態。対応する新規回帰テスト(2ファイル)が追加され全て PASS している。
In Scope
- parse_scope_rollup_run_result.py の _load_yaml_no_duplicate_keys(内部の _StrictLoader)から PyYAML の implicit timestamp resolver を除去し、marker 内の全フィールド(トップレベルの requested_at / generated_at と result.payload 配下のネストされたフィールドの両方)でクォートなし ISO8601 文字列が datetime 型へ自動変換されないようにする
- capture_scope_rollup_final_response.py の _StrictLoader に同様の timestamp resolver 除去を適用し、parse_scope_rollup_run_result.py と一貫した文字列保持動作にする
- 上記変更後も、既存の _parse_iso8601 による timestamp 順序検証(generated_at が requested_at より後)や _compute_payload_sha256 の canonical JSON 化が引き続き正しく動作することを保証する
- scope-rollup-runner.md に、marker 内の全 ISO8601 timestamp フィールドを二重引用符で囲んだ文字列として出力することを明示する指示文を追加する
- scope-rollup-runner.md に、run_scope_rollup_preflight.py の stdout(特に result.payload)を要約・言い換え・再構成せず、フィールド単位でそのまま転記することを明示する指示文を追加する
- 上記4点の回帰を検証する新規 pytest ファイルを2つ追加する(既存テストファイルの変更は行わない)
Out of Scope
- agent_type_mismatch / hook_unavailable が特定の起動経路で頻発する根本原因調査(SubAgent 起動経路と SubagentStop hook 発火条件の不整合の可能性を含む)。これは production telemetry・起動経路の実地観測を要する調査であり、follow-up の調査 Issue に切り出す
- Codex 側の SubagentStop capture 復旧(Issue 実装: Codex の SubagentStop scope-rollup capture を復旧する #1527 が担当)
- scope_rollup.run exact executor の skill_runtime_exec sibling profile への統合(Issue 実装:scope_rollup.runをskill_runtime_execのsiblingexactprofileへ統合する #1601 が担当)
- marker schema・capture path・sidecar schema・duplicate/stale 判定ロジックそのものの変更(本 Issue は timestamp パース経路の防御的修正と agent 指示強化のみ)
Acceptance Criteria
- AC1: parse_scope_rollup_run_result.py の _load_yaml_no_duplicate_keys が、marker のトップレベル requested_at / generated_at にクォートなし ISO8601 timestamp が書かれていても、_validate_marker_payload が datetime 型に起因する例外を送出せず、正しい文字列比較で処理を継続する。
- AC2: parse_scope_rollup_run_result.py の _compute_payload_sha256 が、result.payload 配下にネストされたクォートなし timestamp 様フィールドを含む marker を渡されても TypeError を送出せず、status: rejected(reject_reason: result_sha_mismatch)で決定論的に fail-closed する。
- AC3: capture_scope_rollup_final_response.py の _extract_marker_payload / _decision_from_payload が、クォートなし ISO8601 timestamp を含む last_assistant_message を渡されても例外を送出せず、requested_at / generated_at を文字列として SCOPE_ROLLUP_CAPTURE_RESULT_V1 に記録する。
- AC4: scope-rollup-runner.md に、marker 内の全 ISO8601 timestamp フィールドを二重引用符で囲んだ文字列として出力することを明示する指示文が追加されている。
- AC5: scope-rollup-runner.md に、run_scope_rollup_preflight.py の stdout(特に result.payload)を要約・言い換え・再構成せずそのまま転記することを明示する指示文が追加されている。
Verification Commands
# AC1
# baseline-expect: fail
# preflight-scope: pr_review_only
$ uv run --locked python3 -m pytest .claude/skills/impl-review-loop/tests/test_parse_scope_rollup_timestamp_hardening.py::test_unquoted_top_level_timestamps_do_not_datetime_convert
# AC2
# baseline-expect: fail
# preflight-scope: pr_review_only
$ uv run --locked python3 -m pytest .claude/skills/impl-review-loop/tests/test_parse_scope_rollup_timestamp_hardening.py::test_unquoted_nested_payload_timestamp_rejects_without_raising
# AC3
# baseline-expect: fail
# preflight-scope: pr_review_only
$ uv run --locked python3 -m pytest .claude/hooks/tests/test_scope_rollup_capture_timestamp_hardening.py::test_unquoted_marker_timestamps_captured_as_strings
# AC4
# baseline-expect: fail
$ rg -c "二重引用符で囲んだ文字列として出力する" .claude/agents/scope-rollup-runner.md
# AC5
# baseline-expect: fail
$ rg -c "要約・言い換え・再構成せず" .claude/agents/scope-rollup-runner.mdAllowed Paths
- .claude/skills/impl-review-loop/scripts/parse_scope_rollup_run_result.py
- .claude/skills/impl-review-loop/tests/test_parse_scope_rollup_timestamp_hardening.py
- .claude/hooks/capture_scope_rollup_final_response.py
- .claude/hooks/tests/test_scope_rollup_capture_timestamp_hardening.py
- .claude/agents/scope-rollup-runner.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python(PyYAML カスタム Loader / SafeLoader resolver 制御)
- pytest(回帰テスト設計)
- SubAgent プロンプト設計(agent definition の指示強化)
Required Design References
- docs/dev/hook-boundaries.md
- .claude/skills/impl-review-loop/steps/preparation.md
Scope Delta
N/A
Notes for Reviewer
- overlap preflight(check_issue_overlap.py)は decision: overlap_requires_comment(policy_class C1)を返した。matched_issues のうち大半(実装: edit-issue skill の controlled executor に Issue title mutation を追加する #1660 / 実装: worktree mutation guard を AI エージェント非依存の shared core へ移行する #1657 / feat(impl-review-loop): startup を capsule-first に強制し raw 初期調査を禁止する #1114 / 実装: concurrent work ledger で active worktree / dirty main / overlapping paths を loop 前に検出する #966 / 実装: model capability router で Haiku fallback の編集・成功判定スコープを制限する #962 / 実装: SubAgent result evidence gate で証跡なし成功報告を fail-closed にする #961 / 実装: human-interface-finalizer skill / SubAgent を導入し PR本文・Issue本文・公開コメント・人間向け docs を公開前 finalize する #351 / 実装: rate limit / API error 由来の停止を StopFailure hook でログ保存し resume playbook を整備する #225 / 実装: normal Stop による未完了 LOOP_STATE を一度だけ補正する Stop hook safety net を導入する #224 等)は .claude/hooks / .claude/hooks/tests を broad directory 単位で Allowed Paths に含めているだけの false positive であり、本 Issue が新設するテストファイル名とは無関係。実装: Codex の SubagentStop scope-rollup capture を復旧する #1527(Codex capture 復旧)と 実装:scope_rollup.runをskill_runtime_execのsiblingexactprofileへ統合する #1601(scope_rollup.run の skill_runtime_exec 統合)は scope-rollup-runner.md に触れるが、両者とも「marker schema・capture path・sidecar schema・duplicate/stale 判定ロジックそのものの変更」は明示的に Out of Scope としており(実装: Codex の SubagentStop scope-rollup capture を復旧する #1527 の Stop Conditions に明記)、本 Issue(timestamp パース経路の防御的修正と agent 指示追記のみ)とは編集意図が異なるため non-conflict と判断した。並行 OPEN のまま進める場合はマージ順序の調整が必要になる可能性がある。
- 本 Issue は Issue 実装: worktree mutation guard を AI エージェント非依存の shared core へ移行する #1657 の impl-review-loop 実行中に観測された3種類の fail-closed 反復(datetime TypeError・SubAgent 要約による parser_rejected・agent_type_mismatch と hook_unavailable の蓄積)のうち、決定論的に修正可能な前半2種類(datetime 誤変換・非 verbatim 転記)のみを対象にする。3種類目(agent_type_mismatch / hook_unavailable の頻発根本原因)は production 起動経路の実地観測が必要な調査事項であり、本 Issue の AC には含めていない。
Metadata
Metadata
Assignees
Labels
phase/implementationImplementation phase
Activity