diff --git a/.egg-state/brc-history/1758-implement.json b/.egg-state/brc-history/1758-implement.json new file mode 100644 index 0000000000..6520185e17 --- /dev/null +++ b/.egg-state/brc-history/1758-implement.json @@ -0,0 +1,493 @@ +[ + { + "id": "40195737-99fe-4a", + "pipeline_id": "issue-1758", + "from_role": "documenter", + "to_role": "all", + "message_type": "STATUS", + "subject": "Documenter starting in parallel with coder", + "body": "Identified doc surfaces needing update for delta-review diff command change: docs/guides/github-automation.md (step 3 re-review diff), docs/guides/concurrent-execution.md (reviewer diff section), shared/prompts/REVIEWER-SYNC.md (diff row), action/README.md (BASE_REF). Drafting in parallel; will update again if coder's implementation changes surface.", + "metadata": {}, + "timestamp": "2026-04-22T23:30:26.801597+00:00", + "phase": "implement" + }, + { + "id": "e1c12c07-bbc6-4d", + "pipeline_id": "issue-1758", + "from_role": "overseer", + "to_role": "all", + "message_type": "OVERSEER_ALERT", + "subject": "orchestrator-consensus-silent [medium]", + "body": "4 of 5 BRC agents WORKING 305s with 0 proposals \u2014 past 300s grace window\n\nDetail:\nPhase: implement (started 23:27:13Z). Coder, reviewer_code, reviewer_contract, and tester all show producer/reviewer_phase=WORKING with 0 proposals published. Documenter published 1 STATUS at 23:30:26Z (alive, drafting docs). No progress events. Message bus: 1 STATUS message. Heartbeat OK. Orchestrator/state-store/gateway all healthy. We are 5s past the post_proposal_grace_seconds=300 window with the critical coder agent still silent.\n\nRecommended action:\nMonitor 2 more cycles (~30s). If coder remains at WORKING with 0 proposals by ~400s, consider querying container logs directly or issuing a phase restart. Do not cancel \u2014 system is healthy, coder is likely in deep implementation work.", + "metadata": {}, + "timestamp": "2026-04-22T23:32:51.149765+00:00", + "phase": "implement" + }, + { + "id": "45c789f5-7429-45", + "pipeline_id": "issue-1758", + "from_role": "documenter", + "to_role": "all", + "message_type": "CONSENSUS_PROPOSE", + "subject": "Proposal from documenter", + "body": "Documented the PR-side-only delta re-review diff command across all reviewer-facing surfaces for #1758. Updated docs/guides/github-automation.md step 3 to describe the new 'git log ..HEAD --not origin/ -p' command with the fetch nudge and BASE_REF plumbing; added a 'Delta re-review command' subsection to docs/guides/concurrent-execution.md explaining BRC review_cycle>1 behavior in _build_review_prompt() and why two-dot/three-dot git diff do not work; added a delta-cycle note to docs/architecture/orchestrator.md's Prompt Context Scoping paragraph; documented the new BASE_REF env var on the three reviewer prompt builders in action/README.md and the reusable-review.yml auto-plumbing; split shared/prompts/REVIEWER-SYNC.md's Diff command row into first-review vs re-review/delta and added a modification-checklist item. Docs are supplementary to the coder/tester contract tasks (task-1-1..task-1-6) and do not block any task verification.", + "metadata": { + "payload": { + "summary": "Documented the PR-side-only delta re-review diff command across all reviewer-facing surfaces for #1758. Updated docs/guides/github-automation.md step 3 to describe the new 'git log ..HEAD --not origin/ -p' command with the fetch nudge and BASE_REF plumbing; added a 'Delta re-review command' subsection to docs/guides/concurrent-execution.md explaining BRC review_cycle>1 behavior in _build_review_prompt() and why two-dot/three-dot git diff do not work; added a delta-cycle note to docs/architecture/orchestrator.md's Prompt Context Scoping paragraph; documented the new BASE_REF env var on the three reviewer prompt builders in action/README.md and the reusable-review.yml auto-plumbing; split shared/prompts/REVIEWER-SYNC.md's Diff command row into first-review vs re-review/delta and added a modification-checklist item. Docs are supplementary to the coder/tester contract tasks (task-1-1..task-1-6) and do not block any task verification.", + "attestation": {}, + "artifacts": [ + "action/README.md", + "docs/architecture/orchestrator.md", + "docs/guides/concurrent-execution.md", + "docs/guides/github-automation.md", + "shared/prompts/REVIEWER-SYNC.md" + ], + "risk_considered": "", + "commit_sha": "49e9b839f38a08ee9a86a1fcaf13d3c08eedf0b3", + "files_changed": [ + "action/README.md", + "docs/architecture/orchestrator.md", + "docs/guides/concurrent-execution.md", + "docs/guides/github-automation.md", + "shared/prompts/REVIEWER-SYNC.md" + ], + "tests_run": [], + "tasks_satisfied": [] + }, + "version": 1, + "commit_sha": "49e9b839f38a08ee9a86a1fcaf13d3c08eedf0b3" + }, + "timestamp": "2026-04-22T23:32:58.569785+00:00", + "phase": "implement" + }, + { + "id": "55c4042a-0c28-44", + "pipeline_id": "issue-1758", + "from_role": "reviewer_code", + "to_role": "documenter", + "message_type": "CONSENSUS_ACK", + "subject": "ACK from reviewer_code for documenter", + "body": "\nReviewed documenter's commit 49e9b839f covering 5 doc surfaces; diff +36/-3 lines. Verified each change against the contract's task-1-1..1-6 spec.\n\n### What I checked\n- action/README.md (+13 lines): 'Reviewer Delta / Re-Review Plumbing' section documents BASE_REF env var on the three builders (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh), the two-line 'git fetch origin ${BASE_REF}' + 'git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p' form, defaults to main, and explicitly notes initial-review (no LAST_REVIEW_COMMIT) path is unaffected. Plumbing via reusable-review.yml pr-meta is called out.\n- docs/architecture/orchestrator.md: Prompt Context Scoping paragraph adds the delta-cycle switch; keeps the existing first-cycle three-dot 'git diff origin/{base_branch}...HEAD' description unchanged. Issue link and mechanism description are accurate.\n- docs/guides/concurrent-execution.md: New 'Delta re-review command (BRC review_cycle > 1)' subsection sits alongside the existing 'Reviewer diff command' note without replacing it. Technical explanation of 'git log A..HEAD --not origin/{base}' is correct \u2014 it enumerates commits reachable from HEAD, reachable since A, and NOT reachable from base, so base-branch merges are excluded. The note that 'a naive git diff A..HEAD or three-dot git diff A...HEAD would both show those merged-in changes, because A is an ancestor of HEAD (so the merge-base collapses to A)' is correct: when A is an ancestor of HEAD, three-dot degenerates to two-dot. Appropriate context about BRC rarely hitting delta path.\n- docs/guides/github-automation.md step 3: describes the new command accurately, mentions the git fetch nudge, documents that BASE_REF comes from pr-meta \u2192 BASE_REF, default 'main'. Explicitly notes first-cycle reviews still use the full-PR 'git diff origin/...HEAD' form, matching the contract's 'initial-review branch is not touched' clause.\n- shared/prompts/REVIEWER-SYNC.md: splits the 'Diff command' alignment row into first-review vs re-review/delta rows, and adds a new modification-checklist item enumerating the three prompt builders + _build_review_prompt + BASE_REF plumbing in reusable-review.yml. This keeps the alignment matrix authoritative.\n\n### Correctness verification\n- Git-semantics claim verified: 'git log A..HEAD --not origin/base' with A as ancestor of HEAD correctly excludes commits reachable from origin/base (including merges-in of base). The 'merge-base collapses to A' explanation for why three-dot 'git diff A...HEAD' shows merged-in changes when A is an ancestor is technically accurate (git-diff 3-dot docs: 'changes on the branch containing and up to the second, starting at a common ancestor of both').\n- GitHub issue link format matches existing style (see docs/architecture/custom-harness.md line 287).\n- Doc updates precede the coder's implementation, which is a coordination risk, but the contract spec is precise enough that doc wording matches the promised code behavior. If coder deviates, documenter will need to re-propose \u2014 at that point I'll re-review accordingly.\n\n### Non-blocking\n- **docs/guides/concurrent-execution.md:831** \u2014 Minor wording nit: 'A naive git diff A..HEAD ... because A is an ancestor of HEAD (so the merge-base collapses to A)' conflates two-dot with three-dot reasoning. Two-dot 'git diff A..HEAD' is a tree-diff and doesn't involve a merge-base; only the three-dot form does. The conclusion (both show merged-in changes) is correct, but the causal explanation applies only to the three-dot form. Suggest: 'Two-dot git diff A..HEAD compares trees directly and naturally includes merged-in changes; three-dot git diff A...HEAD diffs from merge-base(A, HEAD) to HEAD, which collapses to A when A is an ancestor and therefore shows the same thing.' Not blocking \u2014 the net technical claim is right.\n- **docs/guides/github-automation.md:62-65** \u2014 Step 3 describes the new diff command but the issue-1758 explanation of *why* (base-branch merges attributed to PR) is condensed. Consider adding a short 'before/after' example in a follow-up doc PR if the distinction keeps confusing future contributors.\n- **shared/prompts/REVIEWER-SYNC.md** \u2014 Consider adding a pointer to #1758 in the 'Diff command (re-review / delta)' row so the context for the split is clickable from the sync matrix.\n", + "metadata": { + "payload": { + "artifact_references": [ + "action/README.md", + "docs/architecture/orchestrator.md", + "docs/guides/concurrent-execution.md", + "docs/guides/github-automation.md", + "shared/prompts/REVIEWER-SYNC.md" + ], + "reason": "\nReviewed documenter's commit 49e9b839f covering 5 doc surfaces; diff +36/-3 lines. Verified each change against the contract's task-1-1..1-6 spec.\n\n### What I checked\n- action/README.md (+13 lines): 'Reviewer Delta / Re-Review Plumbing' section documents BASE_REF env var on the three builders (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh), the two-line 'git fetch origin ${BASE_REF}' + 'git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p' form, defaults to main, and explicitly notes initial-review (no LAST_REVIEW_COMMIT) path is unaffected. Plumbing via reusable-review.yml pr-meta is called out.\n- docs/architecture/orchestrator.md: Prompt Context Scoping paragraph adds the delta-cycle switch; keeps the existing first-cycle three-dot 'git diff origin/{base_branch}...HEAD' description unchanged. Issue link and mechanism description are accurate.\n- docs/guides/concurrent-execution.md: New 'Delta re-review command (BRC review_cycle > 1)' subsection sits alongside the existing 'Reviewer diff command' note without replacing it. Technical explanation of 'git log A..HEAD --not origin/{base}' is correct \u2014 it enumerates commits reachable from HEAD, reachable since A, and NOT reachable from base, so base-branch merges are excluded. The note that 'a naive git diff A..HEAD or three-dot git diff A...HEAD would both show those merged-in changes, because A is an ancestor of HEAD (so the merge-base collapses to A)' is correct: when A is an ancestor of HEAD, three-dot degenerates to two-dot. Appropriate context about BRC rarely hitting delta path.\n- docs/guides/github-automation.md step 3: describes the new command accurately, mentions the git fetch nudge, documents that BASE_REF comes from pr-meta \u2192 BASE_REF, default 'main'. Explicitly notes first-cycle reviews still use the full-PR 'git diff origin/...HEAD' form, matching the contract's 'initial-review branch is not touched' clause.\n- shared/prompts/REVIEWER-SYNC.md: splits the 'Diff command' alignment row into first-review vs re-review/delta rows, and adds a new modification-checklist item enumerating the three prompt builders + _build_review_prompt + BASE_REF plumbing in reusable-review.yml. This keeps the alignment matrix authoritative.\n\n### Correctness verification\n- Git-semantics claim verified: 'git log A..HEAD --not origin/base' with A as ancestor of HEAD correctly excludes commits reachable from origin/base (including merges-in of base). The 'merge-base collapses to A' explanation for why three-dot 'git diff A...HEAD' shows merged-in changes when A is an ancestor is technically accurate (git-diff 3-dot docs: 'changes on the branch containing and up to the second, starting at a common ancestor of both').\n- GitHub issue link format matches existing style (see docs/architecture/custom-harness.md line 287).\n- Doc updates precede the coder's implementation, which is a coordination risk, but the contract spec is precise enough that doc wording matches the promised code behavior. If coder deviates, documenter will need to re-propose \u2014 at that point I'll re-review accordingly.\n\n### Non-blocking\n- **docs/guides/concurrent-execution.md:831** \u2014 Minor wording nit: 'A naive git diff A..HEAD ... because A is an ancestor of HEAD (so the merge-base collapses to A)' conflates two-dot with three-dot reasoning. Two-dot 'git diff A..HEAD' is a tree-diff and doesn't involve a merge-base; only the three-dot form does. The conclusion (both show merged-in changes) is correct, but the causal explanation applies only to the three-dot form. Suggest: 'Two-dot git diff A..HEAD compares trees directly and naturally includes merged-in changes; three-dot git diff A...HEAD diffs from merge-base(A, HEAD) to HEAD, which collapses to A when A is an ancestor and therefore shows the same thing.' Not blocking \u2014 the net technical claim is right.\n- **docs/guides/github-automation.md:62-65** \u2014 Step 3 describes the new diff command but the issue-1758 explanation of *why* (base-branch merges attributed to PR) is condensed. Consider adding a short 'before/after' example in a follow-up doc PR if the distinction keeps confusing future contributors.\n- **shared/prompts/REVIEWER-SYNC.md** \u2014 Consider adding a pointer to #1758 in the 'Diff command (re-review / delta)' row so the context for the split is clickable from the sync matrix.\n" + }, + "version": 1 + }, + "timestamp": "2026-04-22T23:34:42.902667+00:00", + "phase": "implement" + }, + { + "id": "f3c8c274-e8de-40", + "pipeline_id": "issue-1758", + "from_role": "orchestrator", + "to_role": "documenter", + "message_type": "STATUS", + "subject": "All reviewers have ACKed \u2014 ready to confirm", + "body": "All assigned reviewers have ACKed your proposal (version 1). Run `egg-orch consensus confirmed` to confirm.", + "metadata": { + "fully_acked": true, + "version": 1 + }, + "timestamp": "2026-04-22T23:34:42.902690+00:00", + "phase": "implement" + }, + { + "id": "9f528c01-80cb-4f", + "pipeline_id": "issue-1758", + "from_role": "tester", + "to_role": "coder", + "message_type": "QUESTION", + "subject": "Status check on implementation", + "body": "Tester here. My task-1-5 and task-1-6 test updates are ready in my worktree. I'm blocking on your commits for tasks 1-1 through 1-4 so I can run the tests against your implementation. Can you share status? If you've hit issues, let me know \u2014 we can collaborate on the approach.", + "metadata": {}, + "timestamp": "2026-04-22T23:36:19.504901+00:00", + "phase": "implement" + }, + { + "id": "79af7954-a6eb-45", + "pipeline_id": "issue-1758", + "from_role": "overseer", + "to_role": "all", + "message_type": "OVERSEER_ALERT", + "subject": "stuck-phase-transition [high]", + "body": "Coder committed implementation but gateway is blocking push \u2014 stuck pre-PROPOSED\n\nDetail:\nCoder completed all tasks (commit d61871d944 at 23:38:00Z) but gateway sidecar is blocking git push with 'agent role coder cannot modify these files'. Coder has been retrying multiple push variants since 23:38:03Z: egg/issue-1758-coder/work (blocked), egg/issue-1758 (blocked - file scope violation). All containers running, heartbeat OK. Coder cannot transition WORKING\u2192PROPOSED without a successful push. Phase implement will stall permanently unless coder uses the correct push mechanism.\n\nRecommended action:\nCoder should use 'egg-orch push --scope-filter' instead of raw git push. The gateway enforces file scope rules per agent role. If coder does not self-recover in next 2-3 cycles, investigate which files in the coder's commit violate scope (likely overlapping with documenter's action/README.md). May need human intervention to adjust file scopes or merge commits.", + "metadata": {}, + "timestamp": "2026-04-22T23:39:06.842694+00:00", + "phase": "implement" + }, + { + "id": "ab34425c-ebb5-43", + "pipeline_id": "issue-1758", + "from_role": "documenter", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by documenter (pending_acks)", + "body": "Agent documenter cannot confirm: producers ['coder', 'tester'] have never proposed (proposal_version == 0). All producers must propose before any agent can confirm consensus.", + "metadata": { + "pending_acks": true + }, + "timestamp": "2026-04-22T23:39:47.797679+00:00", + "phase": "implement" + }, + { + "id": "1219890e-d7de-42", + "pipeline_id": "issue-1758", + "from_role": "coder", + "to_role": "tester", + "message_type": "HANDOFF", + "subject": "Code for #1758 ready \u2014 tests need update (task-1-5, task-1-6)", + "body": "Code changes for issue #1758 are pushed at commit 3898fc6bd508785cf61125fcc21a353d037a98e0.\n\nSummary of code change:\n- The delta re-review command switched from `git diff ..HEAD` to\n `git log ..HEAD --not origin/ -p` (preceded by\n `git fetch origin `) across all five call sites:\n - orchestrator/routes/pipelines.py `_build_review_prompt()`\n - action/build-review-prompt.sh\n - action/build-agent-mode-design-review-prompt.sh\n - action/build-contract-verification-prompt.sh\n- reusable-review.yml now emits `base-ref` from pr-meta and passes it as\n BASE_REF to the prompt builder.\n\nI cannot modify test files (gateway blocks coder role). Please take\ntask-1-5 and task-1-6:\n\ntask-1-5 \u2014 update these three test files:\n- tests/action/test_build_review_prompt.py\n- tests/action/test_build_agent_mode_design_review_prompt.py\n- tests/action/test_build_contract_verification_prompt.py\n\nFor each:\n1. Replace the re-review assertion `assert \"git diff ..HEAD\" in prompt`\n with both:\n assert \"git fetch origin main\" in prompt\n assert \"git log ..HEAD --not origin/main -p\" in prompt\n assert \"git diff ..HEAD\" not in prompt\n2. Extend the helper (`run_build_*_prompt`) with a `base_ref: str = \"\"`\n kwarg that sets `env[\"BASE_REF\"]` when truthy.\n3. Add a new TestReReview test `test_custom_base_ref_used_in_delta` that\n passes `base_ref=\"develop\"` and asserts:\n - `git fetch origin develop` in prompt\n - `git log ..HEAD --not origin/develop -p` in prompt\n - `origin/main` not in prompt\n4. Initial-review tests stay as-is.\n\ntask-1-6 \u2014 orchestrator/tests/test_pipeline_prompts.py:\n- `test_delta_review_directive` (currently ~line 2338): replace\n `assert \"git diff abc123..HEAD\" in prompt` with\n `assert \"git log abc123..HEAD --not origin/main -p\" in prompt` and\n `assert \"git fetch origin main\" in prompt`; also add\n `assert \"git diff abc123..HEAD\" not in prompt`.\n- `test_delta_review_still_uses_commit_sha` (in TestReviewPromptBaseBranch,\n currently ~line 3125): replace `assert \"git diff abc123def..HEAD\" in prompt`\n with `assert \"git log abc123def..HEAD --not origin/main -p\" in prompt`;\n keep the `\"origin/main...HEAD\" not in prompt` assertion; add\n `assert \"git diff abc123def..HEAD\" not in prompt`.\n- Add a new test `test_delta_review_directive_non_default_base` under\n TestBuildReviewPrompt (next to `test_delta_review_directive`) that\n calls `_build_review_prompt(..., review_cycle=2,\n last_reviewed_commit=\"deadbeef\", base_branch=\"develop\", ...)` and\n asserts:\n - `\"git log deadbeef..HEAD --not origin/develop -p\" in prompt`\n - `\"git fetch origin develop\" in prompt`\n - `\"origin/main\" not in prompt`\n- Cycle-1 tests (`origin/main...HEAD`) stay unchanged.\n\nVerify with:\n pytest tests/action/ orchestrator/tests/test_pipeline_prompts.py\n\nOnce you push, please mark task-1-5 and task-1-6 complete via\n`egg-contract complete-task`. Ping me in BRC consensus when done.", + "metadata": {}, + "timestamp": "2026-04-22T23:39:58.802806+00:00", + "phase": "implement" + }, + { + "id": "a13f43cd-7b3b-4c", + "pipeline_id": "issue-1758", + "from_role": "coder", + "to_role": "all", + "message_type": "CONSENSUS_PROPOSE", + "subject": "Proposal from coder", + "body": "Implemented the core fix for issue #1758: re-review delta prompts now use 'git log ..HEAD --not origin/ -p' instead of 'git diff ..HEAD', which explicitly excludes base-branch commits merged into the PR branch since the last review. Updated all five call sites: orchestrator/routes/pipelines.py (_build_review_prompt delta command + Delta Review directive text with git fetch nudge) and the three action shell scripts (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh) now accept a new BASE_REF env var (default 'main'). Extended reusable-review.yml's pr-meta step to emit base-ref from the PR JSON and plumbed it to the prompt builder step. Cycle-1 three-dot 'git diff origin/...HEAD' paths and initial-review paths are untouched. Verified via pytest: tests/action/ (46 pass with my local test updates) and orchestrator/tests/test_pipeline_prompts.py (301 pass). Test updates (task-1-5, task-1-6) were handed off to the tester role because the gateway blocks coder from modifying test files; I sent a detailed HANDOFF message with the exact replacement assertions so the tester can complete those cleanly. Satisfies contract tasks task-1-1, task-1-2, task-1-3, and task-1-4.", + "metadata": { + "payload": { + "summary": "Implemented the core fix for issue #1758: re-review delta prompts now use 'git log ..HEAD --not origin/ -p' instead of 'git diff ..HEAD', which explicitly excludes base-branch commits merged into the PR branch since the last review. Updated all five call sites: orchestrator/routes/pipelines.py (_build_review_prompt delta command + Delta Review directive text with git fetch nudge) and the three action shell scripts (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh) now accept a new BASE_REF env var (default 'main'). Extended reusable-review.yml's pr-meta step to emit base-ref from the PR JSON and plumbed it to the prompt builder step. Cycle-1 three-dot 'git diff origin/...HEAD' paths and initial-review paths are untouched. Verified via pytest: tests/action/ (46 pass with my local test updates) and orchestrator/tests/test_pipeline_prompts.py (301 pass). Test updates (task-1-5, task-1-6) were handed off to the tester role because the gateway blocks coder from modifying test files; I sent a detailed HANDOFF message with the exact replacement assertions so the tester can complete those cleanly. Satisfies contract tasks task-1-1, task-1-2, task-1-3, and task-1-4.", + "attestation": {}, + "artifacts": [ + "orchestrator/routes/pipelines.py", + "action/build-review-prompt.sh", + "action/build-agent-mode-design-review-prompt.sh", + "action/build-contract-verification-prompt.sh", + ".github/workflows/reusable-review.yml" + ], + "risk_considered": "", + "commit_sha": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "files_changed": [ + "orchestrator/routes/pipelines.py", + "action/build-review-prompt.sh", + "action/build-agent-mode-design-review-prompt.sh", + "action/build-contract-verification-prompt.sh", + ".github/workflows/reusable-review.yml" + ], + "tests_run": [ + "tests/action/test_build_review_prompt.py", + "tests/action/test_build_agent_mode_design_review_prompt.py", + "tests/action/test_build_contract_verification_prompt.py", + "orchestrator/tests/test_pipeline_prompts.py" + ], + "tasks_satisfied": [ + "task-1-1", + "task-1-2", + "task-1-3", + "task-1-4" + ] + }, + "version": 1, + "commit_sha": "3898fc6bd508785cf61125fcc21a353d037a98e0" + }, + "timestamp": "2026-04-22T23:40:11.883311+00:00", + "phase": "implement" + }, + { + "id": "9e6b5a22-db30-46", + "pipeline_id": "issue-1758", + "from_role": "coder", + "to_role": "tester", + "message_type": "STATUS", + "subject": "Re: Status check \u2014 code pushed at 3898fc6bd", + "body": "Answer to your QUESTION: push is in \u2014 commit 3898fc6bd on egg/issue-1758.\n\nI hit the gateway file-scope block when I tried to include my test updates\nin the same commit. I reverted the test changes, committed only the\nnon-test files (orchestrator/routes/pipelines.py, the three action/*.sh\nscripts, and .github/workflows/reusable-review.yml), and pushed.\n\nYour test updates should now run cleanly against my implementation.\nWhen you rebase onto origin/egg/issue-1758 and apply your test changes,\nthe full suite should pass.\n\nSee the detailed HANDOFF message I sent earlier for exact replacement\nassertions. Ping me if anything looks off in the code changes \u2014 I will\niterate if reviewers NACK.", + "metadata": {}, + "timestamp": "2026-04-22T23:40:31.950124+00:00", + "phase": "implement" + }, + { + "id": "97fcf368-77b7-47", + "pipeline_id": "issue-1758", + "from_role": "reviewer_contract", + "to_role": "coder", + "message_type": "CONSENSUS_ACK", + "subject": "ACK from reviewer_contract for coder", + "body": "\nContract verification of coder commit 3898fc6bd against phase-1 tasks.\n\n### Task-by-task verification\n\n**task-1-1 \u2705 VERIFIED** \u2014 orchestrator/routes/pipelines.py:3300-3306\nThe is_delta_review branch of diff_command is now `f\"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p\"` (line 3303). Cycle-1 three-dot fallback `f\"git diff {_base_ref}...HEAD\"` is unchanged (line 3305). Added an explanatory comment block at L3293-3299 documenting why two-dot diff is wrong and why --not is needed.\n\n**task-1-2 \u2705 VERIFIED** \u2014 orchestrator/routes/pipelines.py:3449-3462\nThe Delta Review directive now references the new command `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p` (line 3457) and adds a `git fetch origin {_delta_base_branch}` nudge before it (line 3455). `_delta_base_branch = base_branch or \"main\"` defensively handles base_branch=None so the emitted fetch is never `git fetch origin None`. Good-faith interpretation of the contract's '{base_branch}' placeholder.\n\n**task-1-3 \u2705 VERIFIED** \u2014 all three prompt builders\n- action/build-review-prompt.sh:13-17 (header), 135 (base_ref default), 148 (two-part instruction)\n- action/build-agent-mode-design-review-prompt.sh:13-17 (header), 82 (base_ref default), 98 (two-part instruction)\n- action/build-contract-verification-prompt.sh:16-20 (header), 96 (base_ref default), 112 (two-part instruction)\nEach adds `local base_ref=\"${BASE_REF:-main}\"` before the re-review block, emits `git fetch origin ${base_ref}` followed by `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`, and documents BASE_REF in the header comment block. Initial-review branches untouched \u2014 confirmed by diff scope.\n\n**task-1-4 \u2705 VERIFIED** \u2014 .github/workflows/reusable-review.yml\nLine 365 emits `base-ref=$(echo \"$pr_json\" | jq -r '.base.ref')` alongside the existing head-ref/head-repo/head-sha block (inside the same `{ \u2026 } >> \"$GITHUB_OUTPUT\"` group). Line 496 plumbs `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` into the env block of the 'Build review prompt from trusted main branch' step. No consumer-workflow edits needed, matching the contract's 'plumbing is internal' note.\n\n### Tasks not in this commit\n\n**task-1-5 & task-1-6** \u2014 not addressed by coder\nThe commit message explicitly delegates these to the tester role ('tests for the new delta command form are owned by the tester role and will be updated in a separate commit'). The gateway blocking push for coder on test files corroborates the role/scope split (see overseer alert 79af7954). Existing assertions at tests/action/test_build_review_prompt.py:169, test_build_agent_mode_design_review_prompt.py:178, test_build_contract_verification_prompt.py:148, and orchestrator/tests/test_pipeline_prompts.py:2338 all still assert the old `git diff ..HEAD` form and will fail against this implementation \u2014 correctly surfacing the work the tester must do. Tester remains producer=WORKING; their proposal will be evaluated separately.\n\n### Implementation quality observations\n- The `_base_ref` vs bare-branch-name split is handled correctly: `git fetch origin ` takes the bare branch name (`_delta_base_branch`), while the `--not ` form takes the full remote ref (`_base_ref` = `origin/`). Both derivations flow from the single `base_branch` input.\n- Cycle-1 three-dot behavior is preserved as required by the contract.\n- With base_branch='develop', all five call sites correctly emit origin/develop, not a hardcoded origin/main (spot-checked against `_resolve_origin_ref`).\n\n### Non-blocking\n- orchestrator/routes/pipelines.py:3451 recomputes `_delta_base_branch = base_branch or \"main\"` even though `_base_ref` already encodes the same resolution. Minor \u2014 could factor both into a shared helper, but not a correctness issue.\n\nNo contract violations in the coder's scope. ACK.\n", + "metadata": { + "payload": { + "artifact_references": [ + "orchestrator/routes/pipelines.py", + "action/build-review-prompt.sh", + "action/build-agent-mode-design-review-prompt.sh", + "action/build-contract-verification-prompt.sh", + ".github/workflows/reusable-review.yml" + ], + "reason": "\nContract verification of coder commit 3898fc6bd against phase-1 tasks.\n\n### Task-by-task verification\n\n**task-1-1 \u2705 VERIFIED** \u2014 orchestrator/routes/pipelines.py:3300-3306\nThe is_delta_review branch of diff_command is now `f\"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p\"` (line 3303). Cycle-1 three-dot fallback `f\"git diff {_base_ref}...HEAD\"` is unchanged (line 3305). Added an explanatory comment block at L3293-3299 documenting why two-dot diff is wrong and why --not is needed.\n\n**task-1-2 \u2705 VERIFIED** \u2014 orchestrator/routes/pipelines.py:3449-3462\nThe Delta Review directive now references the new command `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p` (line 3457) and adds a `git fetch origin {_delta_base_branch}` nudge before it (line 3455). `_delta_base_branch = base_branch or \"main\"` defensively handles base_branch=None so the emitted fetch is never `git fetch origin None`. Good-faith interpretation of the contract's '{base_branch}' placeholder.\n\n**task-1-3 \u2705 VERIFIED** \u2014 all three prompt builders\n- action/build-review-prompt.sh:13-17 (header), 135 (base_ref default), 148 (two-part instruction)\n- action/build-agent-mode-design-review-prompt.sh:13-17 (header), 82 (base_ref default), 98 (two-part instruction)\n- action/build-contract-verification-prompt.sh:16-20 (header), 96 (base_ref default), 112 (two-part instruction)\nEach adds `local base_ref=\"${BASE_REF:-main}\"` before the re-review block, emits `git fetch origin ${base_ref}` followed by `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`, and documents BASE_REF in the header comment block. Initial-review branches untouched \u2014 confirmed by diff scope.\n\n**task-1-4 \u2705 VERIFIED** \u2014 .github/workflows/reusable-review.yml\nLine 365 emits `base-ref=$(echo \"$pr_json\" | jq -r '.base.ref')` alongside the existing head-ref/head-repo/head-sha block (inside the same `{ \u2026 } >> \"$GITHUB_OUTPUT\"` group). Line 496 plumbs `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` into the env block of the 'Build review prompt from trusted main branch' step. No consumer-workflow edits needed, matching the contract's 'plumbing is internal' note.\n\n### Tasks not in this commit\n\n**task-1-5 & task-1-6** \u2014 not addressed by coder\nThe commit message explicitly delegates these to the tester role ('tests for the new delta command form are owned by the tester role and will be updated in a separate commit'). The gateway blocking push for coder on test files corroborates the role/scope split (see overseer alert 79af7954). Existing assertions at tests/action/test_build_review_prompt.py:169, test_build_agent_mode_design_review_prompt.py:178, test_build_contract_verification_prompt.py:148, and orchestrator/tests/test_pipeline_prompts.py:2338 all still assert the old `git diff ..HEAD` form and will fail against this implementation \u2014 correctly surfacing the work the tester must do. Tester remains producer=WORKING; their proposal will be evaluated separately.\n\n### Implementation quality observations\n- The `_base_ref` vs bare-branch-name split is handled correctly: `git fetch origin ` takes the bare branch name (`_delta_base_branch`), while the `--not ` form takes the full remote ref (`_base_ref` = `origin/`). Both derivations flow from the single `base_branch` input.\n- Cycle-1 three-dot behavior is preserved as required by the contract.\n- With base_branch='develop', all five call sites correctly emit origin/develop, not a hardcoded origin/main (spot-checked against `_resolve_origin_ref`).\n\n### Non-blocking\n- orchestrator/routes/pipelines.py:3451 recomputes `_delta_base_branch = base_branch or \"main\"` even though `_base_ref` already encodes the same resolution. Minor \u2014 could factor both into a shared helper, but not a correctness issue.\n\nNo contract violations in the coder's scope. ACK.\n" + }, + "version": 1 + }, + "timestamp": "2026-04-22T23:41:45.087701+00:00", + "phase": "implement" + }, + { + "id": "3644e8cb-d7fc-47", + "pipeline_id": "issue-1758", + "from_role": "reviewer_contract", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by reviewer_contract (pending_acks)", + "body": "Agent reviewer_contract cannot confirm: producers ['tester'] have never proposed (proposal_version == 0). All producers must propose before any agent can confirm consensus.", + "metadata": { + "pending_acks": true + }, + "timestamp": "2026-04-22T23:41:58.952390+00:00", + "phase": "implement" + }, + { + "id": "12a3c5e1-6d0a-4a", + "pipeline_id": "issue-1758", + "from_role": "reviewer_code", + "to_role": "coder", + "message_type": "CONSENSUS_ACK", + "subject": "ACK from reviewer_code for coder", + "body": "\nReviewed coder commit 3898fc6bd (source-only, +36/-6 across 5 files). Verified it maps to contract tasks 1-1..1-4. Tests (tasks 1-5/1-6) are scoped to tester; the earlier d61871d94 bundled them and hit a file-scope violation \u2014 correctly split into scope-aligned commits.\n\n### Source correctness \u2014 verified\n- **orchestrator/routes/pipelines.py:3293-3306** \u2014 is_delta_review branch of diff_command swapped to `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p`; cycle-1 three-dot `git diff {_base_ref}...HEAD` unchanged. `_base_ref = _resolve_origin_ref(base_branch)` reuses the existing helper. New 4-line comment explains the attribution bug and why three-dot diff doesn't help (correct: merge-base(A, HEAD) = A when A is an ancestor of HEAD, so A...HEAD == A..HEAD).\n- **orchestrator/routes/pipelines.py:3448-3461** \u2014 Delta Review directive updated to emit `git fetch origin {_delta_base_branch}` + the new `git log` form. Prior-feedback / verdict-format sections untouched.\n- **action/build-review-prompt.sh:10-15, 132-149** \u2014 Header comment documents BASE_REF with #1758 reference; `local base_ref=\"${BASE_REF:-main}\"` added. Step 1 of the re-review prompt now emits `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review branch untouched. Same pattern verified in build-agent-mode-design-review-prompt.sh (L9-15, 78-95) and build-contract-verification-prompt.sh (L12-18, 96-113).\n- **.github/workflows/reusable-review.yml:363** \u2014 `base-ref` added to pr-meta output via `jq -r '.base.ref'`, alongside existing head-ref/head-repo/head-sha. L496: `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` added to the Build-review-prompt step env, only \u2014 consumer workflows are unchanged.\n\n### Git semantics \u2014 verified\n`git log A..HEAD --not origin/ -p` \u2261 `git log HEAD --not A --not origin/ -p`: commits reachable from HEAD, NOT reachable from A, NOT reachable from origin/. This is exactly PR-authored commits pushed since the last review, excluding any base-branch merges. Researched against git rev-list docs: `A..B` is sugar for `B --not A`, and multiple `--not` sides compose by union. Correct fix for the bug in #1758.\n\n### Security \u2014 clean\n- BASE_REF is sourced from `.base.ref` in the GitHub PR API response, which GitHub constrains to valid branch names. Not a prompt-injection vector.\n- The value is interpolated into the prompt text but not executed by the shell at prompt-creation time. If the agent later runs the shown command, `origin/${base_ref}` is a git refspec argument, not a shell expression.\n- Backward compat: existing callers that do NOT pass BASE_REF get `base_ref=\"main\"` via `${BASE_REF:-main}`, preserving prior behavior for default-main PRs.\n\n### Coordination note\nWithout the tester's matching updates to tests/action/test_build_*_prompt.py and orchestrator/tests/test_pipeline_prompts.py, three existing re-review assertions (`test_includes_git_diff_instruction` \u00d73) and two orchestrator assertions (`test_delta_review_directive`, `test_delta_review_still_uses_commit_sha`) will fail against this source. Task-1-5 and task-1-6 are explicitly assigned to tester. I'm ACKing the coder's source-only proposal on the assumption that the tester will complement with the test updates (I'll verify when their proposal arrives).\n\n### Non-blocking\n- **orchestrator/routes/pipelines.py:3451** \u2014 `_delta_base_branch = base_branch or 'main'` does NOT tolerate `origin/` prefix the way `_resolve_origin_ref` does (L4493-4496). If a caller ever mistakenly passes `base_branch=\"origin/develop\"`, the directive will emit `git fetch origin origin/develop` while the delta command correctly says `origin/develop`. Suggest either mirror the `origin/` strip inside this stanza, or derive `_delta_base_branch` from `_base_ref.removeprefix('origin/')` for single-source consistency. In practice callers pass bare names, so this is cosmetic \u2014 not blocking.\n- **action/build-review-prompt.sh:149 + peer scripts** \u2014 Explanatory clause reads \"commits from \\`${base_ref}\\`\". Since ${base_ref} is a branch name (e.g. `main`), the wording is fine, but `commits from origin/${base_ref}` would be slightly more precise given the agent will execute `--not origin/${base_ref}`. Cosmetic.\n- **action/build-review-prompt.sh:135 + peers** \u2014 `local base_ref=\"${BASE_REF:-main}\"` is assigned before the `if [[ -n LAST_REVIEW_COMMIT ]]` check, so it's computed even on the initial-review path where it's never referenced. Negligible cost; consider moving inside the if-branch if tidiness matters.\n- **orchestrator/routes/pipelines.py:3453-3460** \u2014 The directive now repeats the `git log \u2026 --not {_base_ref} -p` command that already appears in step 1 (L3307-3308). That matches the pre-existing pattern (old directive also repeated `git diff`), so not a regression, but the repetition is a candidate for future simplification.\n", + "metadata": { + "payload": { + "artifact_references": [ + "orchestrator/routes/pipelines.py", + "action/build-review-prompt.sh", + "action/build-agent-mode-design-review-prompt.sh", + "action/build-contract-verification-prompt.sh", + ".github/workflows/reusable-review.yml" + ], + "reason": "\nReviewed coder commit 3898fc6bd (source-only, +36/-6 across 5 files). Verified it maps to contract tasks 1-1..1-4. Tests (tasks 1-5/1-6) are scoped to tester; the earlier d61871d94 bundled them and hit a file-scope violation \u2014 correctly split into scope-aligned commits.\n\n### Source correctness \u2014 verified\n- **orchestrator/routes/pipelines.py:3293-3306** \u2014 is_delta_review branch of diff_command swapped to `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p`; cycle-1 three-dot `git diff {_base_ref}...HEAD` unchanged. `_base_ref = _resolve_origin_ref(base_branch)` reuses the existing helper. New 4-line comment explains the attribution bug and why three-dot diff doesn't help (correct: merge-base(A, HEAD) = A when A is an ancestor of HEAD, so A...HEAD == A..HEAD).\n- **orchestrator/routes/pipelines.py:3448-3461** \u2014 Delta Review directive updated to emit `git fetch origin {_delta_base_branch}` + the new `git log` form. Prior-feedback / verdict-format sections untouched.\n- **action/build-review-prompt.sh:10-15, 132-149** \u2014 Header comment documents BASE_REF with #1758 reference; `local base_ref=\"${BASE_REF:-main}\"` added. Step 1 of the re-review prompt now emits `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review branch untouched. Same pattern verified in build-agent-mode-design-review-prompt.sh (L9-15, 78-95) and build-contract-verification-prompt.sh (L12-18, 96-113).\n- **.github/workflows/reusable-review.yml:363** \u2014 `base-ref` added to pr-meta output via `jq -r '.base.ref'`, alongside existing head-ref/head-repo/head-sha. L496: `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` added to the Build-review-prompt step env, only \u2014 consumer workflows are unchanged.\n\n### Git semantics \u2014 verified\n`git log A..HEAD --not origin/ -p` \u2261 `git log HEAD --not A --not origin/ -p`: commits reachable from HEAD, NOT reachable from A, NOT reachable from origin/. This is exactly PR-authored commits pushed since the last review, excluding any base-branch merges. Researched against git rev-list docs: `A..B` is sugar for `B --not A`, and multiple `--not` sides compose by union. Correct fix for the bug in #1758.\n\n### Security \u2014 clean\n- BASE_REF is sourced from `.base.ref` in the GitHub PR API response, which GitHub constrains to valid branch names. Not a prompt-injection vector.\n- The value is interpolated into the prompt text but not executed by the shell at prompt-creation time. If the agent later runs the shown command, `origin/${base_ref}` is a git refspec argument, not a shell expression.\n- Backward compat: existing callers that do NOT pass BASE_REF get `base_ref=\"main\"` via `${BASE_REF:-main}`, preserving prior behavior for default-main PRs.\n\n### Coordination note\nWithout the tester's matching updates to tests/action/test_build_*_prompt.py and orchestrator/tests/test_pipeline_prompts.py, three existing re-review assertions (`test_includes_git_diff_instruction` \u00d73) and two orchestrator assertions (`test_delta_review_directive`, `test_delta_review_still_uses_commit_sha`) will fail against this source. Task-1-5 and task-1-6 are explicitly assigned to tester. I'm ACKing the coder's source-only proposal on the assumption that the tester will complement with the test updates (I'll verify when their proposal arrives).\n\n### Non-blocking\n- **orchestrator/routes/pipelines.py:3451** \u2014 `_delta_base_branch = base_branch or 'main'` does NOT tolerate `origin/` prefix the way `_resolve_origin_ref` does (L4493-4496). If a caller ever mistakenly passes `base_branch=\"origin/develop\"`, the directive will emit `git fetch origin origin/develop` while the delta command correctly says `origin/develop`. Suggest either mirror the `origin/` strip inside this stanza, or derive `_delta_base_branch` from `_base_ref.removeprefix('origin/')` for single-source consistency. In practice callers pass bare names, so this is cosmetic \u2014 not blocking.\n- **action/build-review-prompt.sh:149 + peer scripts** \u2014 Explanatory clause reads \"commits from \\`${base_ref}\\`\". Since ${base_ref} is a branch name (e.g. `main`), the wording is fine, but `commits from origin/${base_ref}` would be slightly more precise given the agent will execute `--not origin/${base_ref}`. Cosmetic.\n- **action/build-review-prompt.sh:135 + peers** \u2014 `local base_ref=\"${BASE_REF:-main}\"` is assigned before the `if [[ -n LAST_REVIEW_COMMIT ]]` check, so it's computed even on the initial-review path where it's never referenced. Negligible cost; consider moving inside the if-branch if tidiness matters.\n- **orchestrator/routes/pipelines.py:3453-3460** \u2014 The directive now repeats the `git log \u2026 --not {_base_ref} -p` command that already appears in step 1 (L3307-3308). That matches the pre-existing pattern (old directive also repeated `git diff`), so not a regression, but the repetition is a candidate for future simplification.\n" + }, + "version": 1 + }, + "timestamp": "2026-04-22T23:42:35.223627+00:00", + "phase": "implement" + }, + { + "id": "a57dba03-c2f7-4a", + "pipeline_id": "issue-1758", + "from_role": "coder", + "to_role": "tester", + "message_type": "STATUS", + "subject": "Reviewers ACKed \u2014 waiting on you", + "body": "FYI: reviewer_contract and reviewer_code have both ACKed my proposal\n(commit 3898fc6bd). Consensus state blocks on your producer proposal\n(task-1-5, task-1-6) plus your ACK of mine as a reviewer.\n\nYour test changes from your worktree should rebase cleanly on top of\norigin/egg/issue-1758 (at 3898fc6bd). If you hit issues, let me know.\n\nWhen you push and propose, I'll immediately ACK your proposal as a\nreviewer if it matches the contract. Then consensus should lock in.", + "metadata": {}, + "timestamp": "2026-04-22T23:43:41.906888+00:00", + "phase": "implement" + }, + { + "id": "b65ed7e7-5aed-47", + "pipeline_id": "issue-1758", + "from_role": "tester", + "to_role": "all", + "message_type": "CONSENSUS_PROPOSE", + "subject": "Proposal from tester", + "body": "Tester contract deliverables for #1758 are complete. Wrote tasks 1-5 and 1-6 test updates in commit 445b189cb covering tests/action/ (3 files) and orchestrator/tests/test_pipeline_prompts.py. Replaced existing 'git diff ..HEAD' re-review assertions with assertions for the new 'git log ..HEAD --not origin/ -p' form plus the 'git fetch origin ' nudge, and added explicit negative assertions ensuring the old two-dot diff is gone. Extended test helpers to accept a base_ref kwarg (plumbed as BASE_REF env). Added 4 new regression tests: one per action script exercising base_ref='develop' plus two in test_pipeline_prompts.py (non-default-base delta review for code reviewer, and contract reviewer delta with base_branch='develop') \u2014 these fail if base_branch isn't threaded through. Cycle-1 assertions stay unchanged. All 369 focused prompt tests pass against coder's implementation (commit 3898fc6bd). Full 'make lint' passes (ruff check + ruff format + mypy + shellcheck + custom checks). Full test suite was also run; 11634 passed. The 53 failures + 27 errors are all in unrelated network/Kubernetes mock tests (gateway_client, kubernetes_client, deployment_routes, sandbox gateway tests) that fail in this sandbox due to HTTP 403 and no k8s API \u2014 they are pre-existing environment issues, not caused by #1758 changes, and do not touch any file modified in this phase.", + "metadata": { + "payload": { + "summary": "Tester contract deliverables for #1758 are complete. Wrote tasks 1-5 and 1-6 test updates in commit 445b189cb covering tests/action/ (3 files) and orchestrator/tests/test_pipeline_prompts.py. Replaced existing 'git diff ..HEAD' re-review assertions with assertions for the new 'git log ..HEAD --not origin/ -p' form plus the 'git fetch origin ' nudge, and added explicit negative assertions ensuring the old two-dot diff is gone. Extended test helpers to accept a base_ref kwarg (plumbed as BASE_REF env). Added 4 new regression tests: one per action script exercising base_ref='develop' plus two in test_pipeline_prompts.py (non-default-base delta review for code reviewer, and contract reviewer delta with base_branch='develop') \u2014 these fail if base_branch isn't threaded through. Cycle-1 assertions stay unchanged. All 369 focused prompt tests pass against coder's implementation (commit 3898fc6bd). Full 'make lint' passes (ruff check + ruff format + mypy + shellcheck + custom checks). Full test suite was also run; 11634 passed. The 53 failures + 27 errors are all in unrelated network/Kubernetes mock tests (gateway_client, kubernetes_client, deployment_routes, sandbox gateway tests) that fail in this sandbox due to HTTP 403 and no k8s API \u2014 they are pre-existing environment issues, not caused by #1758 changes, and do not touch any file modified in this phase.", + "attestation": {}, + "artifacts": [ + "tests/action/test_build_review_prompt.py", + "tests/action/test_build_agent_mode_design_review_prompt.py", + "tests/action/test_build_contract_verification_prompt.py", + "orchestrator/tests/test_pipeline_prompts.py" + ], + "risk_considered": "", + "commit_sha": "445b189cb0d83a869cef6a98d708eed75d3ab32f", + "files_changed": [ + "tests/action/test_build_review_prompt.py", + "tests/action/test_build_agent_mode_design_review_prompt.py", + "tests/action/test_build_contract_verification_prompt.py", + "orchestrator/tests/test_pipeline_prompts.py" + ], + "tests_run": [ + "tests/action/test_build_review_prompt.py::TestReReview::test_includes_git_log_instruction", + "tests/action/test_build_review_prompt.py::TestReReview::test_custom_base_ref_threaded_through", + "tests/action/test_build_agent_mode_design_review_prompt.py::TestReReview::test_includes_git_log_instruction", + "tests/action/test_build_agent_mode_design_review_prompt.py::TestReReview::test_custom_base_ref_threaded_through", + "tests/action/test_build_contract_verification_prompt.py::TestReVerification::test_includes_git_log_instruction", + "tests/action/test_build_contract_verification_prompt.py::TestReVerification::test_custom_base_ref_threaded_through", + "orchestrator/tests/test_pipeline_prompts.py::TestBuildReviewPrompt::test_delta_review_directive", + "orchestrator/tests/test_pipeline_prompts.py::TestReviewPromptBaseBranch::test_delta_review_still_uses_commit_sha", + "orchestrator/tests/test_pipeline_prompts.py::TestReviewPromptBaseBranch::test_delta_review_with_non_default_base_branch", + "orchestrator/tests/test_pipeline_prompts.py::TestReviewPromptBaseBranch::test_delta_review_contract_reviewer_uses_base_branch" + ], + "tasks_satisfied": [ + "task-1-5", + "task-1-6" + ] + }, + "version": 1, + "commit_sha": "445b189cb0d83a869cef6a98d708eed75d3ab32f" + }, + "timestamp": "2026-04-22T23:51:25.222144+00:00", + "phase": "implement" + }, + { + "id": "e1ae0fed-45be-45", + "pipeline_id": "issue-1758", + "from_role": "tester", + "to_role": "reviewer_code", + "message_type": "HANDOFF", + "subject": "Tester work ready for your BRC review", + "body": "Tester proposal pushed (commit 445b189cb). Test updates for tasks 1-5 and 1-6 are in tests/action/ (3 files) and orchestrator/tests/test_pipeline_prompts.py. All 369 focused prompt tests pass against the coder's implementation. Full make lint clean. Ready for your review.", + "metadata": {}, + "timestamp": "2026-04-22T23:51:29.906527+00:00", + "phase": "implement" + }, + { + "id": "08d62d47-bd69-4f", + "pipeline_id": "issue-1758", + "from_role": "reviewer_contract", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by reviewer_contract", + "body": "", + "metadata": { + "consensus_reached": false + }, + "timestamp": "2026-04-22T23:51:44.543413+00:00", + "phase": "implement" + }, + { + "id": "85ba4333-00a3-44", + "pipeline_id": "issue-1758", + "from_role": "documenter", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by documenter", + "body": "", + "metadata": { + "consensus_reached": false + }, + "timestamp": "2026-04-22T23:51:53.102750+00:00", + "phase": "implement" + }, + { + "id": "cc051060-fc37-46", + "pipeline_id": "issue-1758", + "from_role": "reviewer_code", + "to_role": "tester", + "message_type": "CONSENSUS_ACK", + "subject": "ACK from reviewer_code for tester", + "body": "\nReviewed tester commit 445b189cb (4 files, +164/-14). Verified that the test changes correctly validate the coder's source changes (3898fc6bd) and that contract tasks 1-5 and 1-6 are satisfied end-to-end.\n\n### Scope \u2014 verified against contract\n- task-1-5 (three action script test files): \u2713\n * helper in each file extended with `base_ref: str = \"\"` kwarg that sets `BASE_REF` env var when non-empty\n * `test_includes_git_diff_instruction` \u2192 `test_includes_git_log_instruction` in each file; assertions replaced with the new `git log ..HEAD --not origin/main -p` + `git fetch origin main` pair; explicit `\"git diff ..HEAD\" not in prompt` regression guard\n * new `test_custom_base_ref_threaded_through` per file with `base_ref=\"develop\"` asserting `git fetch origin develop`, `git log ..HEAD --not origin/develop -p`, and `\"origin/main\" not in prompt`\n * initial-review assertions untouched (confirmed by diff inspection)\n- task-1-6 (orchestrator/tests/test_pipeline_prompts.py): \u2713\n * `test_delta_review_directive`: old `git diff abc123..HEAD` replaced with `git log abc123..HEAD --not origin/main -p` + `git fetch origin main`; explicit exclusion of the old form\n * `test_delta_review_still_uses_commit_sha`: updated to new command form; retains the `origin/main...HEAD` (three-dot) absence check for delta reviews; adds old-form-gone guard\n * new `test_delta_review_with_non_default_base_branch` with `base_branch=\"develop\"`: asserts develop threads through both fetch and log lines, and that `origin/main` does not leak (the regression the contract specifically calls out)\n\n### Bonus coverage beyond contract\n- new `test_delta_review_contract_reviewer_uses_base_branch`: verifies the contract reviewer path also threads base_branch through the delta command. Not explicitly requested by task-1-6 but a valuable defensive test \u2014 the orchestrator's `reviewer_type=\"contract\"` path uses the same `_build_review_prompt()` and the same `_base_ref`, so this prevents future regressions if the two paths diverge.\n\n### Correctness check (against coder 3898fc6bd)\nTraced the source \u2192 test alignment manually:\n- For `base_branch=None` / `base_branch=\"main\"`: `_resolve_origin_ref` returns `\"origin/main\"`; diff_command emits `\"git log abc123..HEAD --not origin/main -p\"`; Delta Review directive emits same plus `\"git fetch origin main\"`. Tests assert both. \u2713\n- For `base_branch=\"develop\"`: `_resolve_origin_ref` returns `\"origin/develop\"`; `_delta_base_branch = \"develop\"`; diff_command emits `\"git log ..HEAD --not origin/develop -p\"`; directive emits `\"git fetch origin develop\"`. Tests assert both. \u2713\n- Verified shared/prompts/*.md contain no `origin/main` literal (checked with grep), so the `\"origin/main\" not in prompt` assertion in `test_delta_review_with_non_default_base_branch` and the three action tests will pass reliably when base_branch=develop \u2014 the prompt body, review criteria, and conventions don't reintroduce origin/main text.\n- Tester's commit log states: \"All 369 prompt-related tests (tests/action/ + test_pipeline_prompts.py) pass against the coder's implementation (commit 3898fc6bd). Full lint passes; mypy clean on test files.\" Matches my inspection-level trace.\n\n### Regression guard quality\nEvery updated re-review test now explicitly asserts `\"git diff ..HEAD\" not in prompt` \u2014 this is the right belt-and-suspenders for #1758 because a silent regression to the old two-dot form was exactly the bug we were fixing. A reviewer reading these tests in future will immediately see why the old form is forbidden on the delta path.\n\n### Combined with coder's source\nTogether with coder commit 3898fc6bd, the full implementation (all 6 contract tasks) is coherent: source + tests + docs all align on the same command shape and BASE_REF plumbing. No stale assertions remain.\n\n### Non-blocking\n- **tests/action/test_build_review_prompt.py:143** \u2014 `test_generates_rereview_prompt`'s docstring still reads `\"Re-review uses git diff from last reviewed commit.\"` although the body of that test only asserts prompt identity markers, not the diff command. Cosmetic stale docstring not covered by tester's scope rewrite (the test still passes). Worth a follow-up polish pass but not blocking.\n- **orchestrator/tests/test_pipeline_prompts.py** \u2014 The new `test_delta_review_contract_reviewer_uses_base_branch` assumes the contract-reviewer code path reuses the same `_build_review_prompt` delta branch as the code reviewer (it does \u2014 reviewer_type only affects review_criteria text, not diff_command). Safe as-is; doc comment could note that the test is guarding against a future refactor that accidentally branches the delta command by reviewer_type.\n- **Helper signature consistency** \u2014 the three action-test helpers accept `base_ref: str = \"\"` and only set `BASE_REF` when truthy. Fine, matches the existing `last_review_commit` empty-string pattern.\n", + "metadata": { + "payload": { + "artifact_references": [ + "tests/action/test_build_review_prompt.py", + "tests/action/test_build_agent_mode_design_review_prompt.py", + "tests/action/test_build_contract_verification_prompt.py", + "orchestrator/tests/test_pipeline_prompts.py" + ], + "reason": "\nReviewed tester commit 445b189cb (4 files, +164/-14). Verified that the test changes correctly validate the coder's source changes (3898fc6bd) and that contract tasks 1-5 and 1-6 are satisfied end-to-end.\n\n### Scope \u2014 verified against contract\n- task-1-5 (three action script test files): \u2713\n * helper in each file extended with `base_ref: str = \"\"` kwarg that sets `BASE_REF` env var when non-empty\n * `test_includes_git_diff_instruction` \u2192 `test_includes_git_log_instruction` in each file; assertions replaced with the new `git log ..HEAD --not origin/main -p` + `git fetch origin main` pair; explicit `\"git diff ..HEAD\" not in prompt` regression guard\n * new `test_custom_base_ref_threaded_through` per file with `base_ref=\"develop\"` asserting `git fetch origin develop`, `git log ..HEAD --not origin/develop -p`, and `\"origin/main\" not in prompt`\n * initial-review assertions untouched (confirmed by diff inspection)\n- task-1-6 (orchestrator/tests/test_pipeline_prompts.py): \u2713\n * `test_delta_review_directive`: old `git diff abc123..HEAD` replaced with `git log abc123..HEAD --not origin/main -p` + `git fetch origin main`; explicit exclusion of the old form\n * `test_delta_review_still_uses_commit_sha`: updated to new command form; retains the `origin/main...HEAD` (three-dot) absence check for delta reviews; adds old-form-gone guard\n * new `test_delta_review_with_non_default_base_branch` with `base_branch=\"develop\"`: asserts develop threads through both fetch and log lines, and that `origin/main` does not leak (the regression the contract specifically calls out)\n\n### Bonus coverage beyond contract\n- new `test_delta_review_contract_reviewer_uses_base_branch`: verifies the contract reviewer path also threads base_branch through the delta command. Not explicitly requested by task-1-6 but a valuable defensive test \u2014 the orchestrator's `reviewer_type=\"contract\"` path uses the same `_build_review_prompt()` and the same `_base_ref`, so this prevents future regressions if the two paths diverge.\n\n### Correctness check (against coder 3898fc6bd)\nTraced the source \u2192 test alignment manually:\n- For `base_branch=None` / `base_branch=\"main\"`: `_resolve_origin_ref` returns `\"origin/main\"`; diff_command emits `\"git log abc123..HEAD --not origin/main -p\"`; Delta Review directive emits same plus `\"git fetch origin main\"`. Tests assert both. \u2713\n- For `base_branch=\"develop\"`: `_resolve_origin_ref` returns `\"origin/develop\"`; `_delta_base_branch = \"develop\"`; diff_command emits `\"git log ..HEAD --not origin/develop -p\"`; directive emits `\"git fetch origin develop\"`. Tests assert both. \u2713\n- Verified shared/prompts/*.md contain no `origin/main` literal (checked with grep), so the `\"origin/main\" not in prompt` assertion in `test_delta_review_with_non_default_base_branch` and the three action tests will pass reliably when base_branch=develop \u2014 the prompt body, review criteria, and conventions don't reintroduce origin/main text.\n- Tester's commit log states: \"All 369 prompt-related tests (tests/action/ + test_pipeline_prompts.py) pass against the coder's implementation (commit 3898fc6bd). Full lint passes; mypy clean on test files.\" Matches my inspection-level trace.\n\n### Regression guard quality\nEvery updated re-review test now explicitly asserts `\"git diff ..HEAD\" not in prompt` \u2014 this is the right belt-and-suspenders for #1758 because a silent regression to the old two-dot form was exactly the bug we were fixing. A reviewer reading these tests in future will immediately see why the old form is forbidden on the delta path.\n\n### Combined with coder's source\nTogether with coder commit 3898fc6bd, the full implementation (all 6 contract tasks) is coherent: source + tests + docs all align on the same command shape and BASE_REF plumbing. No stale assertions remain.\n\n### Non-blocking\n- **tests/action/test_build_review_prompt.py:143** \u2014 `test_generates_rereview_prompt`'s docstring still reads `\"Re-review uses git diff from last reviewed commit.\"` although the body of that test only asserts prompt identity markers, not the diff command. Cosmetic stale docstring not covered by tester's scope rewrite (the test still passes). Worth a follow-up polish pass but not blocking.\n- **orchestrator/tests/test_pipeline_prompts.py** \u2014 The new `test_delta_review_contract_reviewer_uses_base_branch` assumes the contract-reviewer code path reuses the same `_build_review_prompt` delta branch as the code reviewer (it does \u2014 reviewer_type only affects review_criteria text, not diff_command). Safe as-is; doc comment could note that the test is guarding against a future refactor that accidentally branches the delta command by reviewer_type.\n- **Helper signature consistency** \u2014 the three action-test helpers accept `base_ref: str = \"\"` and only set `BASE_REF` when truthy. Fine, matches the existing `last_review_commit` empty-string pattern.\n" + }, + "version": 1 + }, + "timestamp": "2026-04-22T23:52:39.579295+00:00", + "phase": "implement" + }, + { + "id": "7f3c72a1-546f-4e", + "pipeline_id": "issue-1758", + "from_role": "orchestrator", + "to_role": "tester", + "message_type": "STATUS", + "subject": "All reviewers have ACKed \u2014 ready to confirm", + "body": "All assigned reviewers have ACKed your proposal (version 1). Run `egg-orch consensus confirmed` to confirm.", + "metadata": { + "fully_acked": true, + "version": 1 + }, + "timestamp": "2026-04-22T23:52:39.579327+00:00", + "phase": "implement" + }, + { + "id": "713ebbd1-0394-4c", + "pipeline_id": "issue-1758", + "from_role": "reviewer_code", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by reviewer_code", + "body": "", + "metadata": { + "consensus_reached": false + }, + "timestamp": "2026-04-22T23:52:45.741237+00:00", + "phase": "implement" + }, + { + "id": "36104541-4a14-43", + "pipeline_id": "issue-1758", + "from_role": "tester", + "to_role": "coder", + "message_type": "CONSENSUS_ACK", + "subject": "ACK from tester for coder", + "body": "Reviewed all 5 files in coder's commit 3898fc6bd. Verified the implementation against contract tasks 1-1 through 1-4 and against my own test updates (tests pass).\n\n### Correctness (all clean)\n- **orchestrator/routes/pipelines.py:3297** \u2014 `diff_command` ternary now emits `f\"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p\"` only when `is_delta_review` is true; cycle-1 three-dot `git diff {_base_ref}...HEAD` branch preserved exactly. `_base_ref = _resolve_origin_ref(base_branch)` correctly resolves to `origin/main` (or `origin/` for non-default bases) \u2014 verified by `test_delta_review_with_non_default_base_branch` which exercises `base_branch=\"develop\"` and asserts `origin/develop` lands in the prompt.\n- **orchestrator/routes/pipelines.py:3448** \u2014 Delta Review directive rewritten to name the new `git log ... --not {_base_ref} -p` command and adds a `git fetch origin {_delta_base_branch}` nudge. `_delta_base_branch = base_branch or \"main\"` correctly yields the bare branch name for the fetch target. The directive text clearly explains why the command excludes merged-in base-branch work.\n- **action/build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh** \u2014 all three accept `BASE_REF` via `local base_ref=\"${BASE_REF:-main}\"`; re-review step 1 is the two-part instruction `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review branch untouched in all three. File header BASE_REF block is documented identically across all three, with the #1758 cross-reference.\n- **.github/workflows/reusable-review.yml:365** \u2014 new `base-ref` output from `jq -r '.base.ref'` on existing `pr_json`, plumbed through to the prompt-builder step's env at L497 as `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}`. No consumer-workflow edits needed. jq expression reuses the already-fetched `$pr_json` \u2014 no extra API call.\n\n### Security\n- Shell variables for `base_ref` and `LAST_REVIEW_COMMIT` are consistently quoted in prompt text. The prompt is text only \u2014 not executed from this code path \u2014 so there's no command-injection surface introduced here.\n- The jq output on a non-main base still lands inside a double-quoted env var in YAML, and BASE_REF is substituted into shell variables via `${BASE_REF:-main}` \u2014 no injection path.\n- `shellcheck` passes clean on all three scripts (full `make lint` is clean).\n\n### Verification\n- All 369 focused tests pass (`tests/action/` + `orchestrator/tests/test_pipeline_prompts.py`), including my new non-default-base regression tests.\n- `make lint` passes: ruff check / format / mypy / shellcheck / custom checks all green.\n- Cycle-1 three-dot form (`git diff origin/...HEAD`) and initial-review path are verified untouched by passing regression tests (`test_base_branch_produces_correct_diff_command`, `test_no_base_branch_falls_back_to_origin_main`, etc.)\n\n### Non-blocking\n- **orchestrator/routes/pipelines.py:3451** \u2014 `_delta_base_branch = base_branch or \"main\"` duplicates the bare-branch-name computation that already lives inside `_resolve_origin_ref(base_branch)` (which strips the `origin/` prefix if callers double-prefix). Could derive the fetch target from `_base_ref` (e.g. `_base_ref.removeprefix(\"origin/\")`) to have a single source of truth, but the current form is clearer and more obvious to readers; no bug.\n- **pipelines.py:3455** \u2014 the directive text says \"commits from `` that were merged into the PR branch since your last review\". Strictly, `--not origin/` excludes **all** commits reachable from `origin/`, not only those merged since last review. The user-facing phrasing is a minor simplification but it conveys the right intent for LLM reviewers. Not blocking.", + "metadata": { + "payload": { + "artifact_references": [ + "orchestrator/routes/pipelines.py", + "action/build-review-prompt.sh", + "action/build-agent-mode-design-review-prompt.sh", + "action/build-contract-verification-prompt.sh", + ".github/workflows/reusable-review.yml" + ], + "reason": "Reviewed all 5 files in coder's commit 3898fc6bd. Verified the implementation against contract tasks 1-1 through 1-4 and against my own test updates (tests pass).\n\n### Correctness (all clean)\n- **orchestrator/routes/pipelines.py:3297** \u2014 `diff_command` ternary now emits `f\"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p\"` only when `is_delta_review` is true; cycle-1 three-dot `git diff {_base_ref}...HEAD` branch preserved exactly. `_base_ref = _resolve_origin_ref(base_branch)` correctly resolves to `origin/main` (or `origin/` for non-default bases) \u2014 verified by `test_delta_review_with_non_default_base_branch` which exercises `base_branch=\"develop\"` and asserts `origin/develop` lands in the prompt.\n- **orchestrator/routes/pipelines.py:3448** \u2014 Delta Review directive rewritten to name the new `git log ... --not {_base_ref} -p` command and adds a `git fetch origin {_delta_base_branch}` nudge. `_delta_base_branch = base_branch or \"main\"` correctly yields the bare branch name for the fetch target. The directive text clearly explains why the command excludes merged-in base-branch work.\n- **action/build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh** \u2014 all three accept `BASE_REF` via `local base_ref=\"${BASE_REF:-main}\"`; re-review step 1 is the two-part instruction `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review branch untouched in all three. File header BASE_REF block is documented identically across all three, with the #1758 cross-reference.\n- **.github/workflows/reusable-review.yml:365** \u2014 new `base-ref` output from `jq -r '.base.ref'` on existing `pr_json`, plumbed through to the prompt-builder step's env at L497 as `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}`. No consumer-workflow edits needed. jq expression reuses the already-fetched `$pr_json` \u2014 no extra API call.\n\n### Security\n- Shell variables for `base_ref` and `LAST_REVIEW_COMMIT` are consistently quoted in prompt text. The prompt is text only \u2014 not executed from this code path \u2014 so there's no command-injection surface introduced here.\n- The jq output on a non-main base still lands inside a double-quoted env var in YAML, and BASE_REF is substituted into shell variables via `${BASE_REF:-main}` \u2014 no injection path.\n- `shellcheck` passes clean on all three scripts (full `make lint` is clean).\n\n### Verification\n- All 369 focused tests pass (`tests/action/` + `orchestrator/tests/test_pipeline_prompts.py`), including my new non-default-base regression tests.\n- `make lint` passes: ruff check / format / mypy / shellcheck / custom checks all green.\n- Cycle-1 three-dot form (`git diff origin/...HEAD`) and initial-review path are verified untouched by passing regression tests (`test_base_branch_produces_correct_diff_command`, `test_no_base_branch_falls_back_to_origin_main`, etc.)\n\n### Non-blocking\n- **orchestrator/routes/pipelines.py:3451** \u2014 `_delta_base_branch = base_branch or \"main\"` duplicates the bare-branch-name computation that already lives inside `_resolve_origin_ref(base_branch)` (which strips the `origin/` prefix if callers double-prefix). Could derive the fetch target from `_base_ref` (e.g. `_base_ref.removeprefix(\"origin/\")`) to have a single source of truth, but the current form is clearer and more obvious to readers; no bug.\n- **pipelines.py:3455** \u2014 the directive text says \"commits from `` that were merged into the PR branch since your last review\". Strictly, `--not origin/` excludes **all** commits reachable from `origin/`, not only those merged since last review. The user-facing phrasing is a minor simplification but it conveys the right intent for LLM reviewers. Not blocking." + }, + "version": 1 + }, + "timestamp": "2026-04-22T23:52:47.959923+00:00", + "phase": "implement" + }, + { + "id": "8b79b592-36ca-44", + "pipeline_id": "issue-1758", + "from_role": "orchestrator", + "to_role": "coder", + "message_type": "STATUS", + "subject": "All reviewers have ACKed \u2014 ready to confirm", + "body": "All assigned reviewers have ACKed your proposal (version 1). Run `egg-orch consensus confirmed` to confirm.", + "metadata": { + "fully_acked": true, + "version": 1 + }, + "timestamp": "2026-04-22T23:52:47.959940+00:00", + "phase": "implement" + }, + { + "id": "b7e1cf96-211b-49", + "pipeline_id": "issue-1758", + "from_role": "coder", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by coder", + "body": "", + "metadata": { + "consensus_reached": false + }, + "timestamp": "2026-04-22T23:52:55.163564+00:00", + "phase": "implement" + }, + { + "id": "b7d4b803-6c07-4b", + "pipeline_id": "issue-1758", + "from_role": "tester", + "to_role": "all", + "message_type": "CONSENSUS_CONFIRMED", + "subject": "Confirmed by tester", + "body": "", + "metadata": { + "consensus_reached": true + }, + "timestamp": "2026-04-22T23:52:59.189669+00:00", + "phase": "implement" + } +] \ No newline at end of file diff --git a/.egg-state/brc-history/1758-implement.md b/.egg-state/brc-history/1758-implement.md new file mode 100644 index 0000000000..dd34d23c98 --- /dev/null +++ b/.egg-state/brc-history/1758-implement.md @@ -0,0 +1,929 @@ +# BRC Consensus History — implement phase + +Generated: 2026-04-22T23:52:59Z +Pipeline: issue-1758 + +### [2026-04-22T23:30:26Z] documenter (STATUS): Documenter starting in parallel with coder + +Identified doc surfaces needing update for delta-review diff command change: docs/guides/github-automation.md (step 3 re-review diff), docs/guides/concurrent-execution.md (reviewer diff section), shared/prompts/REVIEWER-SYNC.md (diff row), action/README.md (BASE_REF). Drafting in parallel; will update again if coder's implementation changes surface. + +````yaml +id: 40195737-99fe-4a +phase: implement +```` + +### [2026-04-22T23:32:51Z] overseer (OVERSEER_ALERT): orchestrator-consensus-silent [medium] + +4 of 5 BRC agents WORKING 305s with 0 proposals — past 300s grace window + +Detail: +Phase: implement (started 23:27:13Z). Coder, reviewer_code, reviewer_contract, and tester all show producer/reviewer_phase=WORKING with 0 proposals published. Documenter published 1 STATUS at 23:30:26Z (alive, drafting docs). No progress events. Message bus: 1 STATUS message. Heartbeat OK. Orchestrator/state-store/gateway all healthy. We are 5s past the post_proposal_grace_seconds=300 window with the critical coder agent still silent. + +Recommended action: +Monitor 2 more cycles (~30s). If coder remains at WORKING with 0 proposals by ~400s, consider querying container logs directly or issuing a phase restart. Do not cancel — system is healthy, coder is likely in deep implementation work. + +````yaml +id: e1c12c07-bbc6-4d +phase: implement +```` + +### [2026-04-22T23:32:58Z] documenter (CONSENSUS_PROPOSE): Proposal from documenter + +Documented the PR-side-only delta re-review diff command across all reviewer-facing surfaces for #1758. Updated docs/guides/github-automation.md step 3 to describe the new 'git log ..HEAD --not origin/ -p' command with the fetch nudge and BASE_REF plumbing; added a 'Delta re-review command' subsection to docs/guides/concurrent-execution.md explaining BRC review_cycle>1 behavior in _build_review_prompt() and why two-dot/three-dot git diff do not work; added a delta-cycle note to docs/architecture/orchestrator.md's Prompt Context Scoping paragraph; documented the new BASE_REF env var on the three reviewer prompt builders in action/README.md and the reusable-review.yml auto-plumbing; split shared/prompts/REVIEWER-SYNC.md's Diff command row into first-review vs re-review/delta and added a modification-checklist item. Docs are supplementary to the coder/tester contract tasks (task-1-1..task-1-6) and do not block any task verification. + +````yaml +id: 45c789f5-7429-45 +phase: implement +metadata: + payload: + summary: 'Documented the PR-side-only delta re-review diff command across all + reviewer-facing surfaces for #1758. Updated docs/guides/github-automation.md + step 3 to describe the new ''git log ..HEAD --not origin/ -p'' command + with the fetch nudge and BASE_REF plumbing; added a ''Delta re-review command'' + subsection to docs/guides/concurrent-execution.md explaining BRC review_cycle>1 + behavior in _build_review_prompt() and why two-dot/three-dot git diff do not + work; added a delta-cycle note to docs/architecture/orchestrator.md''s Prompt + Context Scoping paragraph; documented the new BASE_REF env var on the three + reviewer prompt builders in action/README.md and the reusable-review.yml auto-plumbing; + split shared/prompts/REVIEWER-SYNC.md''s Diff command row into first-review + vs re-review/delta and added a modification-checklist item. Docs are supplementary + to the coder/tester contract tasks (task-1-1..task-1-6) and do not block any + task verification.' + attestation: {} + artifacts: + - action/README.md + - docs/architecture/orchestrator.md + - docs/guides/concurrent-execution.md + - docs/guides/github-automation.md + - shared/prompts/REVIEWER-SYNC.md + risk_considered: '' + commit_sha: 49e9b839f38a08ee9a86a1fcaf13d3c08eedf0b3 + files_changed: + - action/README.md + - docs/architecture/orchestrator.md + - docs/guides/concurrent-execution.md + - docs/guides/github-automation.md + - shared/prompts/REVIEWER-SYNC.md + tests_run: [] + tasks_satisfied: [] + version: 1 + commit_sha: 49e9b839f38a08ee9a86a1fcaf13d3c08eedf0b3 +```` + +### [2026-04-22T23:34:42Z] reviewer_code → documenter (CONSENSUS_ACK): ACK from reviewer_code for documenter + + +Reviewed documenter's commit 49e9b839f covering 5 doc surfaces; diff +36/-3 lines. Verified each change against the contract's task-1-1..1-6 spec. + +### What I checked +- action/README.md (+13 lines): 'Reviewer Delta / Re-Review Plumbing' section documents BASE_REF env var on the three builders (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh), the two-line 'git fetch origin ${BASE_REF}' + 'git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p' form, defaults to main, and explicitly notes initial-review (no LAST_REVIEW_COMMIT) path is unaffected. Plumbing via reusable-review.yml pr-meta is called out. +- docs/architecture/orchestrator.md: Prompt Context Scoping paragraph adds the delta-cycle switch; keeps the existing first-cycle three-dot 'git diff origin/{base_branch}...HEAD' description unchanged. Issue link and mechanism description are accurate. +- docs/guides/concurrent-execution.md: New 'Delta re-review command (BRC review_cycle > 1)' subsection sits alongside the existing 'Reviewer diff command' note without replacing it. Technical explanation of 'git log A..HEAD --not origin/{base}' is correct — it enumerates commits reachable from HEAD, reachable since A, and NOT reachable from base, so base-branch merges are excluded. The note that 'a naive git diff A..HEAD or three-dot git diff A...HEAD would both show those merged-in changes, because A is an ancestor of HEAD (so the merge-base collapses to A)' is correct: when A is an ancestor of HEAD, three-dot degenerates to two-dot. Appropriate context about BRC rarely hitting delta path. +- docs/guides/github-automation.md step 3: describes the new command accurately, mentions the git fetch nudge, documents that BASE_REF comes from pr-meta → BASE_REF, default 'main'. Explicitly notes first-cycle reviews still use the full-PR 'git diff origin/...HEAD' form, matching the contract's 'initial-review branch is not touched' clause. +- shared/prompts/REVIEWER-SYNC.md: splits the 'Diff command' alignment row into first-review vs re-review/delta rows, and adds a new modification-checklist item enumerating the three prompt builders + _build_review_prompt + BASE_REF plumbing in reusable-review.yml. This keeps the alignment matrix authoritative. + +### Correctness verification +- Git-semantics claim verified: 'git log A..HEAD --not origin/base' with A as ancestor of HEAD correctly excludes commits reachable from origin/base (including merges-in of base). The 'merge-base collapses to A' explanation for why three-dot 'git diff A...HEAD' shows merged-in changes when A is an ancestor is technically accurate (git-diff 3-dot docs: 'changes on the branch containing and up to the second, starting at a common ancestor of both'). +- GitHub issue link format matches existing style (see docs/architecture/custom-harness.md line 287). +- Doc updates precede the coder's implementation, which is a coordination risk, but the contract spec is precise enough that doc wording matches the promised code behavior. If coder deviates, documenter will need to re-propose — at that point I'll re-review accordingly. + +### Non-blocking +- **docs/guides/concurrent-execution.md:831** — Minor wording nit: 'A naive git diff A..HEAD ... because A is an ancestor of HEAD (so the merge-base collapses to A)' conflates two-dot with three-dot reasoning. Two-dot 'git diff A..HEAD' is a tree-diff and doesn't involve a merge-base; only the three-dot form does. The conclusion (both show merged-in changes) is correct, but the causal explanation applies only to the three-dot form. Suggest: 'Two-dot git diff A..HEAD compares trees directly and naturally includes merged-in changes; three-dot git diff A...HEAD diffs from merge-base(A, HEAD) to HEAD, which collapses to A when A is an ancestor and therefore shows the same thing.' Not blocking — the net technical claim is right. +- **docs/guides/github-automation.md:62-65** — Step 3 describes the new diff command but the issue-1758 explanation of *why* (base-branch merges attributed to PR) is condensed. Consider adding a short 'before/after' example in a follow-up doc PR if the distinction keeps confusing future contributors. +- **shared/prompts/REVIEWER-SYNC.md** — Consider adding a pointer to #1758 in the 'Diff command (re-review / delta)' row so the context for the split is clickable from the sync matrix. + + +````yaml +id: 55c4042a-0c28-44 +phase: implement +metadata: + payload: + artifact_references: + - action/README.md + - docs/architecture/orchestrator.md + - docs/guides/concurrent-execution.md + - docs/guides/github-automation.md + - shared/prompts/REVIEWER-SYNC.md + reason: "\nReviewed documenter's commit 49e9b839f covering 5 doc surfaces; diff\ + \ +36/-3 lines. Verified each change against the contract's task-1-1..1-6 spec.\n\ + \n### What I checked\n- action/README.md (+13 lines): 'Reviewer Delta / Re-Review\ + \ Plumbing' section documents BASE_REF env var on the three builders (build-review-prompt.sh,\ + \ build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh),\ + \ the two-line 'git fetch origin ${BASE_REF}' + 'git log ${LAST_REVIEW_COMMIT}..HEAD\ + \ --not origin/${BASE_REF} -p' form, defaults to main, and explicitly notes\ + \ initial-review (no LAST_REVIEW_COMMIT) path is unaffected. Plumbing via reusable-review.yml\ + \ pr-meta is called out.\n- docs/architecture/orchestrator.md: Prompt Context\ + \ Scoping paragraph adds the delta-cycle switch; keeps the existing first-cycle\ + \ three-dot 'git diff origin/{base_branch}...HEAD' description unchanged. Issue\ + \ link and mechanism description are accurate.\n- docs/guides/concurrent-execution.md:\ + \ New 'Delta re-review command (BRC review_cycle > 1)' subsection sits alongside\ + \ the existing 'Reviewer diff command' note without replacing it. Technical\ + \ explanation of 'git log A..HEAD --not origin/{base}' is correct \u2014 it\ + \ enumerates commits reachable from HEAD, reachable since A, and NOT reachable\ + \ from base, so base-branch merges are excluded. The note that 'a naive git\ + \ diff A..HEAD or three-dot git diff A...HEAD would both show those merged-in\ + \ changes, because A is an ancestor of HEAD (so the merge-base collapses to\ + \ A)' is correct: when A is an ancestor of HEAD, three-dot degenerates to two-dot.\ + \ Appropriate context about BRC rarely hitting delta path.\n- docs/guides/github-automation.md\ + \ step 3: describes the new command accurately, mentions the git fetch nudge,\ + \ documents that BASE_REF comes from pr-meta \u2192 BASE_REF, default 'main'.\ + \ Explicitly notes first-cycle reviews still use the full-PR 'git diff origin/...HEAD'\ + \ form, matching the contract's 'initial-review branch is not touched' clause.\n\ + - shared/prompts/REVIEWER-SYNC.md: splits the 'Diff command' alignment row into\ + \ first-review vs re-review/delta rows, and adds a new modification-checklist\ + \ item enumerating the three prompt builders + _build_review_prompt + BASE_REF\ + \ plumbing in reusable-review.yml. This keeps the alignment matrix authoritative.\n\ + \n### Correctness verification\n- Git-semantics claim verified: 'git log A..HEAD\ + \ --not origin/base' with A as ancestor of HEAD correctly excludes commits reachable\ + \ from origin/base (including merges-in of base). The 'merge-base collapses\ + \ to A' explanation for why three-dot 'git diff A...HEAD' shows merged-in changes\ + \ when A is an ancestor is technically accurate (git-diff 3-dot docs: 'changes\ + \ on the branch containing and up to the second, starting at a common ancestor\ + \ of both').\n- GitHub issue link format matches existing style (see docs/architecture/custom-harness.md\ + \ line 287).\n- Doc updates precede the coder's implementation, which is a coordination\ + \ risk, but the contract spec is precise enough that doc wording matches the\ + \ promised code behavior. If coder deviates, documenter will need to re-propose\ + \ \u2014 at that point I'll re-review accordingly.\n\n### Non-blocking\n- **docs/guides/concurrent-execution.md:831**\ + \ \u2014 Minor wording nit: 'A naive git diff A..HEAD ... because A is an ancestor\ + \ of HEAD (so the merge-base collapses to A)' conflates two-dot with three-dot\ + \ reasoning. Two-dot 'git diff A..HEAD' is a tree-diff and doesn't involve a\ + \ merge-base; only the three-dot form does. The conclusion (both show merged-in\ + \ changes) is correct, but the causal explanation applies only to the three-dot\ + \ form. Suggest: 'Two-dot git diff A..HEAD compares trees directly and naturally\ + \ includes merged-in changes; three-dot git diff A...HEAD diffs from merge-base(A,\ + \ HEAD) to HEAD, which collapses to A when A is an ancestor and therefore shows\ + \ the same thing.' Not blocking \u2014 the net technical claim is right.\n-\ + \ **docs/guides/github-automation.md:62-65** \u2014 Step 3 describes the new\ + \ diff command but the issue-1758 explanation of *why* (base-branch merges attributed\ + \ to PR) is condensed. Consider adding a short 'before/after' example in a follow-up\ + \ doc PR if the distinction keeps confusing future contributors.\n- **shared/prompts/REVIEWER-SYNC.md**\ + \ \u2014 Consider adding a pointer to #1758 in the 'Diff command (re-review\ + \ / delta)' row so the context for the split is clickable from the sync matrix.\n" + version: 1 +```` + +### [2026-04-22T23:34:42Z] orchestrator → documenter (STATUS): All reviewers have ACKed — ready to confirm + +All assigned reviewers have ACKed your proposal (version 1). Run `egg-orch consensus confirmed` to confirm. + +````yaml +id: f3c8c274-e8de-40 +phase: implement +metadata: + fully_acked: true + version: 1 +```` + +### [2026-04-22T23:36:19Z] tester → coder (QUESTION): Status check on implementation + +Tester here. My task-1-5 and task-1-6 test updates are ready in my worktree. I'm blocking on your commits for tasks 1-1 through 1-4 so I can run the tests against your implementation. Can you share status? If you've hit issues, let me know — we can collaborate on the approach. + +````yaml +id: 9f528c01-80cb-4f +phase: implement +```` + +### [2026-04-22T23:39:06Z] overseer (OVERSEER_ALERT): stuck-phase-transition [high] + +Coder committed implementation but gateway is blocking push — stuck pre-PROPOSED + +Detail: +Coder completed all tasks (commit d61871d944 at 23:38:00Z) but gateway sidecar is blocking git push with 'agent role coder cannot modify these files'. Coder has been retrying multiple push variants since 23:38:03Z: egg/issue-1758-coder/work (blocked), egg/issue-1758 (blocked - file scope violation). All containers running, heartbeat OK. Coder cannot transition WORKING→PROPOSED without a successful push. Phase implement will stall permanently unless coder uses the correct push mechanism. + +Recommended action: +Coder should use 'egg-orch push --scope-filter' instead of raw git push. The gateway enforces file scope rules per agent role. If coder does not self-recover in next 2-3 cycles, investigate which files in the coder's commit violate scope (likely overlapping with documenter's action/README.md). May need human intervention to adjust file scopes or merge commits. + +````yaml +id: 79af7954-a6eb-45 +phase: implement +```` + +### [2026-04-22T23:39:47Z] documenter (CONSENSUS_CONFIRMED): Confirmed by documenter (pending_acks) + +Agent documenter cannot confirm: producers ['coder', 'tester'] have never proposed (proposal_version == 0). All producers must propose before any agent can confirm consensus. + +````yaml +id: ab34425c-ebb5-43 +phase: implement +metadata: + pending_acks: true +```` + +### [2026-04-22T23:39:58Z] coder → tester (HANDOFF): Code for #1758 ready — tests need update (task-1-5, task-1-6) + +Code changes for issue #1758 are pushed at commit 3898fc6bd508785cf61125fcc21a353d037a98e0. + +Summary of code change: +- The delta re-review command switched from `git diff ..HEAD` to + `git log ..HEAD --not origin/ -p` (preceded by + `git fetch origin `) across all five call sites: + - orchestrator/routes/pipelines.py `_build_review_prompt()` + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh +- reusable-review.yml now emits `base-ref` from pr-meta and passes it as + BASE_REF to the prompt builder. + +I cannot modify test files (gateway blocks coder role). Please take +task-1-5 and task-1-6: + +task-1-5 — update these three test files: +- tests/action/test_build_review_prompt.py +- tests/action/test_build_agent_mode_design_review_prompt.py +- tests/action/test_build_contract_verification_prompt.py + +For each: +1. Replace the re-review assertion `assert "git diff ..HEAD" in prompt` + with both: + assert "git fetch origin main" in prompt + assert "git log ..HEAD --not origin/main -p" in prompt + assert "git diff ..HEAD" not in prompt +2. Extend the helper (`run_build_*_prompt`) with a `base_ref: str = ""` + kwarg that sets `env["BASE_REF"]` when truthy. +3. Add a new TestReReview test `test_custom_base_ref_used_in_delta` that + passes `base_ref="develop"` and asserts: + - `git fetch origin develop` in prompt + - `git log ..HEAD --not origin/develop -p` in prompt + - `origin/main` not in prompt +4. Initial-review tests stay as-is. + +task-1-6 — orchestrator/tests/test_pipeline_prompts.py: +- `test_delta_review_directive` (currently ~line 2338): replace + `assert "git diff abc123..HEAD" in prompt` with + `assert "git log abc123..HEAD --not origin/main -p" in prompt` and + `assert "git fetch origin main" in prompt`; also add + `assert "git diff abc123..HEAD" not in prompt`. +- `test_delta_review_still_uses_commit_sha` (in TestReviewPromptBaseBranch, + currently ~line 3125): replace `assert "git diff abc123def..HEAD" in prompt` + with `assert "git log abc123def..HEAD --not origin/main -p" in prompt`; + keep the `"origin/main...HEAD" not in prompt` assertion; add + `assert "git diff abc123def..HEAD" not in prompt`. +- Add a new test `test_delta_review_directive_non_default_base` under + TestBuildReviewPrompt (next to `test_delta_review_directive`) that + calls `_build_review_prompt(..., review_cycle=2, + last_reviewed_commit="deadbeef", base_branch="develop", ...)` and + asserts: + - `"git log deadbeef..HEAD --not origin/develop -p" in prompt` + - `"git fetch origin develop" in prompt` + - `"origin/main" not in prompt` +- Cycle-1 tests (`origin/main...HEAD`) stay unchanged. + +Verify with: + pytest tests/action/ orchestrator/tests/test_pipeline_prompts.py + +Once you push, please mark task-1-5 and task-1-6 complete via +`egg-contract complete-task`. Ping me in BRC consensus when done. + +````yaml +id: 1219890e-d7de-42 +phase: implement +```` + +### [2026-04-22T23:40:11Z] coder (CONSENSUS_PROPOSE): Proposal from coder + +Implemented the core fix for issue #1758: re-review delta prompts now use 'git log ..HEAD --not origin/ -p' instead of 'git diff ..HEAD', which explicitly excludes base-branch commits merged into the PR branch since the last review. Updated all five call sites: orchestrator/routes/pipelines.py (_build_review_prompt delta command + Delta Review directive text with git fetch nudge) and the three action shell scripts (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh) now accept a new BASE_REF env var (default 'main'). Extended reusable-review.yml's pr-meta step to emit base-ref from the PR JSON and plumbed it to the prompt builder step. Cycle-1 three-dot 'git diff origin/...HEAD' paths and initial-review paths are untouched. Verified via pytest: tests/action/ (46 pass with my local test updates) and orchestrator/tests/test_pipeline_prompts.py (301 pass). Test updates (task-1-5, task-1-6) were handed off to the tester role because the gateway blocks coder from modifying test files; I sent a detailed HANDOFF message with the exact replacement assertions so the tester can complete those cleanly. Satisfies contract tasks task-1-1, task-1-2, task-1-3, and task-1-4. + +````yaml +id: a13f43cd-7b3b-4c +phase: implement +metadata: + payload: + summary: 'Implemented the core fix for issue #1758: re-review delta prompts now + use ''git log ..HEAD --not origin/ -p'' instead of ''git diff ..HEAD'', + which explicitly excludes base-branch commits merged into the PR branch since + the last review. Updated all five call sites: orchestrator/routes/pipelines.py + (_build_review_prompt delta command + Delta Review directive text with git fetch + nudge) and the three action shell scripts (build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, + build-contract-verification-prompt.sh) now accept a new BASE_REF env var (default + ''main''). Extended reusable-review.yml''s pr-meta step to emit base-ref from + the PR JSON and plumbed it to the prompt builder step. Cycle-1 three-dot ''git + diff origin/...HEAD'' paths and initial-review paths are untouched. Verified + via pytest: tests/action/ (46 pass with my local test updates) and orchestrator/tests/test_pipeline_prompts.py + (301 pass). Test updates (task-1-5, task-1-6) were handed off to the tester + role because the gateway blocks coder from modifying test files; I sent a detailed + HANDOFF message with the exact replacement assertions so the tester can complete + those cleanly. Satisfies contract tasks task-1-1, task-1-2, task-1-3, and task-1-4.' + attestation: {} + artifacts: + - orchestrator/routes/pipelines.py + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh + - .github/workflows/reusable-review.yml + risk_considered: '' + commit_sha: 3898fc6bd508785cf61125fcc21a353d037a98e0 + files_changed: + - orchestrator/routes/pipelines.py + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh + - .github/workflows/reusable-review.yml + tests_run: + - tests/action/test_build_review_prompt.py + - tests/action/test_build_agent_mode_design_review_prompt.py + - tests/action/test_build_contract_verification_prompt.py + - orchestrator/tests/test_pipeline_prompts.py + tasks_satisfied: + - task-1-1 + - task-1-2 + - task-1-3 + - task-1-4 + version: 1 + commit_sha: 3898fc6bd508785cf61125fcc21a353d037a98e0 +```` + +### [2026-04-22T23:40:31Z] coder → tester (STATUS): Re: Status check — code pushed at 3898fc6bd + +Answer to your QUESTION: push is in — commit 3898fc6bd on egg/issue-1758. + +I hit the gateway file-scope block when I tried to include my test updates +in the same commit. I reverted the test changes, committed only the +non-test files (orchestrator/routes/pipelines.py, the three action/*.sh +scripts, and .github/workflows/reusable-review.yml), and pushed. + +Your test updates should now run cleanly against my implementation. +When you rebase onto origin/egg/issue-1758 and apply your test changes, +the full suite should pass. + +See the detailed HANDOFF message I sent earlier for exact replacement +assertions. Ping me if anything looks off in the code changes — I will +iterate if reviewers NACK. + +````yaml +id: 9e6b5a22-db30-46 +phase: implement +```` + +### [2026-04-22T23:41:45Z] reviewer_contract → coder (CONSENSUS_ACK): ACK from reviewer_contract for coder + + +Contract verification of coder commit 3898fc6bd against phase-1 tasks. + +### Task-by-task verification + +**task-1-1 ✅ VERIFIED** — orchestrator/routes/pipelines.py:3300-3306 +The is_delta_review branch of diff_command is now `f"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p"` (line 3303). Cycle-1 three-dot fallback `f"git diff {_base_ref}...HEAD"` is unchanged (line 3305). Added an explanatory comment block at L3293-3299 documenting why two-dot diff is wrong and why --not is needed. + +**task-1-2 ✅ VERIFIED** — orchestrator/routes/pipelines.py:3449-3462 +The Delta Review directive now references the new command `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p` (line 3457) and adds a `git fetch origin {_delta_base_branch}` nudge before it (line 3455). `_delta_base_branch = base_branch or "main"` defensively handles base_branch=None so the emitted fetch is never `git fetch origin None`. Good-faith interpretation of the contract's '{base_branch}' placeholder. + +**task-1-3 ✅ VERIFIED** — all three prompt builders +- action/build-review-prompt.sh:13-17 (header), 135 (base_ref default), 148 (two-part instruction) +- action/build-agent-mode-design-review-prompt.sh:13-17 (header), 82 (base_ref default), 98 (two-part instruction) +- action/build-contract-verification-prompt.sh:16-20 (header), 96 (base_ref default), 112 (two-part instruction) +Each adds `local base_ref="${BASE_REF:-main}"` before the re-review block, emits `git fetch origin ${base_ref}` followed by `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`, and documents BASE_REF in the header comment block. Initial-review branches untouched — confirmed by diff scope. + +**task-1-4 ✅ VERIFIED** — .github/workflows/reusable-review.yml +Line 365 emits `base-ref=$(echo "$pr_json" | jq -r '.base.ref')` alongside the existing head-ref/head-repo/head-sha block (inside the same `{ … } >> "$GITHUB_OUTPUT"` group). Line 496 plumbs `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` into the env block of the 'Build review prompt from trusted main branch' step. No consumer-workflow edits needed, matching the contract's 'plumbing is internal' note. + +### Tasks not in this commit + +**task-1-5 & task-1-6** — not addressed by coder +The commit message explicitly delegates these to the tester role ('tests for the new delta command form are owned by the tester role and will be updated in a separate commit'). The gateway blocking push for coder on test files corroborates the role/scope split (see overseer alert 79af7954). Existing assertions at tests/action/test_build_review_prompt.py:169, test_build_agent_mode_design_review_prompt.py:178, test_build_contract_verification_prompt.py:148, and orchestrator/tests/test_pipeline_prompts.py:2338 all still assert the old `git diff ..HEAD` form and will fail against this implementation — correctly surfacing the work the tester must do. Tester remains producer=WORKING; their proposal will be evaluated separately. + +### Implementation quality observations +- The `_base_ref` vs bare-branch-name split is handled correctly: `git fetch origin ` takes the bare branch name (`_delta_base_branch`), while the `--not ` form takes the full remote ref (`_base_ref` = `origin/`). Both derivations flow from the single `base_branch` input. +- Cycle-1 three-dot behavior is preserved as required by the contract. +- With base_branch='develop', all five call sites correctly emit origin/develop, not a hardcoded origin/main (spot-checked against `_resolve_origin_ref`). + +### Non-blocking +- orchestrator/routes/pipelines.py:3451 recomputes `_delta_base_branch = base_branch or "main"` even though `_base_ref` already encodes the same resolution. Minor — could factor both into a shared helper, but not a correctness issue. + +No contract violations in the coder's scope. ACK. + + +````yaml +id: 97fcf368-77b7-47 +phase: implement +metadata: + payload: + artifact_references: + - orchestrator/routes/pipelines.py + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh + - .github/workflows/reusable-review.yml + reason: "\nContract verification of coder commit 3898fc6bd against phase-1 tasks.\n\ + \n### Task-by-task verification\n\n**task-1-1 \u2705 VERIFIED** \u2014 orchestrator/routes/pipelines.py:3300-3306\n\ + The is_delta_review branch of diff_command is now `f\"git log {last_reviewed_commit}..HEAD\ + \ --not {_base_ref} -p\"` (line 3303). Cycle-1 three-dot fallback `f\"git diff\ + \ {_base_ref}...HEAD\"` is unchanged (line 3305). Added an explanatory comment\ + \ block at L3293-3299 documenting why two-dot diff is wrong and why --not is\ + \ needed.\n\n**task-1-2 \u2705 VERIFIED** \u2014 orchestrator/routes/pipelines.py:3449-3462\n\ + The Delta Review directive now references the new command `git log {last_reviewed_commit}..HEAD\ + \ --not {_base_ref} -p` (line 3457) and adds a `git fetch origin {_delta_base_branch}`\ + \ nudge before it (line 3455). `_delta_base_branch = base_branch or \"main\"\ + ` defensively handles base_branch=None so the emitted fetch is never `git fetch\ + \ origin None`. Good-faith interpretation of the contract's '{base_branch}'\ + \ placeholder.\n\n**task-1-3 \u2705 VERIFIED** \u2014 all three prompt builders\n\ + - action/build-review-prompt.sh:13-17 (header), 135 (base_ref default), 148\ + \ (two-part instruction)\n- action/build-agent-mode-design-review-prompt.sh:13-17\ + \ (header), 82 (base_ref default), 98 (two-part instruction)\n- action/build-contract-verification-prompt.sh:16-20\ + \ (header), 96 (base_ref default), 112 (two-part instruction)\nEach adds `local\ + \ base_ref=\"${BASE_REF:-main}\"` before the re-review block, emits `git fetch\ + \ origin ${base_ref}` followed by `git log ${LAST_REVIEW_COMMIT}..HEAD --not\ + \ origin/${base_ref} -p`, and documents BASE_REF in the header comment block.\ + \ Initial-review branches untouched \u2014 confirmed by diff scope.\n\n**task-1-4\ + \ \u2705 VERIFIED** \u2014 .github/workflows/reusable-review.yml\nLine 365 emits\ + \ `base-ref=$(echo \"$pr_json\" | jq -r '.base.ref')` alongside the existing\ + \ head-ref/head-repo/head-sha block (inside the same `{ \u2026 } >> \"$GITHUB_OUTPUT\"\ + ` group). Line 496 plumbs `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}`\ + \ into the env block of the 'Build review prompt from trusted main branch' step.\ + \ No consumer-workflow edits needed, matching the contract's 'plumbing is internal'\ + \ note.\n\n### Tasks not in this commit\n\n**task-1-5 & task-1-6** \u2014 not\ + \ addressed by coder\nThe commit message explicitly delegates these to the tester\ + \ role ('tests for the new delta command form are owned by the tester role and\ + \ will be updated in a separate commit'). The gateway blocking push for coder\ + \ on test files corroborates the role/scope split (see overseer alert 79af7954).\ + \ Existing assertions at tests/action/test_build_review_prompt.py:169, test_build_agent_mode_design_review_prompt.py:178,\ + \ test_build_contract_verification_prompt.py:148, and orchestrator/tests/test_pipeline_prompts.py:2338\ + \ all still assert the old `git diff ..HEAD` form and will fail against\ + \ this implementation \u2014 correctly surfacing the work the tester must do.\ + \ Tester remains producer=WORKING; their proposal will be evaluated separately.\n\ + \n### Implementation quality observations\n- The `_base_ref` vs bare-branch-name\ + \ split is handled correctly: `git fetch origin ` takes the bare branch\ + \ name (`_delta_base_branch`), while the `--not ` form takes the full remote\ + \ ref (`_base_ref` = `origin/`). Both derivations flow from the single\ + \ `base_branch` input.\n- Cycle-1 three-dot behavior is preserved as required\ + \ by the contract.\n- With base_branch='develop', all five call sites correctly\ + \ emit origin/develop, not a hardcoded origin/main (spot-checked against `_resolve_origin_ref`).\n\ + \n### Non-blocking\n- orchestrator/routes/pipelines.py:3451 recomputes `_delta_base_branch\ + \ = base_branch or \"main\"` even though `_base_ref` already encodes the same\ + \ resolution. Minor \u2014 could factor both into a shared helper, but not a\ + \ correctness issue.\n\nNo contract violations in the coder's scope. ACK.\n" + version: 1 +```` + +### [2026-04-22T23:41:58Z] reviewer_contract (CONSENSUS_CONFIRMED): Confirmed by reviewer_contract (pending_acks) + +Agent reviewer_contract cannot confirm: producers ['tester'] have never proposed (proposal_version == 0). All producers must propose before any agent can confirm consensus. + +````yaml +id: 3644e8cb-d7fc-47 +phase: implement +metadata: + pending_acks: true +```` + +### [2026-04-22T23:42:35Z] reviewer_code → coder (CONSENSUS_ACK): ACK from reviewer_code for coder + + +Reviewed coder commit 3898fc6bd (source-only, +36/-6 across 5 files). Verified it maps to contract tasks 1-1..1-4. Tests (tasks 1-5/1-6) are scoped to tester; the earlier d61871d94 bundled them and hit a file-scope violation — correctly split into scope-aligned commits. + +### Source correctness — verified +- **orchestrator/routes/pipelines.py:3293-3306** — is_delta_review branch of diff_command swapped to `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p`; cycle-1 three-dot `git diff {_base_ref}...HEAD` unchanged. `_base_ref = _resolve_origin_ref(base_branch)` reuses the existing helper. New 4-line comment explains the attribution bug and why three-dot diff doesn't help (correct: merge-base(A, HEAD) = A when A is an ancestor of HEAD, so A...HEAD == A..HEAD). +- **orchestrator/routes/pipelines.py:3448-3461** — Delta Review directive updated to emit `git fetch origin {_delta_base_branch}` + the new `git log` form. Prior-feedback / verdict-format sections untouched. +- **action/build-review-prompt.sh:10-15, 132-149** — Header comment documents BASE_REF with #1758 reference; `local base_ref="${BASE_REF:-main}"` added. Step 1 of the re-review prompt now emits `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review branch untouched. Same pattern verified in build-agent-mode-design-review-prompt.sh (L9-15, 78-95) and build-contract-verification-prompt.sh (L12-18, 96-113). +- **.github/workflows/reusable-review.yml:363** — `base-ref` added to pr-meta output via `jq -r '.base.ref'`, alongside existing head-ref/head-repo/head-sha. L496: `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` added to the Build-review-prompt step env, only — consumer workflows are unchanged. + +### Git semantics — verified +`git log A..HEAD --not origin/ -p` ≡ `git log HEAD --not A --not origin/ -p`: commits reachable from HEAD, NOT reachable from A, NOT reachable from origin/. This is exactly PR-authored commits pushed since the last review, excluding any base-branch merges. Researched against git rev-list docs: `A..B` is sugar for `B --not A`, and multiple `--not` sides compose by union. Correct fix for the bug in #1758. + +### Security — clean +- BASE_REF is sourced from `.base.ref` in the GitHub PR API response, which GitHub constrains to valid branch names. Not a prompt-injection vector. +- The value is interpolated into the prompt text but not executed by the shell at prompt-creation time. If the agent later runs the shown command, `origin/${base_ref}` is a git refspec argument, not a shell expression. +- Backward compat: existing callers that do NOT pass BASE_REF get `base_ref="main"` via `${BASE_REF:-main}`, preserving prior behavior for default-main PRs. + +### Coordination note +Without the tester's matching updates to tests/action/test_build_*_prompt.py and orchestrator/tests/test_pipeline_prompts.py, three existing re-review assertions (`test_includes_git_diff_instruction` ×3) and two orchestrator assertions (`test_delta_review_directive`, `test_delta_review_still_uses_commit_sha`) will fail against this source. Task-1-5 and task-1-6 are explicitly assigned to tester. I'm ACKing the coder's source-only proposal on the assumption that the tester will complement with the test updates (I'll verify when their proposal arrives). + +### Non-blocking +- **orchestrator/routes/pipelines.py:3451** — `_delta_base_branch = base_branch or 'main'` does NOT tolerate `origin/` prefix the way `_resolve_origin_ref` does (L4493-4496). If a caller ever mistakenly passes `base_branch="origin/develop"`, the directive will emit `git fetch origin origin/develop` while the delta command correctly says `origin/develop`. Suggest either mirror the `origin/` strip inside this stanza, or derive `_delta_base_branch` from `_base_ref.removeprefix('origin/')` for single-source consistency. In practice callers pass bare names, so this is cosmetic — not blocking. +- **action/build-review-prompt.sh:149 + peer scripts** — Explanatory clause reads "commits from \`${base_ref}\`". Since ${base_ref} is a branch name (e.g. `main`), the wording is fine, but `commits from origin/${base_ref}` would be slightly more precise given the agent will execute `--not origin/${base_ref}`. Cosmetic. +- **action/build-review-prompt.sh:135 + peers** — `local base_ref="${BASE_REF:-main}"` is assigned before the `if [[ -n LAST_REVIEW_COMMIT ]]` check, so it's computed even on the initial-review path where it's never referenced. Negligible cost; consider moving inside the if-branch if tidiness matters. +- **orchestrator/routes/pipelines.py:3453-3460** — The directive now repeats the `git log … --not {_base_ref} -p` command that already appears in step 1 (L3307-3308). That matches the pre-existing pattern (old directive also repeated `git diff`), so not a regression, but the repetition is a candidate for future simplification. + + +````yaml +id: 12a3c5e1-6d0a-4a +phase: implement +metadata: + payload: + artifact_references: + - orchestrator/routes/pipelines.py + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh + - .github/workflows/reusable-review.yml + reason: "\nReviewed coder commit 3898fc6bd (source-only, +36/-6 across 5 files).\ + \ Verified it maps to contract tasks 1-1..1-4. Tests (tasks 1-5/1-6) are scoped\ + \ to tester; the earlier d61871d94 bundled them and hit a file-scope violation\ + \ \u2014 correctly split into scope-aligned commits.\n\n### Source correctness\ + \ \u2014 verified\n- **orchestrator/routes/pipelines.py:3293-3306** \u2014 is_delta_review\ + \ branch of diff_command swapped to `git log {last_reviewed_commit}..HEAD --not\ + \ {_base_ref} -p`; cycle-1 three-dot `git diff {_base_ref}...HEAD` unchanged.\ + \ `_base_ref = _resolve_origin_ref(base_branch)` reuses the existing helper.\ + \ New 4-line comment explains the attribution bug and why three-dot diff doesn't\ + \ help (correct: merge-base(A, HEAD) = A when A is an ancestor of HEAD, so A...HEAD\ + \ == A..HEAD).\n- **orchestrator/routes/pipelines.py:3448-3461** \u2014 Delta\ + \ Review directive updated to emit `git fetch origin {_delta_base_branch}` +\ + \ the new `git log` form. Prior-feedback / verdict-format sections untouched.\n\ + - **action/build-review-prompt.sh:10-15, 132-149** \u2014 Header comment documents\ + \ BASE_REF with #1758 reference; `local base_ref=\"${BASE_REF:-main}\"` added.\ + \ Step 1 of the re-review prompt now emits `git fetch origin ${base_ref}` then\ + \ `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review\ + \ branch untouched. Same pattern verified in build-agent-mode-design-review-prompt.sh\ + \ (L9-15, 78-95) and build-contract-verification-prompt.sh (L12-18, 96-113).\n\ + - **.github/workflows/reusable-review.yml:363** \u2014 `base-ref` added to pr-meta\ + \ output via `jq -r '.base.ref'`, alongside existing head-ref/head-repo/head-sha.\ + \ L496: `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` added to the Build-review-prompt\ + \ step env, only \u2014 consumer workflows are unchanged.\n\n### Git semantics\ + \ \u2014 verified\n`git log A..HEAD --not origin/ -p` \u2261 `git log\ + \ HEAD --not A --not origin/ -p`: commits reachable from HEAD, NOT reachable\ + \ from A, NOT reachable from origin/. This is exactly PR-authored commits\ + \ pushed since the last review, excluding any base-branch merges. Researched\ + \ against git rev-list docs: `A..B` is sugar for `B --not A`, and multiple `--not`\ + \ sides compose by union. Correct fix for the bug in #1758.\n\n### Security\ + \ \u2014 clean\n- BASE_REF is sourced from `.base.ref` in the GitHub PR API\ + \ response, which GitHub constrains to valid branch names. Not a prompt-injection\ + \ vector.\n- The value is interpolated into the prompt text but not executed\ + \ by the shell at prompt-creation time. If the agent later runs the shown command,\ + \ `origin/${base_ref}` is a git refspec argument, not a shell expression.\n\ + - Backward compat: existing callers that do NOT pass BASE_REF get `base_ref=\"\ + main\"` via `${BASE_REF:-main}`, preserving prior behavior for default-main\ + \ PRs.\n\n### Coordination note\nWithout the tester's matching updates to tests/action/test_build_*_prompt.py\ + \ and orchestrator/tests/test_pipeline_prompts.py, three existing re-review\ + \ assertions (`test_includes_git_diff_instruction` \xD73) and two orchestrator\ + \ assertions (`test_delta_review_directive`, `test_delta_review_still_uses_commit_sha`)\ + \ will fail against this source. Task-1-5 and task-1-6 are explicitly assigned\ + \ to tester. I'm ACKing the coder's source-only proposal on the assumption that\ + \ the tester will complement with the test updates (I'll verify when their proposal\ + \ arrives).\n\n### Non-blocking\n- **orchestrator/routes/pipelines.py:3451**\ + \ \u2014 `_delta_base_branch = base_branch or 'main'` does NOT tolerate `origin/`\ + \ prefix the way `_resolve_origin_ref` does (L4493-4496). If a caller ever mistakenly\ + \ passes `base_branch=\"origin/develop\"`, the directive will emit `git fetch\ + \ origin origin/develop` while the delta command correctly says `origin/develop`.\ + \ Suggest either mirror the `origin/` strip inside this stanza, or derive `_delta_base_branch`\ + \ from `_base_ref.removeprefix('origin/')` for single-source consistency. In\ + \ practice callers pass bare names, so this is cosmetic \u2014 not blocking.\n\ + - **action/build-review-prompt.sh:149 + peer scripts** \u2014 Explanatory clause\ + \ reads \"commits from \\`${base_ref}\\`\". Since ${base_ref} is a branch name\ + \ (e.g. `main`), the wording is fine, but `commits from origin/${base_ref}`\ + \ would be slightly more precise given the agent will execute `--not origin/${base_ref}`.\ + \ Cosmetic.\n- **action/build-review-prompt.sh:135 + peers** \u2014 `local base_ref=\"\ + ${BASE_REF:-main}\"` is assigned before the `if [[ -n LAST_REVIEW_COMMIT ]]`\ + \ check, so it's computed even on the initial-review path where it's never referenced.\ + \ Negligible cost; consider moving inside the if-branch if tidiness matters.\n\ + - **orchestrator/routes/pipelines.py:3453-3460** \u2014 The directive now repeats\ + \ the `git log \u2026 --not {_base_ref} -p` command that already appears in\ + \ step 1 (L3307-3308). That matches the pre-existing pattern (old directive\ + \ also repeated `git diff`), so not a regression, but the repetition is a candidate\ + \ for future simplification.\n" + version: 1 +```` + +### [2026-04-22T23:43:41Z] coder → tester (STATUS): Reviewers ACKed — waiting on you + +FYI: reviewer_contract and reviewer_code have both ACKed my proposal +(commit 3898fc6bd). Consensus state blocks on your producer proposal +(task-1-5, task-1-6) plus your ACK of mine as a reviewer. + +Your test changes from your worktree should rebase cleanly on top of +origin/egg/issue-1758 (at 3898fc6bd). If you hit issues, let me know. + +When you push and propose, I'll immediately ACK your proposal as a +reviewer if it matches the contract. Then consensus should lock in. + +````yaml +id: a57dba03-c2f7-4a +phase: implement +```` + +### [2026-04-22T23:51:25Z] tester (CONSENSUS_PROPOSE): Proposal from tester + +Tester contract deliverables for #1758 are complete. Wrote tasks 1-5 and 1-6 test updates in commit 445b189cb covering tests/action/ (3 files) and orchestrator/tests/test_pipeline_prompts.py. Replaced existing 'git diff ..HEAD' re-review assertions with assertions for the new 'git log ..HEAD --not origin/ -p' form plus the 'git fetch origin ' nudge, and added explicit negative assertions ensuring the old two-dot diff is gone. Extended test helpers to accept a base_ref kwarg (plumbed as BASE_REF env). Added 4 new regression tests: one per action script exercising base_ref='develop' plus two in test_pipeline_prompts.py (non-default-base delta review for code reviewer, and contract reviewer delta with base_branch='develop') — these fail if base_branch isn't threaded through. Cycle-1 assertions stay unchanged. All 369 focused prompt tests pass against coder's implementation (commit 3898fc6bd). Full 'make lint' passes (ruff check + ruff format + mypy + shellcheck + custom checks). Full test suite was also run; 11634 passed. The 53 failures + 27 errors are all in unrelated network/Kubernetes mock tests (gateway_client, kubernetes_client, deployment_routes, sandbox gateway tests) that fail in this sandbox due to HTTP 403 and no k8s API — they are pre-existing environment issues, not caused by #1758 changes, and do not touch any file modified in this phase. + +````yaml +id: b65ed7e7-5aed-47 +phase: implement +metadata: + payload: + summary: "Tester contract deliverables for #1758 are complete. Wrote tasks 1-5\ + \ and 1-6 test updates in commit 445b189cb covering tests/action/ (3 files)\ + \ and orchestrator/tests/test_pipeline_prompts.py. Replaced existing 'git diff\ + \ ..HEAD' re-review assertions with assertions for the new 'git log ..HEAD\ + \ --not origin/ -p' form plus the 'git fetch origin ' nudge, and\ + \ added explicit negative assertions ensuring the old two-dot diff is gone.\ + \ Extended test helpers to accept a base_ref kwarg (plumbed as BASE_REF env).\ + \ Added 4 new regression tests: one per action script exercising base_ref='develop'\ + \ plus two in test_pipeline_prompts.py (non-default-base delta review for code\ + \ reviewer, and contract reviewer delta with base_branch='develop') \u2014 these\ + \ fail if base_branch isn't threaded through. Cycle-1 assertions stay unchanged.\ + \ All 369 focused prompt tests pass against coder's implementation (commit 3898fc6bd).\ + \ Full 'make lint' passes (ruff check + ruff format + mypy + shellcheck + custom\ + \ checks). Full test suite was also run; 11634 passed. The 53 failures + 27\ + \ errors are all in unrelated network/Kubernetes mock tests (gateway_client,\ + \ kubernetes_client, deployment_routes, sandbox gateway tests) that fail in\ + \ this sandbox due to HTTP 403 and no k8s API \u2014 they are pre-existing environment\ + \ issues, not caused by #1758 changes, and do not touch any file modified in\ + \ this phase." + attestation: {} + artifacts: + - tests/action/test_build_review_prompt.py + - tests/action/test_build_agent_mode_design_review_prompt.py + - tests/action/test_build_contract_verification_prompt.py + - orchestrator/tests/test_pipeline_prompts.py + risk_considered: '' + commit_sha: 445b189cb0d83a869cef6a98d708eed75d3ab32f + files_changed: + - tests/action/test_build_review_prompt.py + - tests/action/test_build_agent_mode_design_review_prompt.py + - tests/action/test_build_contract_verification_prompt.py + - orchestrator/tests/test_pipeline_prompts.py + tests_run: + - tests/action/test_build_review_prompt.py::TestReReview::test_includes_git_log_instruction + - tests/action/test_build_review_prompt.py::TestReReview::test_custom_base_ref_threaded_through + - tests/action/test_build_agent_mode_design_review_prompt.py::TestReReview::test_includes_git_log_instruction + - tests/action/test_build_agent_mode_design_review_prompt.py::TestReReview::test_custom_base_ref_threaded_through + - tests/action/test_build_contract_verification_prompt.py::TestReVerification::test_includes_git_log_instruction + - tests/action/test_build_contract_verification_prompt.py::TestReVerification::test_custom_base_ref_threaded_through + - orchestrator/tests/test_pipeline_prompts.py::TestBuildReviewPrompt::test_delta_review_directive + - orchestrator/tests/test_pipeline_prompts.py::TestReviewPromptBaseBranch::test_delta_review_still_uses_commit_sha + - orchestrator/tests/test_pipeline_prompts.py::TestReviewPromptBaseBranch::test_delta_review_with_non_default_base_branch + - orchestrator/tests/test_pipeline_prompts.py::TestReviewPromptBaseBranch::test_delta_review_contract_reviewer_uses_base_branch + tasks_satisfied: + - task-1-5 + - task-1-6 + version: 1 + commit_sha: 445b189cb0d83a869cef6a98d708eed75d3ab32f +```` + +### [2026-04-22T23:51:29Z] tester → reviewer_code (HANDOFF): Tester work ready for your BRC review + +Tester proposal pushed (commit 445b189cb). Test updates for tasks 1-5 and 1-6 are in tests/action/ (3 files) and orchestrator/tests/test_pipeline_prompts.py. All 369 focused prompt tests pass against the coder's implementation. Full make lint clean. Ready for your review. + +````yaml +id: e1ae0fed-45be-45 +phase: implement +```` + +### [2026-04-22T23:51:44Z] reviewer_contract (CONSENSUS_CONFIRMED): Confirmed by reviewer_contract + +````yaml +id: 08d62d47-bd69-4f +phase: implement +metadata: + consensus_reached: false +```` + +### [2026-04-22T23:51:53Z] documenter (CONSENSUS_CONFIRMED): Confirmed by documenter + +````yaml +id: 85ba4333-00a3-44 +phase: implement +metadata: + consensus_reached: false +```` + +### [2026-04-22T23:52:39Z] reviewer_code → tester (CONSENSUS_ACK): ACK from reviewer_code for tester + + +Reviewed tester commit 445b189cb (4 files, +164/-14). Verified that the test changes correctly validate the coder's source changes (3898fc6bd) and that contract tasks 1-5 and 1-6 are satisfied end-to-end. + +### Scope — verified against contract +- task-1-5 (three action script test files): ✓ + * helper in each file extended with `base_ref: str = ""` kwarg that sets `BASE_REF` env var when non-empty + * `test_includes_git_diff_instruction` → `test_includes_git_log_instruction` in each file; assertions replaced with the new `git log ..HEAD --not origin/main -p` + `git fetch origin main` pair; explicit `"git diff ..HEAD" not in prompt` regression guard + * new `test_custom_base_ref_threaded_through` per file with `base_ref="develop"` asserting `git fetch origin develop`, `git log ..HEAD --not origin/develop -p`, and `"origin/main" not in prompt` + * initial-review assertions untouched (confirmed by diff inspection) +- task-1-6 (orchestrator/tests/test_pipeline_prompts.py): ✓ + * `test_delta_review_directive`: old `git diff abc123..HEAD` replaced with `git log abc123..HEAD --not origin/main -p` + `git fetch origin main`; explicit exclusion of the old form + * `test_delta_review_still_uses_commit_sha`: updated to new command form; retains the `origin/main...HEAD` (three-dot) absence check for delta reviews; adds old-form-gone guard + * new `test_delta_review_with_non_default_base_branch` with `base_branch="develop"`: asserts develop threads through both fetch and log lines, and that `origin/main` does not leak (the regression the contract specifically calls out) + +### Bonus coverage beyond contract +- new `test_delta_review_contract_reviewer_uses_base_branch`: verifies the contract reviewer path also threads base_branch through the delta command. Not explicitly requested by task-1-6 but a valuable defensive test — the orchestrator's `reviewer_type="contract"` path uses the same `_build_review_prompt()` and the same `_base_ref`, so this prevents future regressions if the two paths diverge. + +### Correctness check (against coder 3898fc6bd) +Traced the source → test alignment manually: +- For `base_branch=None` / `base_branch="main"`: `_resolve_origin_ref` returns `"origin/main"`; diff_command emits `"git log abc123..HEAD --not origin/main -p"`; Delta Review directive emits same plus `"git fetch origin main"`. Tests assert both. ✓ +- For `base_branch="develop"`: `_resolve_origin_ref` returns `"origin/develop"`; `_delta_base_branch = "develop"`; diff_command emits `"git log ..HEAD --not origin/develop -p"`; directive emits `"git fetch origin develop"`. Tests assert both. ✓ +- Verified shared/prompts/*.md contain no `origin/main` literal (checked with grep), so the `"origin/main" not in prompt` assertion in `test_delta_review_with_non_default_base_branch` and the three action tests will pass reliably when base_branch=develop — the prompt body, review criteria, and conventions don't reintroduce origin/main text. +- Tester's commit log states: "All 369 prompt-related tests (tests/action/ + test_pipeline_prompts.py) pass against the coder's implementation (commit 3898fc6bd). Full lint passes; mypy clean on test files." Matches my inspection-level trace. + +### Regression guard quality +Every updated re-review test now explicitly asserts `"git diff ..HEAD" not in prompt` — this is the right belt-and-suspenders for #1758 because a silent regression to the old two-dot form was exactly the bug we were fixing. A reviewer reading these tests in future will immediately see why the old form is forbidden on the delta path. + +### Combined with coder's source +Together with coder commit 3898fc6bd, the full implementation (all 6 contract tasks) is coherent: source + tests + docs all align on the same command shape and BASE_REF plumbing. No stale assertions remain. + +### Non-blocking +- **tests/action/test_build_review_prompt.py:143** — `test_generates_rereview_prompt`'s docstring still reads `"Re-review uses git diff from last reviewed commit."` although the body of that test only asserts prompt identity markers, not the diff command. Cosmetic stale docstring not covered by tester's scope rewrite (the test still passes). Worth a follow-up polish pass but not blocking. +- **orchestrator/tests/test_pipeline_prompts.py** — The new `test_delta_review_contract_reviewer_uses_base_branch` assumes the contract-reviewer code path reuses the same `_build_review_prompt` delta branch as the code reviewer (it does — reviewer_type only affects review_criteria text, not diff_command). Safe as-is; doc comment could note that the test is guarding against a future refactor that accidentally branches the delta command by reviewer_type. +- **Helper signature consistency** — the three action-test helpers accept `base_ref: str = ""` and only set `BASE_REF` when truthy. Fine, matches the existing `last_review_commit` empty-string pattern. + + +````yaml +id: cc051060-fc37-46 +phase: implement +metadata: + payload: + artifact_references: + - tests/action/test_build_review_prompt.py + - tests/action/test_build_agent_mode_design_review_prompt.py + - tests/action/test_build_contract_verification_prompt.py + - orchestrator/tests/test_pipeline_prompts.py + reason: "\nReviewed tester commit 445b189cb (4 files, +164/-14). Verified that\ + \ the test changes correctly validate the coder's source changes (3898fc6bd)\ + \ and that contract tasks 1-5 and 1-6 are satisfied end-to-end.\n\n### Scope\ + \ \u2014 verified against contract\n- task-1-5 (three action script test files):\ + \ \u2713\n * helper in each file extended with `base_ref: str = \"\"` kwarg\ + \ that sets `BASE_REF` env var when non-empty\n * `test_includes_git_diff_instruction`\ + \ \u2192 `test_includes_git_log_instruction` in each file; assertions replaced\ + \ with the new `git log ..HEAD --not origin/main -p` + `git fetch origin\ + \ main` pair; explicit `\"git diff ..HEAD\" not in prompt` regression guard\n\ + \ * new `test_custom_base_ref_threaded_through` per file with `base_ref=\"\ + develop\"` asserting `git fetch origin develop`, `git log ..HEAD --not\ + \ origin/develop -p`, and `\"origin/main\" not in prompt`\n * initial-review\ + \ assertions untouched (confirmed by diff inspection)\n- task-1-6 (orchestrator/tests/test_pipeline_prompts.py):\ + \ \u2713\n * `test_delta_review_directive`: old `git diff abc123..HEAD` replaced\ + \ with `git log abc123..HEAD --not origin/main -p` + `git fetch origin main`;\ + \ explicit exclusion of the old form\n * `test_delta_review_still_uses_commit_sha`:\ + \ updated to new command form; retains the `origin/main...HEAD` (three-dot)\ + \ absence check for delta reviews; adds old-form-gone guard\n * new `test_delta_review_with_non_default_base_branch`\ + \ with `base_branch=\"develop\"`: asserts develop threads through both fetch\ + \ and log lines, and that `origin/main` does not leak (the regression the contract\ + \ specifically calls out)\n\n### Bonus coverage beyond contract\n- new `test_delta_review_contract_reviewer_uses_base_branch`:\ + \ verifies the contract reviewer path also threads base_branch through the delta\ + \ command. Not explicitly requested by task-1-6 but a valuable defensive test\ + \ \u2014 the orchestrator's `reviewer_type=\"contract\"` path uses the same\ + \ `_build_review_prompt()` and the same `_base_ref`, so this prevents future\ + \ regressions if the two paths diverge.\n\n### Correctness check (against coder\ + \ 3898fc6bd)\nTraced the source \u2192 test alignment manually:\n- For `base_branch=None`\ + \ / `base_branch=\"main\"`: `_resolve_origin_ref` returns `\"origin/main\"`;\ + \ diff_command emits `\"git log abc123..HEAD --not origin/main -p\"`; Delta\ + \ Review directive emits same plus `\"git fetch origin main\"`. Tests assert\ + \ both. \u2713\n- For `base_branch=\"develop\"`: `_resolve_origin_ref` returns\ + \ `\"origin/develop\"`; `_delta_base_branch = \"develop\"`; diff_command emits\ + \ `\"git log ..HEAD --not origin/develop -p\"`; directive emits `\"git\ + \ fetch origin develop\"`. Tests assert both. \u2713\n- Verified shared/prompts/*.md\ + \ contain no `origin/main` literal (checked with grep), so the `\"origin/main\"\ + \ not in prompt` assertion in `test_delta_review_with_non_default_base_branch`\ + \ and the three action tests will pass reliably when base_branch=develop \u2014\ + \ the prompt body, review criteria, and conventions don't reintroduce origin/main\ + \ text.\n- Tester's commit log states: \"All 369 prompt-related tests (tests/action/\ + \ + test_pipeline_prompts.py) pass against the coder's implementation (commit\ + \ 3898fc6bd). Full lint passes; mypy clean on test files.\" Matches my inspection-level\ + \ trace.\n\n### Regression guard quality\nEvery updated re-review test now explicitly\ + \ asserts `\"git diff ..HEAD\" not in prompt` \u2014 this is the right\ + \ belt-and-suspenders for #1758 because a silent regression to the old two-dot\ + \ form was exactly the bug we were fixing. A reviewer reading these tests in\ + \ future will immediately see why the old form is forbidden on the delta path.\n\ + \n### Combined with coder's source\nTogether with coder commit 3898fc6bd, the\ + \ full implementation (all 6 contract tasks) is coherent: source + tests + docs\ + \ all align on the same command shape and BASE_REF plumbing. No stale assertions\ + \ remain.\n\n### Non-blocking\n- **tests/action/test_build_review_prompt.py:143**\ + \ \u2014 `test_generates_rereview_prompt`'s docstring still reads `\"Re-review\ + \ uses git diff from last reviewed commit.\"` although the body of that test\ + \ only asserts prompt identity markers, not the diff command. Cosmetic stale\ + \ docstring not covered by tester's scope rewrite (the test still passes). Worth\ + \ a follow-up polish pass but not blocking.\n- **orchestrator/tests/test_pipeline_prompts.py**\ + \ \u2014 The new `test_delta_review_contract_reviewer_uses_base_branch` assumes\ + \ the contract-reviewer code path reuses the same `_build_review_prompt` delta\ + \ branch as the code reviewer (it does \u2014 reviewer_type only affects review_criteria\ + \ text, not diff_command). Safe as-is; doc comment could note that the test\ + \ is guarding against a future refactor that accidentally branches the delta\ + \ command by reviewer_type.\n- **Helper signature consistency** \u2014 the three\ + \ action-test helpers accept `base_ref: str = \"\"` and only set `BASE_REF`\ + \ when truthy. Fine, matches the existing `last_review_commit` empty-string\ + \ pattern.\n" + version: 1 +```` + +### [2026-04-22T23:52:39Z] orchestrator → tester (STATUS): All reviewers have ACKed — ready to confirm + +All assigned reviewers have ACKed your proposal (version 1). Run `egg-orch consensus confirmed` to confirm. + +````yaml +id: 7f3c72a1-546f-4e +phase: implement +metadata: + fully_acked: true + version: 1 +```` + +### [2026-04-22T23:52:45Z] reviewer_code (CONSENSUS_CONFIRMED): Confirmed by reviewer_code + +````yaml +id: 713ebbd1-0394-4c +phase: implement +metadata: + consensus_reached: false +```` + +### [2026-04-22T23:52:47Z] tester → coder (CONSENSUS_ACK): ACK from tester for coder + +Reviewed all 5 files in coder's commit 3898fc6bd. Verified the implementation against contract tasks 1-1 through 1-4 and against my own test updates (tests pass). + +### Correctness (all clean) +- **orchestrator/routes/pipelines.py:3297** — `diff_command` ternary now emits `f"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p"` only when `is_delta_review` is true; cycle-1 three-dot `git diff {_base_ref}...HEAD` branch preserved exactly. `_base_ref = _resolve_origin_ref(base_branch)` correctly resolves to `origin/main` (or `origin/` for non-default bases) — verified by `test_delta_review_with_non_default_base_branch` which exercises `base_branch="develop"` and asserts `origin/develop` lands in the prompt. +- **orchestrator/routes/pipelines.py:3448** — Delta Review directive rewritten to name the new `git log ... --not {_base_ref} -p` command and adds a `git fetch origin {_delta_base_branch}` nudge. `_delta_base_branch = base_branch or "main"` correctly yields the bare branch name for the fetch target. The directive text clearly explains why the command excludes merged-in base-branch work. +- **action/build-review-prompt.sh, build-agent-mode-design-review-prompt.sh, build-contract-verification-prompt.sh** — all three accept `BASE_REF` via `local base_ref="${BASE_REF:-main}"`; re-review step 1 is the two-part instruction `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`. Initial-review branch untouched in all three. File header BASE_REF block is documented identically across all three, with the #1758 cross-reference. +- **.github/workflows/reusable-review.yml:365** — new `base-ref` output from `jq -r '.base.ref'` on existing `pr_json`, plumbed through to the prompt-builder step's env at L497 as `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}`. No consumer-workflow edits needed. jq expression reuses the already-fetched `$pr_json` — no extra API call. + +### Security +- Shell variables for `base_ref` and `LAST_REVIEW_COMMIT` are consistently quoted in prompt text. The prompt is text only — not executed from this code path — so there's no command-injection surface introduced here. +- The jq output on a non-main base still lands inside a double-quoted env var in YAML, and BASE_REF is substituted into shell variables via `${BASE_REF:-main}` — no injection path. +- `shellcheck` passes clean on all three scripts (full `make lint` is clean). + +### Verification +- All 369 focused tests pass (`tests/action/` + `orchestrator/tests/test_pipeline_prompts.py`), including my new non-default-base regression tests. +- `make lint` passes: ruff check / format / mypy / shellcheck / custom checks all green. +- Cycle-1 three-dot form (`git diff origin/...HEAD`) and initial-review path are verified untouched by passing regression tests (`test_base_branch_produces_correct_diff_command`, `test_no_base_branch_falls_back_to_origin_main`, etc.) + +### Non-blocking +- **orchestrator/routes/pipelines.py:3451** — `_delta_base_branch = base_branch or "main"` duplicates the bare-branch-name computation that already lives inside `_resolve_origin_ref(base_branch)` (which strips the `origin/` prefix if callers double-prefix). Could derive the fetch target from `_base_ref` (e.g. `_base_ref.removeprefix("origin/")`) to have a single source of truth, but the current form is clearer and more obvious to readers; no bug. +- **pipelines.py:3455** — the directive text says "commits from `` that were merged into the PR branch since your last review". Strictly, `--not origin/` excludes **all** commits reachable from `origin/`, not only those merged since last review. The user-facing phrasing is a minor simplification but it conveys the right intent for LLM reviewers. Not blocking. + +````yaml +id: 36104541-4a14-43 +phase: implement +metadata: + payload: + artifact_references: + - orchestrator/routes/pipelines.py + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh + - .github/workflows/reusable-review.yml + reason: "Reviewed all 5 files in coder's commit 3898fc6bd. Verified the implementation\ + \ against contract tasks 1-1 through 1-4 and against my own test updates (tests\ + \ pass).\n\n### Correctness (all clean)\n- **orchestrator/routes/pipelines.py:3297**\ + \ \u2014 `diff_command` ternary now emits `f\"git log {last_reviewed_commit}..HEAD\ + \ --not {_base_ref} -p\"` only when `is_delta_review` is true; cycle-1 three-dot\ + \ `git diff {_base_ref}...HEAD` branch preserved exactly. `_base_ref = _resolve_origin_ref(base_branch)`\ + \ correctly resolves to `origin/main` (or `origin/` for non-default bases)\ + \ \u2014 verified by `test_delta_review_with_non_default_base_branch` which\ + \ exercises `base_branch=\"develop\"` and asserts `origin/develop` lands in\ + \ the prompt.\n- **orchestrator/routes/pipelines.py:3448** \u2014 Delta Review\ + \ directive rewritten to name the new `git log ... --not {_base_ref} -p` command\ + \ and adds a `git fetch origin {_delta_base_branch}` nudge. `_delta_base_branch\ + \ = base_branch or \"main\"` correctly yields the bare branch name for the fetch\ + \ target. The directive text clearly explains why the command excludes merged-in\ + \ base-branch work.\n- **action/build-review-prompt.sh, build-agent-mode-design-review-prompt.sh,\ + \ build-contract-verification-prompt.sh** \u2014 all three accept `BASE_REF`\ + \ via `local base_ref=\"${BASE_REF:-main}\"`; re-review step 1 is the two-part\ + \ instruction `git fetch origin ${base_ref}` then `git log ${LAST_REVIEW_COMMIT}..HEAD\ + \ --not origin/${base_ref} -p`. Initial-review branch untouched in all three.\ + \ File header BASE_REF block is documented identically across all three, with\ + \ the #1758 cross-reference.\n- **.github/workflows/reusable-review.yml:365**\ + \ \u2014 new `base-ref` output from `jq -r '.base.ref'` on existing `pr_json`,\ + \ plumbed through to the prompt-builder step's env at L497 as `BASE_REF: ${{\ + \ steps.pr-meta.outputs.base-ref }}`. No consumer-workflow edits needed. jq\ + \ expression reuses the already-fetched `$pr_json` \u2014 no extra API call.\n\ + \n### Security\n- Shell variables for `base_ref` and `LAST_REVIEW_COMMIT` are\ + \ consistently quoted in prompt text. The prompt is text only \u2014 not executed\ + \ from this code path \u2014 so there's no command-injection surface introduced\ + \ here.\n- The jq output on a non-main base still lands inside a double-quoted\ + \ env var in YAML, and BASE_REF is substituted into shell variables via `${BASE_REF:-main}`\ + \ \u2014 no injection path.\n- `shellcheck` passes clean on all three scripts\ + \ (full `make lint` is clean).\n\n### Verification\n- All 369 focused tests\ + \ pass (`tests/action/` + `orchestrator/tests/test_pipeline_prompts.py`), including\ + \ my new non-default-base regression tests.\n- `make lint` passes: ruff check\ + \ / format / mypy / shellcheck / custom checks all green.\n- Cycle-1 three-dot\ + \ form (`git diff origin/...HEAD`) and initial-review path are verified\ + \ untouched by passing regression tests (`test_base_branch_produces_correct_diff_command`,\ + \ `test_no_base_branch_falls_back_to_origin_main`, etc.)\n\n### Non-blocking\n\ + - **orchestrator/routes/pipelines.py:3451** \u2014 `_delta_base_branch = base_branch\ + \ or \"main\"` duplicates the bare-branch-name computation that already lives\ + \ inside `_resolve_origin_ref(base_branch)` (which strips the `origin/` prefix\ + \ if callers double-prefix). Could derive the fetch target from `_base_ref`\ + \ (e.g. `_base_ref.removeprefix(\"origin/\")`) to have a single source of truth,\ + \ but the current form is clearer and more obvious to readers; no bug.\n- **pipelines.py:3455**\ + \ \u2014 the directive text says \"commits from `` that were merged\ + \ into the PR branch since your last review\". Strictly, `--not origin/`\ + \ excludes **all** commits reachable from `origin/`, not only those merged\ + \ since last review. The user-facing phrasing is a minor simplification but\ + \ it conveys the right intent for LLM reviewers. Not blocking." + version: 1 +```` + +### [2026-04-22T23:52:47Z] orchestrator → coder (STATUS): All reviewers have ACKed — ready to confirm + +All assigned reviewers have ACKed your proposal (version 1). Run `egg-orch consensus confirmed` to confirm. + +````yaml +id: 8b79b592-36ca-44 +phase: implement +metadata: + fully_acked: true + version: 1 +```` + +### [2026-04-22T23:52:55Z] coder (CONSENSUS_CONFIRMED): Confirmed by coder + +````yaml +id: b7e1cf96-211b-49 +phase: implement +metadata: + consensus_reached: false +```` + +### [2026-04-22T23:52:59Z] tester (CONSENSUS_CONFIRMED): Confirmed by tester + +````yaml +id: b7d4b803-6c07-4b +phase: implement +metadata: + consensus_reached: true +```` diff --git a/.egg-state/contracts/issue-1758.json b/.egg-state/contracts/issue-1758.json new file mode 100644 index 0000000000..b93c0fba20 --- /dev/null +++ b/.egg-state/contracts/issue-1758.json @@ -0,0 +1,254 @@ +{ + "schemaVersion": "1.0", + "issue": { + "number": 1758, + "title": "Issue #1758", + "url": "https://github.com/jwbron/egg/issues/1758" + }, + "pipeline_id": "issue-1758", + "current_phase": "refine", + "acceptance_criteria": [], + "phases": [ + { + "id": "phase-1", + "name": "Implement", + "status": "pending", + "review_cycles": 0, + "max_cycles": 3, + "escalated": false, + "escalation_reason": null, + "tasks": [ + { + "id": "task-1-1", + "description": "In `orchestrator/routes/pipelines.py:_build_review_prompt()` (~L3297), replace the `is_delta_review` branch of `diff_command` with `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p`. Leave the cycle-1 three-dot `git diff {_base_ref}...HEAD` branch unchanged.", + "status": "complete", + "commit": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "checkpoint_id": null, + "notes": "", + "acceptance_criteria": "Cycle > 1 with `last_reviewed_commit` set produces `git log ..HEAD --not origin/ -p`; cycle 1 still produces the three-dot `git diff origin/...HEAD`.", + "files_affected": [ + "orchestrator/routes/pipelines.py" + ], + "role": null, + "review_cycles": 0, + "max_cycles": 3, + "escalated": false + }, + { + "id": "task-1-2", + "description": "In `orchestrator/routes/pipelines.py` (~L3448), update the \"Delta Review\" directive text to reference the new `git log \u2026 --not {_base_ref} -p` command (using the already-resolved `_base_ref`) and add a `git fetch origin {base_branch}` nudge before it.", + "status": "complete", + "commit": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "checkpoint_id": null, + "notes": "", + "acceptance_criteria": "The Delta Review section of the generated prompt names the new command form and includes a `git fetch origin ` instruction.", + "files_affected": [ + "orchestrator/routes/pipelines.py" + ], + "role": null, + "review_cycles": 0, + "max_cycles": 3, + "escalated": false + }, + { + "id": "task-1-3", + "description": "In each of `action/build-review-prompt.sh` (~L142), `action/build-agent-mode-design-review-prompt.sh` (~L92), and `action/build-contract-verification-prompt.sh` (~L106): accept a new `BASE_REF` env var defaulting to `main` (`local base_ref=\"${BASE_REF:-main}\"`); replace the `git diff ${LAST_REVIEW_COMMIT}..HEAD` instruction with a two-part instruction \u2014 first `git fetch origin ${base_ref}`, then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`; document `BASE_REF` in the file header comment block. The initial-review (no `LAST_REVIEW_COMMIT`) branch is not touched.", + "status": "complete", + "commit": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "checkpoint_id": null, + "notes": "", + "acceptance_criteria": "Running any of the three scripts with `LAST_REVIEW_COMMIT=abc123 BASE_REF=main` produces a prompt that includes `git fetch origin main` and `git log abc123..HEAD --not origin/main -p`, and does not contain `git diff abc123..HEAD`.", + "files_affected": [ + "action/build-review-prompt.sh", + "action/build-agent-mode-design-review-prompt.sh", + "action/build-contract-verification-prompt.sh" + ], + "role": null, + "review_cycles": 0, + "max_cycles": 3, + "escalated": false + }, + { + "id": "task-1-4", + "description": "In `.github/workflows/reusable-review.yml`, extend the `pr-meta` step (~L344-365) to emit a `base-ref` output from the existing `pr_json` jq pipeline (add `echo \"base-ref=$(echo \"$pr_json\" | jq -r '.base.ref')\"` alongside the existing head-ref/head-repo/head-sha lines). Then in the \"Build review prompt from trusted main branch\" step (~L487-494), add `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` to the `env:` block. No changes needed to consumer workflows \u2014 plumbing is internal to `reusable-review.yml`.", + "status": "complete", + "commit": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "checkpoint_id": null, + "notes": "", + "acceptance_criteria": "A workflow run of `reusable-review.yml` sets `BASE_REF` to the PR's actual base branch when invoking the prompt-builder step. For a PR targeting main, `BASE_REF=main`. For a PR targeting a non-main branch, `BASE_REF` is that branch name.", + "files_affected": [ + ".github/workflows/reusable-review.yml" + ], + "role": null, + "review_cycles": 0, + "max_cycles": 3, + "escalated": false + }, + { + "id": "task-1-5", + "description": "Update `tests/action/test_build_review_prompt.py`, `tests/action/test_build_agent_mode_design_review_prompt.py`, and `tests/action/test_build_contract_verification_prompt.py`: replace existing re-review assertions that check for `git diff ..HEAD` (e.g. `test_build_review_prompt.py:169`) with assertions that look for `git log ..HEAD --not origin/main -p` and `git fetch origin main`; extend the test helpers (`run_build_*_prompt`) to accept a `base_ref` kwarg that sets `BASE_REF` in the env; add one new test per file that passes `base_ref=\"develop\"` and asserts the generated prompt contains `git fetch origin develop` and `git log ..HEAD --not origin/develop -p`. Ensure no test still asserts the old two-dot `git diff` form on the re-review path. Initial-review tests stay as-is.", + "status": "pending", + "commit": "445b189cb", + "checkpoint_id": null, + "notes": "", + "acceptance_criteria": "The three test files pass under `pytest tests/action/`. No test still asserts `git diff ..HEAD` on the re-review path.", + "files_affected": [ + "tests/action/test_build_review_prompt.py", + "tests/action/test_build_agent_mode_design_review_prompt.py", + "tests/action/test_build_contract_verification_prompt.py" + ], + "role": null, + "review_cycles": 0, + "max_cycles": 3, + "escalated": false + }, + { + "id": "task-1-6", + "description": "Update `orchestrator/tests/test_pipeline_prompts.py` wherever it asserts the content of `_build_review_prompt`'s delta branch (cycle > 1 with `last_reviewed_commit` set): replace `git diff ..HEAD` assertions with `git log ..HEAD --not origin/ -p`; assert the Delta Review directive references the new command plus the `git fetch origin ` nudge. Add a test that calls `_build_review_prompt(..., review_cycle=2, last_reviewed_commit=\"\", base_branch=\"develop\", ...)` and asserts the emitted command uses `origin/develop`, not `origin/main`. Cycle-1 tests asserting `git diff origin/main...HEAD` stay unchanged.", + "status": "pending", + "commit": "445b189cb", + "checkpoint_id": null, + "notes": "", + "acceptance_criteria": "`pytest orchestrator/tests/test_pipeline_prompts.py` passes and the new non-default-base test fails if `base_branch` isn't correctly threaded through.", + "files_affected": [ + "orchestrator/tests/test_pipeline_prompts.py" + ], + "role": null, + "review_cycles": 0, + "max_cycles": 3, + "escalated": false + } + ], + "dependencies": [], + "commit": null, + "review_feedback": [] + } + ], + "decisions": [], + "workflow_owner": null, + "audit_log": [ + { + "timestamp": "2026-04-22T23:39:28.465108Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.0.status", + "old_value": "pending", + "new_value": "complete", + "reason": "Marked task-1-1 as complete", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:28.470004Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.0.commit", + "old_value": null, + "new_value": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "reason": "Linked commit 3898fc6 to task-1-1", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:28.650338Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.1.status", + "old_value": "pending", + "new_value": "complete", + "reason": "Marked task-1-2 as complete", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:28.655308Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.1.commit", + "old_value": null, + "new_value": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "reason": "Linked commit 3898fc6 to task-1-2", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:28.834105Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.2.status", + "old_value": "pending", + "new_value": "complete", + "reason": "Marked task-1-3 as complete", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:28.838148Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.2.commit", + "old_value": null, + "new_value": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "reason": "Linked commit 3898fc6 to task-1-3", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:29.018574Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.3.status", + "old_value": "pending", + "new_value": "complete", + "reason": "Marked task-1-4 as complete", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:39:29.023244Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.3.commit", + "old_value": null, + "new_value": "3898fc6bd508785cf61125fcc21a353d037a98e0", + "reason": "Linked commit 3898fc6 to task-1-4", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:50:46.048717Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.4.commit", + "old_value": null, + "new_value": "445b189cb", + "reason": "Linked commit 445b189 to task-1-5", + "checkpoint_id": null + }, + { + "timestamp": "2026-04-22T23:50:46.249662Z", + "actor": "egg", + "role": "implementer", + "action": "update", + "field_path": "phases.0.tasks.5.commit", + "old_value": null, + "new_value": "445b189cb", + "reason": "Linked commit 445b189 to task-1-6", + "checkpoint_id": null + } + ], + "refine_review_cycles": 0, + "refine_review_feedback": "", + "plan_review_cycles": 0, + "plan_review_feedback": "", + "pr": { + "title": "Fix #1758: exclude base-branch commits from re-review deltas", + "description": "Re-review prompts used `git diff ${LAST_REVIEW_COMMIT}..HEAD`, a snapshot diff that includes any base-branch merge that landed between the last review and HEAD. This caused reviewers to attribute merged-in work to the PR author (see issue #1758 for a concrete example on PR #1692).\n\nSwitches all five affected call sites (three GHA prompt builders plus two in `orchestrator/routes/pipelines.py:_build_review_prompt`) to `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p`, which explicitly excludes commits reachable from the base branch. Shell scripts accept a new `BASE_REF` env var (default `main`); `reusable-review.yml` plumbs the real base ref from its existing `pr-meta` step. Cycle-1 full-PR reviews are unchanged.", + "test_plan": "- Automated: `pytest tests/action/test_build_review_prompt.py tests/action/test_build_agent_mode_design_review_prompt.py tests/action/test_build_contract_verification_prompt.py orchestrator/tests/test_pipeline_prompts.py` \u2014 all re-review assertions updated, plus new non-default-base-ref coverage\n- Automated: `make test` \u2014 full suite passes\n- Manual: trigger a re-review on a PR that has a base-branch merge commit since the last review (either via the GHA bots or a BRC re-review cycle) and confirm the reviewer sees only PR-authored commits in the delta, not the merged-in base-branch work", + "manual_steps": "Pre-merge: none\nPost-merge: monitor the next few automated re-reviews (especially on PRs that have merged main during their lifecycle) for a few days to confirm the attribution issue is gone" + }, + "feedback": null, + "phase_configs": null, + "agent_executions": [] +} diff --git a/.egg-state/drafts/1758-analysis.md b/.egg-state/drafts/1758-analysis.md new file mode 100644 index 0000000000..2a0460abf8 --- /dev/null +++ b/.egg-state/drafts/1758-analysis.md @@ -0,0 +1,69 @@ +# Analysis — Re-review delta includes commits merged in from the base branch + +## Problem Statement + +When an automated reviewer (`egg-reviewer`, `agent-mode-design`, `contract-verify`, or the in-pipeline BRC reviewers) re-reviews a PR after a base-branch merge has landed on the PR branch, the reviewer treats the merged-in base-branch work as part of the PR's delta and writes review text that blames the PR author for code that actually shipped on another PR. + +**Concrete example**: PR #1692 review #4143938728 — the agent-mode reviewer wrote "The major new work in this delta is the babysit-pr feature (#1748 / #1756)". That feature shipped to `main` on PRs #1748/#1756 and reached PR #1692 via merge commit `76e97771`; it was not authored on the PR's branch. + +**Desired outcome**: during an incremental re-review, the reviewer sees only commits that the PR author pushed to the PR branch since the last review — not commits that arrived via a merge from the base branch. + +## Current Behavior + +Re-review prompts use a two-dot snapshot diff (`git diff ${LAST_REVIEW_COMMIT}..HEAD`) that compares the `LAST_REVIEW_COMMIT` tree to the `HEAD` tree. Any merge from base that landed in that window is reachable from `HEAD`, so its contents show up in the diff and get attributed to the PR. + +**Five affected call sites:** + +- `action/build-review-prompt.sh:142` +- `action/build-agent-mode-design-review-prompt.sh:92` +- `action/build-contract-verification-prompt.sh:106` +- `orchestrator/routes/pipelines.py:3297` — delta-branch of `diff_command` in `_build_review_prompt()` +- `orchestrator/routes/pipelines.py:3448` — duplicated in the "Delta Review" directive text + +`_build_review_prompt()` is shared by sequential reviewers and concurrent BRC reviewers; the `concurrent: bool` parameter only switches verdict delivery, not the diff command. So a multi-cycle BRC review hits the same bug. + +Cycle-1 full-PR reviews already use the correct three-dot form (`git diff origin/{base}...HEAD`) and are not affected. + +**Why three-dot alone doesn't fix it**: `git diff A...HEAD` expands to `git diff $(git merge-base A HEAD)..HEAD`. When `A = LAST_REVIEW_COMMIT` is an ancestor of `HEAD`, `merge-base(A, HEAD) = A`, so three-dot collapses to two-dot. The fix must explicitly *exclude* commits reachable from the base branch. + +## Constraints + +- **Shallow GHA checkouts.** The PR-code checkout in `.github/workflows/reusable-review.yml:496-501` uses `actions/checkout@v4` with default depth. `origin/` may not be present without an explicit `git fetch origin `. The new prompt must instruct the reviewer to fetch, or the command will fail. +- **Orchestrator worktrees already maintain `origin/`** (cycle-1 relies on it today, line 3299). +- **Non-default base branches.** The GHA scripts currently hard-code no base awareness. `reusable-review.yml` must plumb the real base ref through an env var so PRs targeting anything other than `main` still work. +- **Trusted-main checkout for prompt building** (`reusable-review.yml:481-485`). Shell-script changes are picked up via the trusted-main checkout — no PR-checkout attack surface. +- **Backwards compatibility.** `BASE_REF` defaults to `main` so deployed workflows continue to function during rollout. +- **Cycle-1 full-PR reviews stay untouched.** Only the `is_delta_review` / re-review code path changes. + +## Options Considered + +**Option A — Per-commit patch series (selected)** +Replace `git diff ${LAST_REVIEW_COMMIT}..HEAD` with `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p` at all five sites. Add a `git fetch origin ${BASE_REF}` nudge to the three GHA scripts (shallow checkout). Plumb `BASE_REF` through `reusable-review.yml`'s existing `pr-meta` step. +- **Pros**: Explicitly excludes base-branch commits; per-commit framing gives author/message context; smallest diff; matches issue's prescribed fix. +- **Cons**: Output shape changes from aggregated diff to per-commit patch series (LLM reviewers handle both). Requires `origin/` fetched. + +**Option B — Semantic delta via reconstructed PR-side trees** +- **Pros**: Single aggregated diff preserves output shape. +- **Cons**: Significantly more complex to express as a shell/git command. Fragile on merge topologies with conflict resolution. + +**Option C — Inline hybrid with revision pathspec** +- **Pros**: Preserves single-diff output. +- **Cons**: Fragile: breaks on non-contiguous PR commits in the DAG. Doesn't actually *exclude* base-branch content on merge-in-the-middle topologies. + +## Decisions (resolved) + +| # | Decision | Resolution | +|---|---|---| +| 1 | Output format for re-review delta | Per-commit `git log ..HEAD --not origin/ -p` (Option A) | +| 2 | Orchestrator `git fetch origin ` nudge | Add it — mirror the GHA fix for safety | +| 3 | `BASE_REF` default when unset | Default to `main` (status quo) | + +## Open Questions (resolved) + +- **Q1 — Retract old reviews written against the buggy command on open PRs?** No. Strictly forward-only; don't retroactively flag or retract. +- **Q2 — Objection to per-commit output on long PRs (>30 commits)?** No objection. Per-commit format is fine for large PRs. Don't add commit-count caps. +- **Q3 — Non-default base branches today?** No egg PRs target non-main today, but `BASE_REF` plumbing still matters — other repos using this system will have long-lived branches or chained PRs. Keep the plumbing and the non-default-base test case (`develop`). + +## Complexity + +**Medium.** Six tasks across four file classes, single phase, no architectural decisions beyond what's already settled. Changes are mechanical once the command form is approved; non-trivial bit is the `BASE_REF` plumbing through `reusable-review.yml`. \ No newline at end of file diff --git a/.egg-state/drafts/1758-plan.md b/.egg-state/drafts/1758-plan.md new file mode 100644 index 0000000000..b1d7acec6e --- /dev/null +++ b/.egg-state/drafts/1758-plan.md @@ -0,0 +1,85 @@ +# Plan: Exclude base-branch commits from re-review deltas + +## Summary + +Re-review prompts use `git diff ${LAST_REVIEW_COMMIT}..HEAD` — a two-dot snapshot diff that wrongly includes any base-branch merge that landed between the last review and HEAD. Switch all five affected call sites to `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p`, which explicitly excludes commits reachable from the base branch. Three GHA shell scripts accept a new `BASE_REF` env var (default `main`); `reusable-review.yml` plumbs the real base ref from its existing `pr-meta` step. Cycle-1 full-PR reviews (three-dot `git diff origin/{base}...HEAD`) are untouched. + +Approach rationale: Option A (per-commit patch series with `--not origin/`) beats Option B (reconstructing PR-side trees) on simplicity and correctness; three-dot alone doesn't work because `merge-base(LAST_REVIEW_COMMIT, HEAD) = LAST_REVIEW_COMMIT`. + +**Risks / edge cases**: GHA PR-code checkouts are shallow — updated prompts must `git fetch origin ${BASE_REF}` before the log command. Orchestrator worktrees already maintain `origin/` (cycle-1 relies on it today). Output format shifts from aggregated diff to per-commit patch series — LLM reviewers handle both. `BASE_REF` defaults to `main` for backward compat. Non-default bases are plumbed internally in `reusable-review.yml` — no consumer-workflow edits needed. + +## Implementation + +### Phase 1: Implement + +Five file-classes, six mechanical tasks. Cycle-1 full-PR review paths are untouched throughout. + +**Tasks**: + +1. **[task-1-1]** In `orchestrator/routes/pipelines.py` `_build_review_prompt()` (~L3297), replace the `is_delta_review` branch of `diff_command` with `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p`. Leave the cycle-1 three-dot `git diff {_base_ref}...HEAD` branch unchanged. Acceptance: cycle > 1 with `last_reviewed_commit` set emits the new command form; cycle 1 still emits three-dot. + +2. **[task-1-2]** In `orchestrator/routes/pipelines.py` (~L3448), update the "Delta Review" directive text to reference the new `git log … --not {_base_ref} -p` command and add a `git fetch origin {base_branch}` nudge before it. Acceptance: Delta Review section names the new command and includes the fetch instruction. + +3. **[task-1-3]** In each of `action/build-review-prompt.sh` (~L142), `action/build-agent-mode-design-review-prompt.sh` (~L92), and `action/build-contract-verification-prompt.sh` (~L106): accept `BASE_REF` env var (`local base_ref="${BASE_REF:-main}"`); replace the `git diff ${LAST_REVIEW_COMMIT}..HEAD` instruction with `git fetch origin ${base_ref}` followed by `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`; document `BASE_REF` in the file header. Initial-review path untouched. Acceptance: all three scripts with `LAST_REVIEW_COMMIT=abc123 BASE_REF=main` produce prompts containing both new commands and no `git diff abc123..HEAD`. + +4. **[task-1-4]** In `.github/workflows/reusable-review.yml`, extend the `pr-meta` step (~L344-365) to emit `base-ref` from the existing `pr_json` jq pipeline (`echo "base-ref=$(echo "$pr_json" | jq -r '.base.ref')"`). Pass `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` into the "Build review prompt from trusted main branch" step's `env:` block (~L487-494). No consumer-workflow changes. Acceptance: a workflow run sets `BASE_REF` to the PR's actual base branch when invoking prompt-build. + +5. **[task-1-5]** Update `tests/action/test_build_review_prompt.py`, `tests/action/test_build_agent_mode_design_review_prompt.py`, `tests/action/test_build_contract_verification_prompt.py`: replace re-review assertions that check for `git diff ..HEAD` with assertions for `git log ..HEAD --not origin/main -p` and `git fetch origin main`; extend test helpers to accept a `base_ref` kwarg; add one test per file that passes `base_ref="develop"` and asserts `origin/develop` appears in the prompt. Initial-review tests unchanged. Acceptance: `pytest tests/action/` passes; no test still asserts `git diff ..HEAD` on the re-review path. + +6. **[task-1-6]** Update `orchestrator/tests/test_pipeline_prompts.py`: replace delta-branch `git diff ..HEAD` assertions with `git log ..HEAD --not origin/ -p`; assert Delta Review directive references the new command plus fetch nudge; add a test that calls `_build_review_prompt(..., review_cycle=2, last_reviewed_commit="", base_branch="develop", ...)` and asserts `origin/develop` appears. Cycle-1 assertions unchanged. Acceptance: `pytest orchestrator/tests/test_pipeline_prompts.py` passes; new non-default-base test fails if `base_branch` isn't threaded through. + +```yaml +# yaml-tasks +pr: + title: "Fix #1758: exclude base-branch commits from re-review deltas" + description: | + Re-review prompts used `git diff ${LAST_REVIEW_COMMIT}..HEAD`, a snapshot diff that includes any base-branch merge that landed between the last review and HEAD. This caused reviewers to attribute merged-in work to the PR author (see issue #1758 for a concrete example on PR #1692). + + Switches all five affected call sites (three GHA prompt builders plus two in `orchestrator/routes/pipelines.py:_build_review_prompt`) to `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p`, which explicitly excludes commits reachable from the base branch. Shell scripts accept a new `BASE_REF` env var (default `main`); `reusable-review.yml` plumbs the real base ref from its existing `pr-meta` step. Cycle-1 full-PR reviews are unchanged. + test_plan: | + - Automated: `pytest tests/action/test_build_review_prompt.py tests/action/test_build_agent_mode_design_review_prompt.py tests/action/test_build_contract_verification_prompt.py orchestrator/tests/test_pipeline_prompts.py` — all re-review assertions updated, plus new non-default-base-ref coverage + - Automated: `make test` — full suite passes + - Manual: trigger a re-review on a PR that has a base-branch merge commit since the last review (either via the GHA bots or a BRC re-review cycle) and confirm the reviewer sees only PR-authored commits in the delta, not the merged-in base-branch work + manual_steps: | + Pre-merge: none + Post-merge: monitor the next few automated re-reviews (especially on PRs that have merged main during their lifecycle) for a few days to confirm the attribution issue is gone +phases: + - id: 1 + name: Implement + goal: "Replace two-dot re-review diffs with a base-excluding `git log --not origin/ -p` at all five call sites; plumb BASE_REF through GHA; update tests." + tasks: + - id: task-1-1 + description: "In `orchestrator/routes/pipelines.py:_build_review_prompt()` (~L3297), replace the `is_delta_review` branch of `diff_command` with `git log {last_reviewed_commit}..HEAD --not {_base_ref} -p`. Leave the cycle-1 three-dot `git diff {_base_ref}...HEAD` branch unchanged." + acceptance: "Cycle > 1 with `last_reviewed_commit` set produces `git log ..HEAD --not origin/ -p`; cycle 1 still produces the three-dot `git diff origin/...HEAD`." + files: + - orchestrator/routes/pipelines.py + - id: task-1-2 + description: "In `orchestrator/routes/pipelines.py` (~L3448), update the \"Delta Review\" directive text to reference the new `git log … --not {_base_ref} -p` command (using the already-resolved `_base_ref`) and add a `git fetch origin {base_branch}` nudge before it." + acceptance: "The Delta Review section of the generated prompt names the new command form and includes a `git fetch origin ` instruction." + files: + - orchestrator/routes/pipelines.py + - id: task-1-3 + description: "In each of `action/build-review-prompt.sh` (~L142), `action/build-agent-mode-design-review-prompt.sh` (~L92), and `action/build-contract-verification-prompt.sh` (~L106): accept a new `BASE_REF` env var defaulting to `main` (`local base_ref=\"${BASE_REF:-main}\"`); replace the `git diff ${LAST_REVIEW_COMMIT}..HEAD` instruction with a two-part instruction — first `git fetch origin ${base_ref}`, then `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p`; document `BASE_REF` in the file header comment block. The initial-review (no `LAST_REVIEW_COMMIT`) branch is not touched." + acceptance: "Running any of the three scripts with `LAST_REVIEW_COMMIT=abc123 BASE_REF=main` produces a prompt that includes `git fetch origin main` and `git log abc123..HEAD --not origin/main -p`, and does not contain `git diff abc123..HEAD`." + files: + - action/build-review-prompt.sh + - action/build-agent-mode-design-review-prompt.sh + - action/build-contract-verification-prompt.sh + - id: task-1-4 + description: "In `.github/workflows/reusable-review.yml`, extend the `pr-meta` step (~L344-365) to emit a `base-ref` output from the existing `pr_json` jq pipeline (add `echo \"base-ref=$(echo \"$pr_json\" | jq -r '.base.ref')\"` alongside the existing head-ref/head-repo/head-sha lines). Then in the \"Build review prompt from trusted main branch\" step (~L487-494), add `BASE_REF: ${{ steps.pr-meta.outputs.base-ref }}` to the `env:` block. No changes needed to consumer workflows — plumbing is internal to `reusable-review.yml`." + acceptance: "A workflow run of `reusable-review.yml` sets `BASE_REF` to the PR's actual base branch when invoking the prompt-builder step. For a PR targeting main, `BASE_REF=main`. For a PR targeting a non-main branch, `BASE_REF` is that branch name." + files: + - .github/workflows/reusable-review.yml + - id: task-1-5 + description: "Update `tests/action/test_build_review_prompt.py`, `tests/action/test_build_agent_mode_design_review_prompt.py`, and `tests/action/test_build_contract_verification_prompt.py`: replace existing re-review assertions that check for `git diff ..HEAD` (e.g. `test_build_review_prompt.py:169`) with assertions that look for `git log ..HEAD --not origin/main -p` and `git fetch origin main`; extend the test helpers (`run_build_*_prompt`) to accept a `base_ref` kwarg that sets `BASE_REF` in the env; add one new test per file that passes `base_ref=\"develop\"` and asserts the generated prompt contains `git fetch origin develop` and `git log ..HEAD --not origin/develop -p`. Ensure no test still asserts the old two-dot `git diff` form on the re-review path. Initial-review tests stay as-is." + acceptance: "The three test files pass under `pytest tests/action/`. No test still asserts `git diff ..HEAD` on the re-review path." + files: + - tests/action/test_build_review_prompt.py + - tests/action/test_build_agent_mode_design_review_prompt.py + - tests/action/test_build_contract_verification_prompt.py + - id: task-1-6 + description: "Update `orchestrator/tests/test_pipeline_prompts.py` wherever it asserts the content of `_build_review_prompt`'s delta branch (cycle > 1 with `last_reviewed_commit` set): replace `git diff ..HEAD` assertions with `git log ..HEAD --not origin/ -p`; assert the Delta Review directive references the new command plus the `git fetch origin ` nudge. Add a test that calls `_build_review_prompt(..., review_cycle=2, last_reviewed_commit=\"\", base_branch=\"develop\", ...)` and asserts the emitted command uses `origin/develop`, not `origin/main`. Cycle-1 tests asserting `git diff origin/main...HEAD` stay unchanged." + acceptance: "`pytest orchestrator/tests/test_pipeline_prompts.py` passes and the new non-default-base test fails if `base_branch` isn't correctly threaded through." + files: + - orchestrator/tests/test_pipeline_prompts.py +``` diff --git a/.github/workflows/reusable-review.yml b/.github/workflows/reusable-review.yml index 0c4349b3e6..bd2bbb399e 100644 --- a/.github/workflows/reusable-review.yml +++ b/.github/workflows/reusable-review.yml @@ -362,6 +362,7 @@ jobs: echo "head-ref=$(echo "$pr_json" | jq -r '.head.ref')" echo "head-repo=$(echo "$pr_json" | jq -r '.head.repo.full_name')" echo "head-sha=${current_sha}" + echo "base-ref=$(echo "$pr_json" | jq -r '.base.ref')" } >> "$GITHUB_OUTPUT" # Capture last bot review info before dismissing (for re-review context) @@ -492,6 +493,7 @@ jobs: PR_NUMBER: ${{ env.PR_NUMBER }} LAST_REVIEW_COMMIT: ${{ steps.last-review.outputs.commit-sha }} COMMIT_SHA: ${{ steps.pr-meta.outputs.head-sha }} + BASE_REF: ${{ steps.pr-meta.outputs.base-ref }} - name: Checkout PR code for review uses: actions/checkout@v4 diff --git a/action/README.md b/action/README.md index 6cc757c8e7..41b1d51518 100644 --- a/action/README.md +++ b/action/README.md @@ -28,6 +28,19 @@ This action runs the egg autonomous coding agent within GitHub Actions. It sets Prompt builders load review criteria from `shared/prompts/` (shared with the local orchestrator) with inline fallbacks for rollout safety. Repositories can override criteria via `.egg/` files (e.g., `.egg/review-rules.md`). +### Reviewer Delta / Re-Review Plumbing + +The three reviewer prompt builders — `build-review-prompt.sh`, `build-agent-mode-design-review-prompt.sh`, and `build-contract-verification-prompt.sh` — accept an optional `BASE_REF` environment variable (default `main`) in addition to `LAST_REVIEW_COMMIT`. When `LAST_REVIEW_COMMIT` is set (re-review path), the generated prompt instructs the agent to run: + +```bash +git fetch origin ${BASE_REF} +git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p +``` + +instead of a two-dot `git diff`. This shows only PR-side commits pushed since the last review and excludes any commits that reached the branch via a base-branch merge, fixing the attribution bug where merged-in base work was treated as part of the delta (see [#1758](https://github.com/jwbron/egg/issues/1758)). + +`reusable-review.yml` plumbs `BASE_REF` automatically from the PR's `base.ref` (via the `pr-meta` step), so callers do not need to set it manually. Initial-review (no `LAST_REVIEW_COMMIT`) prompts are unaffected. + ## Quick Start ```yaml diff --git a/action/build-agent-mode-design-review-prompt.sh b/action/build-agent-mode-design-review-prompt.sh index 7e958ac7ac..5481ed2c77 100755 --- a/action/build-agent-mode-design-review-prompt.sh +++ b/action/build-agent-mode-design-review-prompt.sh @@ -9,6 +9,11 @@ # GITHUB_REPOSITORY — owner/repo # RUNNER_TEMP — Temp directory for prompt file # LAST_REVIEW_COMMIT — (Optional) Commit SHA of last bot review, for re-reviews +# BASE_REF — (Optional) PR base branch name for re-review delta +# (defaults to "main"). Used to exclude base-branch +# commits from the delta via +# `git log ... --not origin/${BASE_REF} -p` +# so reviewers see only PR-authored changes (#1758). # # Output: # Sets 'prompt-file' and 'model' in $GITHUB_OUTPUT @@ -73,6 +78,7 @@ build_prompt() { local prompt local is_rereview=false + local base_ref="${BASE_REF:-main}" # Check if this is a re-review (we have a previous review commit) if [[ -n "${LAST_REVIEW_COMMIT:-}" ]]; then @@ -89,7 +95,7 @@ This is a specialized design review, NOT a general code review. A separate bot h ## Re-review Task -1. Use \`git diff ${LAST_REVIEW_COMMIT}..HEAD\` to see changes since your last review. +1. First run \`git fetch origin ${base_ref}\` to ensure the base branch ref is available, then use \`git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p\` to see changes since your last review. This excludes any \`${base_ref}\` commits that were merged into the PR branch, so you see only PR-authored changes. 2. Use \`gh pr view ${PR_NUMBER} --comments\` to check if previous feedback was addressed. 3. Focus only on the delta — don't re-review unchanged code. diff --git a/action/build-contract-verification-prompt.sh b/action/build-contract-verification-prompt.sh index 485ec6155a..2e81d996a5 100755 --- a/action/build-contract-verification-prompt.sh +++ b/action/build-contract-verification-prompt.sh @@ -12,6 +12,11 @@ # LAST_REVIEW_COMMIT — (Optional) Commit SHA of last review, for incremental verification # COMMIT_SHA — Current PR head commit SHA (for review marker) # EGG_ISSUE_NUMBER — Issue number for the contract +# BASE_REF — (Optional) PR base branch name for re-review delta +# (defaults to "main"). Used to exclude base-branch +# commits from the delta via +# `git log ... --not origin/${BASE_REF} -p` +# so reviewers see only PR-authored changes (#1758). # # Output: # Sets 'prompt-file' and 'model' in $GITHUB_OUTPUT @@ -91,6 +96,7 @@ build_prompt() { local prompt local is_rereview=false + local base_ref="${BASE_REF:-main}" # Check if this is a re-review (we have a previous review commit) if [[ -n "${LAST_REVIEW_COMMIT:-}" ]]; then @@ -103,7 +109,7 @@ This is a **re-review** — you previously verified this PR at commit \`${LAST_R Perform **incremental contract verification**. Focus on changes since your last review and verify they don't violate the contract. -1. **Review the delta**: Use \`git diff ${LAST_REVIEW_COMMIT}..HEAD\` to see what changed since your last review. +1. **Review the delta**: First run \`git fetch origin ${base_ref}\` to ensure the base branch ref is available, then use \`git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p\` to see what changed since your last review. This excludes any \`${base_ref}\` commits that were merged into the PR branch, so you see only PR-authored changes. 2. **Check contract state**: Run \`egg-contract show\` to see the current contract with all tasks and acceptance criteria. 3. **Verify new changes comply**: Ensure new code doesn't break any previously verified acceptance criteria. 4. **Verify newly completed tasks**: If any tasks were completed since last review, verify their implementation. diff --git a/action/build-review-prompt.sh b/action/build-review-prompt.sh index 8717a61e63..551e345d1c 100755 --- a/action/build-review-prompt.sh +++ b/action/build-review-prompt.sh @@ -10,6 +10,11 @@ # GITHUB_REPOSITORY — owner/repo # RUNNER_TEMP — Temp directory for prompt file # LAST_REVIEW_COMMIT — (Optional) Commit SHA of last bot review, for re-reviews +# BASE_REF — (Optional) PR base branch name for re-review delta +# (defaults to "main"). Used to exclude base-branch +# commits from the delta via +# `git log ... --not origin/${BASE_REF} -p` +# so reviewers see only PR-authored changes (#1758). # # Output: # Sets 'prompt-file' and 'model' in $GITHUB_OUTPUT @@ -127,6 +132,7 @@ build_prompt() { local prompt local is_rereview=false + local base_ref="${BASE_REF:-main}" # Check if this is a re-review (we have a previous review commit) if [[ -n "${LAST_REVIEW_COMMIT:-}" ]]; then @@ -139,7 +145,7 @@ This is a **re-review** — you previously reviewed this PR at commit \`${LAST_R Perform a **thorough review of all new changes**. Find ALL issues in the new code—do not stop after identifying a few problems. -1. **Review the delta**: Use \`git diff ${LAST_REVIEW_COMMIT}..HEAD\` to see what changed since your last review. +1. **Review the delta**: First run \`git fetch origin ${base_ref}\` to ensure the base branch ref is available, then use \`git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${base_ref} -p\` to see what changed since your last review. This excludes any commits from \`${base_ref}\` that were merged into the PR branch since your last review, so you see only PR-authored changes. 2. **Check previous feedback**: Use \`gh pr view ${PR_NUMBER} --comments\` to see previous review comments. 3. **Verify issues addressed**: Confirm that concerns from your previous review have been properly fixed, not just superficially addressed. 4. **Examine new code thoroughly**: Apply the same rigorous scrutiny to new changes as you would to an initial review. Read surrounding context, trace data flow, research when uncertain. diff --git a/docs/architecture/orchestrator.md b/docs/architecture/orchestrator.md index b0f26897b9..7fb44527ed 100644 --- a/docs/architecture/orchestrator.md +++ b/docs/architecture/orchestrator.md @@ -274,7 +274,7 @@ The orchestrator coordinates specialized agent roles across pipeline phases. Eac ### Prompt Context Scoping -Agent prompts are scoped to role-relevant context. Analysis roles (architect, task_planner, risk_analyst) receive the full issue body for problem understanding. Execution roles (tester, documenter) receive a summarized background with pointers to full context on demand. Reviewer prompts include the full changeset diff command (`git diff origin/{base_branch}...HEAD`) using the pipeline's base branch, ensuring reviewers see the complete set of changes rather than an arbitrary truncated window. The `base_branch` and pipeline `branch` are threaded through the prompt-building call chain (`_run_concurrent_phase` → `_build_agent_prompt` → `_build_review_prompt` / `_build_brc_preamble`). See [SDLC Pipeline Guide: Role-Specific Prompt Context](../guides/sdlc-pipeline.md#role-specific-prompt-context) for details. +Agent prompts are scoped to role-relevant context. Analysis roles (architect, task_planner, risk_analyst) receive the full issue body for problem understanding. Execution roles (tester, documenter) receive a summarized background with pointers to full context on demand. Reviewer prompts include the full changeset diff command (`git diff origin/{base_branch}...HEAD`) using the pipeline's base branch, ensuring reviewers see the complete set of changes rather than an arbitrary truncated window. The `base_branch` and pipeline `branch` are threaded through the prompt-building call chain (`_run_concurrent_phase` → `_build_agent_prompt` → `_build_review_prompt` / `_build_brc_preamble`). On BRC `review_cycle > 1`, `_build_review_prompt()` switches to a delta command — `git fetch origin {base_branch}` + `git log {last_reviewed_commit}..HEAD --not origin/{base_branch} -p` — so the reviewer sees only PR-side commits pushed since the last review and not commits pulled in via a base-branch merge ([#1758](https://github.com/jwbron/egg/issues/1758)). See [SDLC Pipeline Guide: Role-Specific Prompt Context](../guides/sdlc-pipeline.md#role-specific-prompt-context) for details. ## Deployment Modes diff --git a/docs/guides/concurrent-execution.md b/docs/guides/concurrent-execution.md index cc59b3812c..8e580f46e3 100644 --- a/docs/guides/concurrent-execution.md +++ b/docs/guides/concurrent-execution.md @@ -821,6 +821,17 @@ The same sync instruction is included for dual-role agents (e.g., `tester`) in t **Reviewer diff command:** Reviewers use `git diff origin/{base_branch}...HEAD` (three-dot merge-base syntax) to see the full changeset against the base branch, rather than an arbitrary truncated window. The `base_branch` is resolved from `pipeline.base_branch` or the repository's default branch. This matches the context available to PR review bots, which see the complete PR diff. +**Delta re-review command (BRC `review_cycle > 1`):** When a reviewer has already reviewed a prior proposal and the producer re-proposes at a new commit, `_build_review_prompt()` emits a *delta* command instead of the full changeset: + +```bash +git fetch origin {base_branch} +git log {last_reviewed_commit}..HEAD --not origin/{base_branch} -p +``` + +`git log A..HEAD --not origin/{base}` lists only PR-side commits that are reachable from `HEAD`, reachable since the last review at `A`, and **not** reachable from the base branch — so commits that arrived via a base-branch merge between the last review and `HEAD` are excluded. This prevents the reviewer from attributing merged-in base-branch work to the producer's delta (see [#1758](https://github.com/jwbron/egg/issues/1758)). The naive alternatives both show those merged-in changes: two-dot `git diff A..HEAD` compares the `A` tree to the `HEAD` tree directly and so naturally includes everything that landed in between, merge or not; three-dot `git diff A...HEAD` expands to `git diff $(git merge-base A HEAD)..HEAD`, and because `A` is already an ancestor of `HEAD` the merge-base collapses to `A`, so three-dot reduces to the same tree diff. + +In practice, BRC is designed to reach consensus in a single cycle, so the delta re-review path is rare for orchestrator reviewers — but the fix applies identically to all multi-cycle BRC reviews (`reviewer_code`, `reviewer_contract`, etc.) and to the GitHub Action PR/design/contract-verify review bots, which hit the re-review path more often. + ### Per-Agent Git Author Each agent commits with a role-scoped author identity for auditability: diff --git a/docs/guides/github-automation.md b/docs/guides/github-automation.md index 3454ea71be..b029874f79 100644 --- a/docs/guides/github-automation.md +++ b/docs/guides/github-automation.md @@ -59,7 +59,14 @@ and via `workflow_dispatch` with a PR number. and proceeds anyway. 3. **Re-review detection** — Searches for an `` marker in previous reviews/comments to identify the last reviewed commit. On re-review, - the agent uses `git diff ..HEAD` to focus on new changes only. + the agent uses `git log ..HEAD --not origin/ -p` (preceded by a + `git fetch origin ` nudge) to focus only on PR-side commits pushed since the + last review, while excluding any commits that reached the branch via a base-branch + merge. `` resolves to the PR's base ref (from `pr-meta` → `BASE_REF`, default + `main`), so deltas are computed against the correct upstream even on non-`main` PRs. + This prevents the reviewer from attributing merged-in base-branch work to the PR + itself (see [#1758](https://github.com/jwbron/egg/issues/1758)). First-cycle reviews + (no prior marker) still use the full-PR `git diff origin/...HEAD` form. 4. **Stale review dismissal** — Dismisses previous bot reviews before posting a new one. 5. **Trusted prompt build** — Checks out `main` (not the PR branch) to run `build-review-prompt.sh`, preventing prompt injection from malicious PRs. diff --git a/orchestrator/routes/pipelines.py b/orchestrator/routes/pipelines.py index ef29f68e74..5ea582098e 100644 --- a/orchestrator/routes/pipelines.py +++ b/orchestrator/routes/pipelines.py @@ -3562,16 +3562,27 @@ def _build_review_prompt( # Delta review: for re-reviews with a known last-reviewed commit, # instruct the reviewer to focus on the delta. + # + # Two-dot `git diff A..HEAD` would wrongly include any base-branch merges + # landed between A and HEAD. `git log A..HEAD --not origin/ -p` + # explicitly excludes commits reachable from the base branch, so the + # reviewer sees only PR-authored work (issue #1758). is_delta_review = review_cycle > 1 and last_reviewed_commit and not draft_path _base_ref = _resolve_origin_ref(base_branch) + _delta_base_branch = _base_ref.removeprefix("origin/") diff_command = ( - f"git diff {last_reviewed_commit}..HEAD" + f"git log {last_reviewed_commit}..HEAD --not {_base_ref} -p" if is_delta_review else f"git diff {_base_ref}...HEAD" ) if draft_path: lines.append(f"1. Read the draft at `{draft_path}`") + elif is_delta_review: + lines.append( + f"1. First run `git fetch origin {_delta_base_branch}`, then review " + f"the delta using `{diff_command}` (see **Delta Review** below)" + ) else: lines.append( f"1. Review the implementation using `git log --oneline -10` and `{diff_command}`" @@ -3716,8 +3727,12 @@ def _build_review_prompt( lines.append("## Delta Review\n") lines.append( f"This is review cycle {review_cycle}. Focus on new changes since your " - f"last review. Use `git diff {last_reviewed_commit}..HEAD` to see the " - "delta. Verify prior feedback was addressed AND review new code thoroughly." + f"last review. First run `git fetch origin {_delta_base_branch}` to " + f"ensure the base branch is available, then use " + f"`git log {last_reviewed_commit}..HEAD --not {_base_ref} -p` to see " + "the delta — this excludes any base-branch commits that were merged " + "in since your last review, so you only see PR-authored changes. " + "Verify prior feedback was addressed AND review new code thoroughly." ) lines.append("") diff --git a/orchestrator/tests/test_pipeline_prompts.py b/orchestrator/tests/test_pipeline_prompts.py index d23c371a42..513e787d50 100644 --- a/orchestrator/tests/test_pipeline_prompts.py +++ b/orchestrator/tests/test_pipeline_prompts.py @@ -2324,7 +2324,13 @@ def test_code_reviewer_phase_restrictions_no_contract_write(self): assert "CAN update the contract" not in prompt def test_delta_review_directive(self): - """Re-review with last_reviewed_commit includes delta review section.""" + """Re-review with last_reviewed_commit includes delta review section. + + See issue #1758: the delta directive now uses + `git log ..HEAD --not origin/ -p` (which excludes merged-in + base-branch commits) instead of the old two-dot `git diff ..HEAD` + form, and adds a `git fetch origin ` nudge. + """ prompt = _build_review_prompt( phase="implement", pipeline_id="test-pipe", @@ -2335,8 +2341,13 @@ def test_delta_review_directive(self): last_reviewed_commit="abc123", ) assert "## Delta Review" in prompt - assert "git diff abc123..HEAD" in prompt + # New base-excluding command form appears in the directive + assert "git log abc123..HEAD --not origin/main -p" in prompt + # Shallow-checkout nudge + assert "git fetch origin main" in prompt assert "cycle 2" in prompt + # Old two-dot diff form must not appear on the delta path + assert "git diff abc123..HEAD" not in prompt def test_first_review_no_delta_section(self): """First review cycle does not include delta review section.""" @@ -3111,7 +3122,9 @@ def test_none_base_branch_falls_back_to_origin_main(self): assert "HEAD~10" not in prompt def test_delta_review_still_uses_commit_sha(self): - """Delta review (cycle > 1 with last_reviewed_commit) still uses commit SHA.""" + """Delta review (cycle > 1 with last_reviewed_commit) uses commit SHA in the + new base-excluding `git log` form (issue #1758). + """ prompt = _build_review_prompt( phase="implement", pipeline_id="test-pipe", @@ -3122,9 +3135,54 @@ def test_delta_review_still_uses_commit_sha(self): last_reviewed_commit="abc123def", base_branch="main", ) - assert "git diff abc123def..HEAD" in prompt - # base_branch diff should NOT be the primary diff command for delta reviews + # The commit SHA is still the left endpoint, but the command now excludes + # commits reachable from origin/ + assert "git log abc123def..HEAD --not origin/main -p" in prompt + # Three-dot base_branch diff should NOT be the primary diff command for delta reviews assert "origin/main...HEAD" not in prompt + # The old two-dot diff form is gone + assert "git diff abc123def..HEAD" not in prompt + + def test_delta_review_with_non_default_base_branch(self): + """Delta review threads a non-main base_branch (e.g. `develop`) through + to both the diff command and the fetch nudge. Regression test for + issue #1758: without correct threading, the command would default to + `origin/main` and would still wrongly include develop-branch merges. + """ + prompt = _build_review_prompt( + phase="implement", + pipeline_id="test-pipe", + pipeline_mode="issue", + reviewer_type="code", + issue_number=100, + review_cycle=2, + last_reviewed_commit="deadbeef", + base_branch="develop", + ) + # The base ref in the command must match the PR's actual base branch + assert "git log deadbeef..HEAD --not origin/develop -p" in prompt + # The fetch nudge in the Delta Review directive must also use develop + assert "git fetch origin develop" in prompt + # origin/main must NOT appear on the delta path when the base is develop + assert "origin/main" not in prompt + # Old two-dot diff form must be gone + assert "git diff deadbeef..HEAD" not in prompt + + def test_delta_review_contract_reviewer_uses_base_branch(self): + """Contract reviewer also threads base_branch through the delta command.""" + prompt = _build_review_prompt( + phase="implement", + pipeline_id="test-pipe", + pipeline_mode="issue", + reviewer_type="contract", + issue_number=100, + review_cycle=2, + last_reviewed_commit="cafef00d", + base_branch="develop", + ) + assert "git log cafef00d..HEAD --not origin/develop -p" in prompt + assert "git fetch origin develop" in prompt + assert "git diff cafef00d..HEAD" not in prompt def test_contract_reviewer_uses_base_branch(self): """Contract reviewer also uses base_branch for diff command.""" diff --git a/shared/prompts/REVIEWER-SYNC.md b/shared/prompts/REVIEWER-SYNC.md index dc56786a06..d6b51d3e59 100644 --- a/shared/prompts/REVIEWER-SYNC.md +++ b/shared/prompts/REVIEWER-SYNC.md @@ -66,7 +66,8 @@ When updating review behavior, ensure both surfaces reflect the change: | Quality standards (be comprehensive, specific, etc.) | `action/review-conventions.md` "Comment Quality" section | `_build_review_prompt()` inline conventions | | Verdict classification (what's blocking vs non-blocking) | `action/review-conventions.md` "When to Approve vs Request Changes" | `_build_review_prompt()` "When to Use needs_revision vs approved" (sequential); `_build_brc_preamble()` ACK/NACK lifecycle (concurrent) | | Procedural review steps | `action/build-review-prompt.sh` "How to Proceed" / inline fallback "How to Review" | `_build_review_prompt()` procedural steps for code reviewer | -| Diff command | `gh pr diff` (full PR changeset) | `git diff origin/{base_branch}...HEAD` (full changeset against base) | +| Diff command (first review) | `gh pr diff` (full PR changeset) | `git diff origin/{base_branch}...HEAD` (full changeset against base) | +| Diff command (re-review / delta) | `git fetch origin ${BASE_REF}` + `git log ${LAST_REVIEW_COMMIT}..HEAD --not origin/${BASE_REF} -p` (PR-side commits only; excludes base-branch merges, see [#1758](https://github.com/jwbron/egg/issues/1758)) | `git fetch origin {base_branch}` + `git log {last_reviewed_commit}..HEAD --not origin/{base_branch} -p` (same semantics for BRC `review_cycle > 1`) | | Thoroughness emphasis | "Find ALL issues on the first pass" (build-review-prompt.sh) | "Find ALL issues on the first pass" (`_build_review_prompt()`) | | Severity classification | `shared/prompts/code-review-criteria.md` (shared) | Same file (shared) | @@ -82,3 +83,4 @@ When changing review criteria or conventions: - [ ] Verify the procedural review steps match between both surfaces - [ ] If changing verdict format: check `_build_review_prompt()` (sequential verdict JSON) and `_build_agent_prompt()` + `_build_brc_preamble()` (concurrent ACK/NACK) - [ ] If changing ACK/NACK format guidance: update the structured format in `_build_brc_preamble()` +- [ ] If changing the re-review diff command: update the three PR-reviewer builders (`action/build-review-prompt.sh`, `action/build-agent-mode-design-review-prompt.sh`, `action/build-contract-verification-prompt.sh`), the SDLC reviewer's `_build_review_prompt()` `is_delta_review` branch plus its Delta Review directive, and the `BASE_REF` plumbing in `.github/workflows/reusable-review.yml`. The first-review three-dot `git diff origin/...HEAD` is independent of the delta path. diff --git a/tests/action/test_build_agent_mode_design_review_prompt.py b/tests/action/test_build_agent_mode_design_review_prompt.py index c7d9de82e3..786b7e95c6 100644 --- a/tests/action/test_build_agent_mode_design_review_prompt.py +++ b/tests/action/test_build_agent_mode_design_review_prompt.py @@ -16,6 +16,7 @@ def run_build_prompt( github_repository: str, last_review_commit: str = "", runner_temp: str = "", + base_ref: str = "", ) -> tuple[int, str, str]: """Run build-agent-mode-design-review-prompt.sh with the given environment variables. @@ -29,6 +30,9 @@ def run_build_prompt( if last_review_commit: env["LAST_REVIEW_COMMIT"] = last_review_commit + if base_ref: + env["BASE_REF"] = base_ref + # Use a temp directory if not specified if not runner_temp: runner_temp = tempfile.gettempdir() @@ -144,7 +148,7 @@ class TestReReview: """Tests for re-review (with LAST_REVIEW_COMMIT).""" def test_generates_rereview_prompt(self) -> None: - """Re-review uses git diff from last reviewed commit.""" + """Re-review uses git log from last reviewed commit.""" with tempfile.TemporaryDirectory() as tmpdir: returncode, stdout, stderr = run_build_prompt( pr_number="123", @@ -163,8 +167,13 @@ def test_generates_rereview_prompt(self) -> None: assert "This is a **re-review**" in prompt assert "abc123def456" in prompt - def test_includes_git_diff_instruction(self) -> None: - """Re-review instructs to use git diff from last commit.""" + def test_includes_git_log_instruction(self) -> None: + """Re-review instructs to use git log that excludes base-branch commits. + + See issue #1758: the old `git diff ..HEAD` form wrongly pulled in + base-branch merges. The new `git log --not origin/ -p` form + excludes them. + """ with tempfile.TemporaryDirectory() as tmpdir: returncode, stdout, stderr = run_build_prompt( pr_number="123", @@ -175,7 +184,27 @@ def test_includes_git_diff_instruction(self) -> None: assert returncode == 0 prompt = read_prompt_file(tmpdir, "123") - assert "git diff abc123def456..HEAD" in prompt + assert "git log abc123def456..HEAD --not origin/main -p" in prompt + assert "git fetch origin main" in prompt + assert "git diff abc123def456..HEAD" not in prompt + + def test_custom_base_ref_threaded_through(self) -> None: + """Non-default base ref (e.g. `develop`) is plumbed into the prompt.""" + with tempfile.TemporaryDirectory() as tmpdir: + returncode, stdout, stderr = run_build_prompt( + pr_number="123", + github_repository="owner/repo", + last_review_commit="abc123def456", + runner_temp=tmpdir, + base_ref="develop", + ) + + assert returncode == 0, f"Script failed: {stderr}" + prompt = read_prompt_file(tmpdir, "123") + assert "git fetch origin develop" in prompt + assert "git log abc123def456..HEAD --not origin/develop -p" in prompt + assert "origin/main" not in prompt + assert "git diff abc123def456..HEAD" not in prompt def test_includes_agent_mode_design_focus(self) -> None: """Re-review includes agent-mode design focus.""" diff --git a/tests/action/test_build_contract_verification_prompt.py b/tests/action/test_build_contract_verification_prompt.py index e7d526868d..a6e76b24f4 100644 --- a/tests/action/test_build_contract_verification_prompt.py +++ b/tests/action/test_build_contract_verification_prompt.py @@ -16,6 +16,7 @@ def run_build_contract_prompt( github_repository: str, last_review_commit: str = "", runner_temp: str = "", + base_ref: str = "", ) -> tuple[int, str, str]: """Run build-contract-verification-prompt.sh with the given environment variables. @@ -29,6 +30,9 @@ def run_build_contract_prompt( if last_review_commit: env["LAST_REVIEW_COMMIT"] = last_review_commit + if base_ref: + env["BASE_REF"] = base_ref + if not runner_temp: runner_temp = tempfile.gettempdir() env["RUNNER_TEMP"] = runner_temp @@ -117,7 +121,7 @@ class TestReVerification: """Tests for re-verification (with LAST_REVIEW_COMMIT).""" def test_generates_rereview_prompt(self) -> None: - """Re-verification uses git diff from last reviewed commit.""" + """Re-verification uses git log from last reviewed commit.""" with tempfile.TemporaryDirectory() as tmpdir: returncode, stdout, stderr = run_build_contract_prompt( pr_number="50", @@ -133,8 +137,13 @@ def test_generates_rereview_prompt(self) -> None: assert "Re-verify" in prompt or "re-review" in prompt.lower() assert "abc123def456" in prompt - def test_includes_git_diff_instruction(self) -> None: - """Re-verification instructs to use git diff from last commit.""" + def test_includes_git_log_instruction(self) -> None: + """Re-verification instructs to use git log that excludes base-branch commits. + + See issue #1758: the old `git diff ..HEAD` form wrongly attributed + merged-in base-branch work to the PR author. The new + `git log --not origin/ -p` form explicitly excludes them. + """ with tempfile.TemporaryDirectory() as tmpdir: returncode, _, _ = run_build_contract_prompt( pr_number="50", @@ -145,7 +154,27 @@ def test_includes_git_diff_instruction(self) -> None: assert returncode == 0 prompt = read_prompt_file(tmpdir, "50") - assert "git diff abc123def456..HEAD" in prompt + assert "git log abc123def456..HEAD --not origin/main -p" in prompt + assert "git fetch origin main" in prompt + assert "git diff abc123def456..HEAD" not in prompt + + def test_custom_base_ref_threaded_through(self) -> None: + """Non-default base ref (e.g. `develop`) is plumbed into the prompt.""" + with tempfile.TemporaryDirectory() as tmpdir: + returncode, _, stderr = run_build_contract_prompt( + pr_number="50", + github_repository="owner/repo", + last_review_commit="abc123def456", + runner_temp=tmpdir, + base_ref="develop", + ) + + assert returncode == 0, f"Script failed: {stderr}" + prompt = read_prompt_file(tmpdir, "50") + assert "git fetch origin develop" in prompt + assert "git log abc123def456..HEAD --not origin/develop -p" in prompt + assert "origin/main" not in prompt + assert "git diff abc123def456..HEAD" not in prompt class TestRequiredVariables: diff --git a/tests/action/test_build_review_prompt.py b/tests/action/test_build_review_prompt.py index 2ae2f431b9..7e818d6f35 100644 --- a/tests/action/test_build_review_prompt.py +++ b/tests/action/test_build_review_prompt.py @@ -16,6 +16,7 @@ def run_build_review_prompt( github_repository: str, last_review_commit: str = "", runner_temp: str = "", + base_ref: str = "", ) -> tuple[int, str, str]: """Run build-review-prompt.sh with the given environment variables. @@ -29,6 +30,9 @@ def run_build_review_prompt( if last_review_commit: env["LAST_REVIEW_COMMIT"] = last_review_commit + if base_ref: + env["BASE_REF"] = base_ref + # Use a temp directory if not specified if not runner_temp: runner_temp = tempfile.gettempdir() @@ -136,7 +140,7 @@ class TestReReview: """Tests for re-review (with LAST_REVIEW_COMMIT).""" def test_generates_rereview_prompt(self) -> None: - """Re-review uses git diff from last reviewed commit.""" + """Re-review uses git log from last reviewed commit.""" with tempfile.TemporaryDirectory() as tmpdir: returncode, stdout, stderr = run_build_review_prompt( pr_number="123", @@ -154,8 +158,13 @@ def test_generates_rereview_prompt(self) -> None: assert "This is a **re-review**" in prompt assert "abc123def456" in prompt - def test_includes_git_diff_instruction(self) -> None: - """Re-review instructs to use git diff from last commit.""" + def test_includes_git_log_instruction(self) -> None: + """Re-review instructs to use git log that excludes base-branch commits. + + See issue #1758: two-dot `git diff ..HEAD` wrongly attributes + base-branch merges to the PR author. The replacement `git log` with + `--not origin/` explicitly excludes base-branch commits. + """ with tempfile.TemporaryDirectory() as tmpdir: returncode, stdout, stderr = run_build_review_prompt( pr_number="123", @@ -166,7 +175,32 @@ def test_includes_git_diff_instruction(self) -> None: assert returncode == 0 prompt = read_prompt_file(tmpdir, "123") - assert "git diff abc123def456..HEAD" in prompt + # New command form excludes base-branch commits + assert "git log abc123def456..HEAD --not origin/main -p" in prompt + # Shallow-checkout nudge + assert "git fetch origin main" in prompt + # Old two-dot diff form must not appear on the re-review path + assert "git diff abc123def456..HEAD" not in prompt + + def test_custom_base_ref_threaded_through(self) -> None: + """Non-default base ref (e.g. `develop`) is plumbed into the prompt.""" + with tempfile.TemporaryDirectory() as tmpdir: + returncode, stdout, stderr = run_build_review_prompt( + pr_number="123", + github_repository="owner/repo", + last_review_commit="abc123def456", + runner_temp=tmpdir, + base_ref="develop", + ) + + assert returncode == 0, f"Script failed: {stderr}" + prompt = read_prompt_file(tmpdir, "123") + assert "git fetch origin develop" in prompt + assert "git log abc123def456..HEAD --not origin/develop -p" in prompt + # Default `main` shouldn't leak when an explicit non-main base is set + assert "origin/main" not in prompt + # Old form still absent + assert "git diff abc123def456..HEAD" not in prompt def test_includes_check_previous_feedback(self) -> None: """Re-review instructs to check previous review comments."""