fix: make wrap_up PR action work reliably#3
Draft
Ragazoor wants to merge 9 commits into
Draft
Conversation
…ce (WP3) Migration v40 creates the `learnings` table with scope/scope_ref consistency CHECK constraint. LearningStore is a narrow sub-trait added to TaskStore. LearningService mirrors TaskService with status-transition guards and scope-consistency validation. Tests cover migration, CRUD, dispatch retrieval ordering, and all service validation paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: the wrap_up tool description said "moved to done on success" and "returns immediately in the background", both incorrect for the pr action. Agents seeing the task in Review (not Done) after a successful PR creation would retry, causing gh pr create to fail with "already exists". - create_pr: detect "already exists" stderr from gh, extract the URL, and return success — makes wrap_up pr safe to call multiple times - Correct the wrap_up tool description: blocks until done; pr action moves task to Review (not Done); mentions idempotency - Remove incorrect "code-review command will be injected" claim from skill - Rename wrap_up_pr_returns_started → wrap_up_pr_succeeds_with_complete_message - Fix stale // detect_default_branch comments in wrap_up tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ailure The pre-push hook runs `cargo clippy --fix` which refuses to run when there are uncommitted changes. When `create_pr` ran `git push` from `repo_path`, the hook saw dirty files belonging to other worktrees and failed. Fix: use the worktree path (push_dir) for both git push and remote get-url, so the hook runs in the worktree's clean context. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_pris now idempotent: ifgh pr createfails with "already exists", extracts and returns the existing PR URL instead of erroringcreate_prnow pushes from the worktree directory (not repo root) so the pre-push hook runs in the clean worktree context, avoiding spurious dirty-file failureswrap_uptool description: was "task moves to done / runs in background"; now correctly says task moves to Review and the call blocks/code-reviewcommand is injected after PR creationRoot cause
When an agent called
wrap_up pr, it saw task status change to Review (not Done as the tool description claimed) and assumed the call failed, then retried. The retry hitgh pr create's "already exists" error, which was treated as a hard failure — so the agent kept looping.Test plan
cargo test dispatch::tests::create_pr— unit tests for idempotentcreate_prand push-dir behaviourcargo test mcp::handlers::tests::wrap_up— includes newwrap_up_pr_returns_existing_url_on_duplicatetest