From 807b70c192ad23828efe69a8b2e18cc062e77f89 Mon Sep 17 00:00:00 2001 From: monkut Date: Sun, 26 Apr 2026 15:00:03 +0900 Subject: [PATCH 1/2] :bug: Add CHANGES_REQUESTED pre-merge guard to pr-review prompt (closes #86) The pr-review agent prompt now requires checking `gh pr view ... --jq` for unresolved CHANGES_REQUESTED reviews before any merge action. If any exist, the agent must address the requested changes, reply to inline comments, push a fix commit, and re-request review instead of merging. --- askcc/definitions.py | 6 ++++++ tests/test_askcc.py | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/askcc/definitions.py b/askcc/definitions.py index 7cfc36a..ff52f50 100644 --- a/askcc/definitions.py +++ b/askcc/definitions.py @@ -467,6 +467,12 @@ - Check out the PR branch using `gh pr checkout ` to inspect the full source. - Run the project's test suite to confirm all tests pass. +Pre-merge guard (CHANGES_REQUESTED): +- Before merging, check for unresolved CHANGES_REQUESTED reviews using \ +`gh pr view -R --json reviews --jq '[.reviews[] | select(.state == "CHANGES_REQUESTED")]'`. +- If any CHANGES_REQUESTED reviews exist, DO NOT merge. Instead, address the requested changes, \ +reply to all inline comments, push a follow-up fix commit on the PR branch, and re-request review. + Definition of Done checklist: 1. **Acceptance criteria** — verify each criterion from the issue is satisfied by the code changes. 2. **Test coverage** — new and changed logic has unit tests. Look for untested code paths. diff --git a/tests/test_askcc.py b/tests/test_askcc.py index 68bc945..2d6e2e5 100644 --- a/tests/test_askcc.py +++ b/tests/test_askcc.py @@ -13,6 +13,7 @@ from askcc.definitions import ( AGENT_CONFIGS, DEVELOP_AGENT_PROMPT, + REVIEWPR_AGENT_PROMPT, AgentAction, AgentConfig, SupportedLanguage, @@ -278,6 +279,25 @@ def test_removes_legacy_write_tests_line(self): assert "Write tests for every new or changed behavior" not in DEVELOP_AGENT_PROMPT +class TestReviewprPromptMergeGuard: + """The pr-review prompt must block merging when CHANGES_REQUESTED reviews exist (issue #86).""" + + def test_includes_changes_requested_check_command(self): + assert ( + "gh pr view -R --json reviews --jq '[.reviews[] " + '| select(.state == "CHANGES_REQUESTED")]\'' in REVIEWPR_AGENT_PROMPT + ) + + def test_includes_do_not_merge_instruction(self): + assert "DO NOT merge" in REVIEWPR_AGENT_PROMPT + + def test_includes_address_inline_comments_instruction(self): + assert "reply to all inline comments" in REVIEWPR_AGENT_PROMPT + + def test_includes_pre_merge_guard_heading(self): + assert "Pre-merge guard" in REVIEWPR_AGENT_PROMPT + + class TestWritePromptContent: def test_writes_file_with_correct_name(self): filepath = write_prompt_content("plan", "monkut", "askcc-cli", 42, "issue content here") From e69f57c379f24b98727c3421d94aa77401822311 Mon Sep 17 00:00:00 2001 From: monkut Date: Sun, 26 Apr 2026 15:58:10 +0900 Subject: [PATCH 2/2] :bookmark: Bump version to 0.2.8 --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f1f4719..c7bde45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "askcc" -version = "0.2.7" +version = "0.2.8" description = "A one-shot cc cli executor" authors = [{ name = "mknt", email = "shane.cousins@gmail.com" }] readme = "README.md" diff --git a/uv.lock b/uv.lock index 2f73f54..dc9f9d5 100644 --- a/uv.lock +++ b/uv.lock @@ -4,7 +4,7 @@ requires-python = "==3.14.*" [[package]] name = "askcc" -version = "0.2.7" +version = "0.2.8" source = { editable = "." } [package.dev-dependencies]