From 3ee8feaa329bb83d4b71a5946085138fd6fda9f2 Mon Sep 17 00:00:00 2001 From: "hiraoku.shinichi" Date: Sat, 4 Jul 2026 16:50:02 +0900 Subject: [PATCH] Label PR body evidence strength --- docs/04-nightly-pipeline.md | 3 ++- src/orchestrator/run.ts | 13 +++++++++++++ test/integration/dry-run.test.ts | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/04-nightly-pipeline.md b/docs/04-nightly-pipeline.md index 2039eb0..44e9803 100644 --- a/docs/04-nightly-pipeline.md +++ b/docs/04-nightly-pipeline.md @@ -227,7 +227,8 @@ gh pr create --base --head kaizen/issue-- \ codex exec --cd "... skills/pr-guardian/SKILL.md ..." ``` -- PR 本文: 修正サマリ、対象 Issue へのリンク(`Closes #N`)、変更概要、検証結果、verifier 有効時の `verifier: open_pr` / `verifier: open_pr_with_warning`、リスク判定または並列実行で PR になった理由 +- PR 本文: 修正サマリ、対象 Issue へのリンク(`Closes #N`)、変更概要、検証結果、verifier 有効時の `verifier: open_pr` / `verifier: open_pr_with_warning`、証拠強度(`reported` / `executed` / `unverified` / `static`)、リスク判定または並列実行で PR になった理由 +- 証拠強度では、builder-agent の自己申告は `reported`、Kaizen Loop が実行した verify / verifier は `executed`、未設定の verify / verifier は `unverified`、git diff 由来の変更ファイル・行数は `static` として表示する - PR 作成直後、Kaizen Loop は Issue に PR リンクと「monitoring CI and review feedback」をコメントする - `guardian.mode: sync` では、Kaizen Loop は vendored `skills/pr-guardian/SKILL.md` を設定済みの `guardian.command` で実行する。CI 監視、`gh run watch`、未解決の actionable review feedback 対応、mergeable 判定は `pr-guardian` skill の責務。TypeScript 側は各 pass 後に未解決・非 outdated の review thread を確認し、残っていれば `guardian.maxAttempts` まで再実行する。approval 不足は branch protection が明示要求している場合だけ blocker として扱う - `guardian.mode: async` では、PR 作成後に `~/.kaizen/projects//guardian/jobs/` へ job を保存して foreground run を終了する。job は repo、PR 番号、URL、branch、base branch、head SHA、retry budget、attempt count、status、last checked time、last blocker を持つ。`kaizen guardian watch` が pending job を再開し、`kaizen guardian run ` は head SHA が変わっていれば新しい job として実行する diff --git a/src/orchestrator/run.ts b/src/orchestrator/run.ts index 19dd780..6dfe7c0 100644 --- a/src/orchestrator/run.ts +++ b/src/orchestrator/run.ts @@ -1072,6 +1072,16 @@ function buildPullRequestBody( : '- Verification commands are not configured'; const notes = agentResult.notes.trim() ? `\n## Builder notes\n${agentResult.notes.trim()}\n` : ''; const verifier = verifierResult ? `\n## Verifier\nverifier: ${verifierResult.status}\nsummary: ${verifierResult.summary || '(none)'}${verifierResult.reason ? `\nreason: ${verifierResult.reason}` : ''}${verifierResult.notes.trim() ? `\nnotes: ${verifierResult.notes.trim()}` : ''}\n` : ''; + const evidence = [ + '- reported: builder summary and builder notes come from the builder-agent self-report.', + verifyResults.length > 0 + ? '- executed: Kaizen Loop ran the verification commands listed above.' + : '- unverified: no repository verification commands are configured.', + verifierResult + ? '- executed: Kaizen Loop ran verifier and recorded the status below.' + : '- unverified: verifier was not run for this PR body.', + '- static: changed file and line counts come from git diff metadata.' + ].join('\n'); return `Closes #${issue.number} ## Summary @@ -1082,6 +1092,9 @@ ${notes} ${verify} ${verifier} +## Evidence strength +${evidence} + ## Kaizen risk policy ${riskReason} diff --git a/test/integration/dry-run.test.ts b/test/integration/dry-run.test.ts index ea52e4c..45b5077 100644 --- a/test/integration/dry-run.test.ts +++ b/test/integration/dry-run.test.ts @@ -1800,6 +1800,11 @@ describe('runKaizen PR flow', () => { expect(prBodies[0]).toContain('## Verifier'); expect(prBodies[0]).toContain('verifier: open_pr'); expect(prBodies[0]).toContain('summary: 確認した'); + expect(prBodies[0]).toContain('## Evidence strength'); + expect(prBodies[0]).toContain('reported: builder summary and builder notes come from the builder-agent self-report'); + expect(prBodies[0]).toContain('executed: Kaizen Loop ran the verification commands listed above'); + expect(prBodies[0]).toContain('executed: Kaizen Loop ran verifier and recorded the status below'); + expect(prBodies[0]).toContain('static: changed file and line counts come from git diff metadata'); }); it('surfaces open_pr_with_warning verifier status in generated PR bodies', async () => { @@ -1873,6 +1878,10 @@ describe('runKaizen PR flow', () => { expect(prBody).toContain('summary: 確認したが注意あり'); expect(prBody).toContain('reason: low confidence'); expect(prBody).toContain('notes: human should double-check docs'); + expect(prBody).toContain('## Evidence strength'); + expect(prBody).toContain('reported: builder summary and builder notes come from the builder-agent self-report'); + expect(prBody).toContain('executed: Kaizen Loop ran the verification commands listed above'); + expect(prBody).toContain('executed: Kaizen Loop ran verifier and recorded the status below'); }); it('accepts legacy approved verifier payloads as open_pr', async () => {