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: none
goal_ref: "#1171 の impl-review-loop を止めている agent-run-report check family の false-red / false-green baseline blocker を解消し、docs-only issue の contract snapshot materialization を unrelated test failure で妨げない"
change_kind: workflowParent Issue
none
Parent Goal Ref
- Goal: 実装: M2 playable-roadmap の close_conditions を sortie.md の正本定義と整合させる #1171 の docs-only 実装前 gate を、Allowed Paths 外の unrelated baseline failure で止まらない状態に戻す
- Desired Destination:
scripts/check-agent-run-reports.mjsと agent-run-report check tests の no-files / no-target failure semantics が deterministic になり、contract snapshot materialization が unrelated timeout で blocked しない状態
Current Validated Scope
tests/agent-run-report-check-command.test.tsのCI=true + --require-targetcase で、実際に default pattern override を no-match にした no-files path を検証するtests/agent-run-report-test-helpers.tsに child process timeout と timeout/signal/stdout/stderr の観測可能な戻り値を追加し、Vitest timeout への丸投げをやめるscripts/check-agent-run-reports.mjsに test-only の default pattern override を追加し、override 未指定時の production default patterns は維持する- explicit target no-match / unknown option / outside repo fail-closed semantics を壊さずに、CI/non-CI の default target 分岐を deterministic test で固定する
- full
pnpm testは実行するが、Allowed Paths 外の pre-existing failure が残る場合は 実装: agent-run-report check の no-target CI timeout baseline blocker を解消する #1246 で握りつぶさず stop condition に従って分離する
Remaining Parent Gaps
- 実装: VC failure adjudicator を追加し pre-existing / out-of-scope 判定を構造化する #1115 のような pre-existing / out-of-scope adjudication artifact 化は別 concern として残る
- 実装: M2 playable-roadmap の close_conditions を sortie.md の正本定義と整合させる #1171 自体の docs 修正は本 Issue 完了後に impl-review-loop を再開して扱う
Outcome
agent-run-report check family において、default target no-files path と explicit target no-match path が helper timeout に依存せず deterministic に観測でき、CI=true + --require-target の no-files case が agent-run-report:check: no files found を返して短時間で exit 1 になり、#1171 の contract snapshot materialization が本 family 内の baseline blocker で不必要に停止しない状態。
In Scope
- agent-run-report check family の no-files / no-target failure path の再現と修正
--require-target/CI=true/ default target fallback の semantics を deterministic test で固定- helper timeout 観測と stderr assertion の追加
scripts/check-agent-run-reports.mjs内に閉じた test-only default pattern override の追加- focused test と standard gates の更新
Out of Scope
docs/product/playable-roadmap.mdなど 実装: M2 playable-roadmap の close_conditions を sortie.md の正本定義と整合させる #1171 の docs 変更scripts/lib/agent-run-report-validation.mjsの redesign や schema 変更- impl-review-loop の pre-existing / out-of-scope adjudication artifact 追加
- unrelated test suite の timeout 一般対策
- Allowed Paths 外の hooks / runtime / package manager failure の直接修正
Acceptance Criteria
- AC1:
runAgentRunReportCheckが child process timeout を持ち、timeout / signal / stdout / stderr を deterministic に返せる - AC2:
scripts/check-agent-run-reports.mjsが test-only default pattern override を持ち、override 未指定時は既存getDefaultCheckPatterns()を維持する - AC3:
CI=trueかつ--require-targetかつ default pattern override が 0 files の場合、timeout せずagent-run-report:check: no files foundを stderr に出して exit 1 する - AC4: explicit target が 0 files の場合、timeout せず
agent-run-report:check: no files foundを stderr に出して exit 1 する - AC5: default pattern override が 0 files かつ
CI=falseかつ--require-targetなしの場合、skip message を出して exit 0 する - AC6: unknown option exit 2 と outside repo fail-closed の既存 semantics を維持する
- AC7: helper / script / test 変更は Allowed Paths 内に閉じている
- AC8:
pnpm test tests/agent-run-report-check-command.test.tsが PASS する - AC9:
pnpm typecheck、pnpm lint、pnpm buildが PASS する - AC10: full
pnpm testを実行し、Allowed Paths 外の pre-existing failure が再現する場合は 実装: agent-run-report check の no-target CI timeout baseline blocker を解消する #1246 では修正せず、out-of-scope baseline failure として stop condition に従って分離する
Verification Commands
# AC1
$ rg -n -F -- "timeout:" tests/agent-run-report-test-helpers.ts
# AC2
$ rg -n -F -- "AGENT_RUN_REPORT_CHECK_DEFAULT_PATTERNS" scripts/check-agent-run-reports.mjs
# AC3
$ rg -n -F -- "GIVEN default target override that matches 0 files in CI WHEN check command is run THEN exits 1 with no-files stderr" tests/agent-run-report-check-command.test.ts
# AC4
$ rg -n -F -- "GIVEN explicit target matching 0 files WHEN check command is run THEN exits 1 with no-files stderr" tests/agent-run-report-check-command.test.ts
# AC5
$ rg -n -F -- "GIVEN default target override matching 0 files outside CI WHEN check command is run THEN exits 0 with skip message" tests/agent-run-report-check-command.test.ts
# AC6
# baseline-expect: pass
$ rg -n -F -- "GIVEN unknown option WHEN check command is run THEN exits 2" tests/agent-run-report-check-command.test.ts
# baseline-expect: pass
$ rg -n -F -- "GIVEN repo-outside absolute target WHEN check command is run THEN exits 1 fail-closed" tests/agent-run-report-check-command.test.ts
# AC7
# preflight-scope: pr_review_only
$ git diff --name-only -- scripts/check-agent-run-reports.mjs tests/agent-run-report-check-command.test.ts tests/agent-run-report-test-helpers.ts
# AC8
# preflight-scope: pr_review_only
$ pnpm test tests/agent-run-report-check-command.test.ts
# AC9
# preflight-scope: pr_review_only
$ pnpm typecheck
$ pnpm lint
$ pnpm build
# AC10
# preflight-scope: pr_review_only
$ pnpm testAllowed Paths
- scripts/check-agent-run-reports.mjs
- tests/agent-run-report-check-command.test.ts
- tests/agent-run-report-test-helpers.ts
Runtime Verification Applicability
decision: not_applicable
reason: agent-run-report check family の script/test baseline repair であり、runtime UI/E2E 挙動の動作検証は不要。unit/integration テストと static gates で十分。
applicable_acs: []
evidence: []Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- timeout 原因が agent-run-report family 外の runtime / package manager / host 環境不安定性だと判明した場合
pnpm testでtests/hooks/hooks-stdout-policy.test.tsなど Allowed Paths 外の pre-existing failure が再現し、実装: agent-run-report check の no-target CI timeout baseline blocker を解消する #1246 単体では解消できないと判明した場合
Required Skills
- Node.js
- Vitest
Scope Delta(任意)
N/A
Root Cause
現行の no-target CI test は「default target override が 0 files」を名乗りながら、実際には --require-target を付けて default patterns をそのまま実行しているため、no-files path の検証になっていない。さらに helper は execFileSync を timeout 未設定で使っており、child process の停滞を helper 側の deterministic failure ではなく Vitest timeout に委ねている。この 2 点が合わさり、false-green / false-red の両方を起こしうる baseline blocker になっている。
Implementation Approach
scripts/check-agent-run-reports.mjsに test-only の default pattern override を追加するtests/agent-run-report-test-helpers.tsで child process timeout と signal/stderr 観測を追加するtests/agent-run-report-check-command.test.tsで CI/non-CI の no-files semantics を explicit に検証する- full
pnpm testは実行するが、Allowed Paths 外 failure が残る場合は 実装: agent-run-report check の no-target CI timeout baseline blocker を解消する #1246 で意味論を捻じ曲げず別 concern として分離する
Delivery Rule
- 1 Issue = 1 PR
- worktree:
.claude/worktrees/issue-<N>-agent-run-report-no-target-timeout - branch:
worktree-issue-<N>-agent-run-report-no-target-timeout - Draft PR 既定
- PR 本文に
Refs #1171を記載し、実装: M2 playable-roadmap の close_conditions を sortie.md の正本定義と整合させる #1171 の contract snapshot materialization blocker repair であることを明示する
Notes for Reviewer
- 観測された blocker は
ensure_contract_snapshot.py --issue-number 1171 --repo squne121/loop-protocol --mode auto --postのCONTRACT_SNAPSHOT_ENSURE_RESULT_V1.status=blocked_needs_refinementとして表面化したもの - owner comment
https://github.com/squne121/loop-protocol/issues/1246#issuecomment-4842569672を一次ソースとして、default target overrideの名実不一致、helper timeout 未設定、fullpnpm testの scope mismatch を本文へ反映した #1170参照は current repo reality と一致しないため削除した#1115は pre-existing / out-of-scope adjudication の構造化 issue であり、本 Issue の baseline repair とは Outcome が異なる
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jun 30, 2026
#1171 の impl-review-loop を実際に止めている baseline blocker として起票しました。
観測点:
RUN v4.1.6 /home/squne/projects/LOOP_PROTOCOL
❯ tests/hooks/hooks-stdout-policy.test.ts (26 tests | 1 failed) 10083ms
× spawns test-codex-single-composite.mjs and all assertions pass 7625ms
❯ tests/agent-run-report-check-command.test.ts (5 tests | 1 failed) 10413ms
× GIVEN default target override that matches 0 files in CI WHEN check command is run THEN exits 1 9062ms
Test Files 2 failed | 80 passed (82)
Tests 2 failed | 1204 passed (1206)
Start at 19:39:55
Duration 15.80s (transform 35.44s, setup 0ms, import 56.17s, tests 171.07s, environment 11.95s)
[ELIFECYCLE] Test failed. See above for more details.
期待する handoff:
Refs #1171
squne121 commentedon Jun 30, 2026
#1171 の impl-review-loop を実際に止めている baseline blocker として起票しました。
観測点:
ensure_contract_snapshot.py --issue-number 1171 --repo squne121/loop-protocol --mode auto --postCONTRACT_SNAPSHOT_ENSURE_RESULT_V1.status=blocked_needs_refinementpnpm testtests/agent-run-report-check-command.test.tsのCI=true + --require-targetno-target case timeout期待する handoff:
Refs #1171
squne121 commentedon Jun 30, 2026
判定
REQUEST CHANGES。 #1246 の方向性は正しいですが、このまま実装に渡すと「no-target timeout を直したつもりでも
pnpm testbaseline がまだ赤い」「本当に no-files path を検証していない」状態で false-green / false-red を再発させます。#1246 は #1171 の docs-only issue を、Allowed Paths 外の baseline failure で止めないための workflow repair です。#1171 自体は
docs/product/playable-roadmap.mdのみを変更する docs-only contract で、にもかかわらずpnpm testを AC に含むため、今回の blocker 解消は妥当です。P0:
pnpm testAC4 が現状の Allowed Paths では満たせない可能性がある#1246 コメントの観測ログでは、
tests/agent-run-report-check-command.test.tsだけでなく、tests/hooks/hooks-stdout-policy.test.tsのspawns test-codex-single-composite.mjs and all assertions passも失敗しています。後続コメントでは agent-run-report 側だけに整理されていますが、最初の実ログにある hooks failure を無視すると、#1246 の AC4「current main でpnpm testPASS」は再び失敗します。しかも #1246 の Allowed Paths は
scripts/check-agent-run-reports.mjs、tests/agent-run-report-check-command.test.ts、tests/agent-run-report-test-helpers.tsの 3 ファイルだけです。hooks 側の failing test は明確にスコープ外です。 hooks 側の該当テストはtests/hooks/hooks-stdout-policy.test.tsからtest-codex-single-composite.mjsを spawn して status 0 を期待しており、#1246 の Allowed Paths では修正できません。修正提案: AC4 は次のどちらかに変更すべきです。
pnpm test tests/agent-run-report-check-command.test.tsPASS を 実装: agent-run-report check の no-target CI timeout baseline blocker を解消する #1246 の必須 AC にし、fullpnpm testは「out-of-scope baseline failure が残っていない場合のみ確認」に落とす。pnpm testAC を残すが、tests/hooks/hooks-stdout-policy.test.tsがまだ落ちる場合は停止条件に入り、別 Issue を起票する、と明記する。#1115 は pre-existing / out-of-scope VC 判定 artifact を追加する別 Issue であり、#1246 の中で散文判断により hooks failure を non-blocking 扱いするのは危険です。
P0: 問題のテストは「default target override が 0 files」を実際には作っていない
現在の failing test は
runAgentRunReportCheck(['--require-target'], { CI: 'true' })だけを実行しています。つまり、default target を 0 件にする override が存在しません。一方、script 側は explicit target がない場合
getDefaultCheckPatterns()を使います。--require-targetは no-files 時の exit semantics を変えるだけで、default pattern を 0 件にするものではありません。 default patterns にはtests/fixtures/agent-run-report/*.{json,md}やtests/fixtures/agent-retro-index/*.{json,md}が含まれているため、通常は実 fixture を拾って検証します。つまり現在のテスト名と実体がズレています。CI で timeout しているのは「0 files path が遅い」のではなく、「default fixture validation を起動してしまい、Ajv import / schema validation / fixture scan まで走って Vitest の timeout に当たっている」可能性が高いです。
修正提案: #1246 の contract に、default patterns をテスト用に差し替える明示的な仕組みを入れるべきです。ただし
scripts/lib/agent-run-report-validation.mjsは Allowed Paths 外なので、変更するならscripts/check-agent-run-reports.mjs内で wrapper を作るのが安全です。例:
その上で、テストは
CI=true + --require-target + AGENT_RUN_REPORT_CHECK_DEFAULT_PATTERNS=<repo内no-match glob>を使って、本当にfiles.length === 0の path を踏ませるべきです。P0: helper の
execFileSyncが timeout 未設定で、Vitest timeout に丸投げしているrunAgentRunReportCheckはexecFileSyncを使っていますが、timeout を指定していません。 Node のexecFileSync/ 同期 child_process 系 API は child process が終了するまで event loop をブロックし、timeoutのデフォルトはundefinedです。([Node.js]1)Vitest の
test/itは timeout を指定でき、デフォルト timeout は 5000ms です。([Vitest]2) つまり現状は「child process を早期に deterministic failure へ変換する」設計ではなく、「Vitest の外側 timeout で突然落ちる」設計です。これは #1246 の Outcome と逆です。修正提案:
execFileSyncにtimeoutを指定するか、spawnSyncに移行してstatus/signal/error/stdout/stderrを返すべきです。no-files path は 1〜3 秒以内に終わるべきなので、helper 側 timeout は Vitest の 5000ms より短くして、timeout 時もtimedOut: trueのように観測可能にするのが良いです。P1: exit code だけでは failure semantics を固定できない
現在の CI no-target test は
exitCode === 1しか見ていません。 これでは、次のどれでも pass します。agent-run-report:check: no files foundで exit 1schema.invalidで exit 1exitCode: 1に丸めた#1246 の目的は no-files path の deterministic semantics 固定なので、最低限
stderrにagent-run-report:check: no files foundが含まれること、fixture validation のPASS/FAIL <fixture>出力が出ていないこと、timeout していないことを検証すべきです。P1: #1170 参照が誤っている可能性が高い
#1246 の Notes には「#1170 では同 family の artifact-pattern pollution を修正済み」とありますが、#1170 の実体は
docs/product/features/upgrade.mdを新規作成する M4 Upgrade Loop spec issue で、agent-run-report check family ではありません。 関連 PR #1237 も upgrade loop spec の docs PR です。修正提案: #1246 の Notes から #1170 参照を削除するか、正しい Issue / PR 番号へ差し替えるべきです。誤参照のままだと、実装者が過去修正の差分確認で無駄に迷います。
P1:
CI環境変数の継承をテストで制御していないhelper は
{ ...process.env, ...env }で環境変数を引き継ぎます。 そのため、CI 上で動くテストは明示しない限りCI=trueを継承します。#1246 の AC2 は「default target かつ非 CI のとき skip exit 0」を維持すると書いているので、非 CI path の regression test を追加するならCI: 'false'を明示する必要があります。P2:
fsPromises.globの使い方は現行 Node では許容範囲だが、テスト分離を優先すべきNode 24 系では
fsPromises.globは stable 扱いで、pattern は string / string[]、cwdoption も提供されています。([Node.js]3) 現在の script は pattern をresolve(REPO_ROOT, pattern)で絶対化してfsGlob(absPattern)に渡しています。 これは即座に P0 ではありません。ただし no-target semantics を固定したいなら、実 fixture / artifacts を拾う default patterns と切り離すことが最優先です。glob 実装のリファクタリングに寄せすぎると #1246 の「最小範囲」から逸れます。
推奨する Issue #1246 の修正版 AC
現行 AC を次のように差し替えるのが安全です。
推奨 Verification Commands
Codex CLI / Claude Code へ渡す実行プロンプト
追加確認できていない点
このレビューは GitHub connector 上の Issue / PR / repository file と公式ドキュメント照合に基づくものです。ローカルで
pnpm testは再実行していません。現時点で最も重要なのは、#1246 実装前に hooks 側 failure が現在 main でまだ再現するか を確認し、再現するなら #1246 の AC4 をそのまま維持しないことです。squne121 commentedon Jun 30, 2026
issue-refinement-loop により本文を更新しました。
#issuecomment-4842569672を反映しましたdefault target overrideの名実不一致、helper timeout 未設定、fullpnpm testの scope mismatch を contract に取り込みましたscripts/check-agent-run-reports.mjsの test-only default pattern override、helper timeout 観測、CI/non-CI no-files semantics の固定を Current Validated Scope / AC / Root Cause / Implementation Approach に反映しました#1170参照は current repo reality と一致しないため削除しました検証結果:
guard-issue-body.py: passcontract_readiness_check.py --mode static:status=gocheck_issue_contract.py:REVIEW_ISSUE_RESULT_V1.verdict=approveこの issue は implementation contract として live writeback 済みです。
squne121 commentedon Jun 30, 2026
Contract Review Result
squne121 commentedon Jun 30, 2026
impl-review-loop: 完了 (2026-06-30T11:21:20Z)
fix: stabilize agent-run-report no-files checks (#1246) (#1248)