Prevent duplicate PR tasks and add update-pr-description task type#262
Merged
Prevent duplicate PR tasks and add update-pr-description task type#262
Conversation
Add GetPRTaskForWork query to check for existing PR tasks for a work unit. When createPRTask is called: - If a pending/processing PR task exists, skip creation - If a completed PR task exists, create an update-pr-description task instead This prevents the review-fix loop from creating multiple PR tasks and instead updates the existing PR description when the PR has already been created. Closes: ac-8dmv.1, ac-8dmv.2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive unit tests for the createPRTask logic: - Test PR task creation when no existing PR task - Test skip behavior when pending PR task exists - Test skip behavior when processing PR task exists - Test update-pr-description creation when PR task is completed - Test that failed PR tasks allow new PR creation - Test review-fix loop creates only one PR task - Test multiple review cycles create multiple update-pr-description tasks These tests verify the duplicate PR task prevention logic and the update-pr-description task type introduced in previous commits. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Display as 'pr-upd' in work overview task list - Include in PR task count in work summary breakdown Co-Authored-By: Claude Opus 4.5 <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
This PR fixes an issue where multiple PR tasks were being created during review-fix loops, leading to duplicate work. Now:
update-pr-descriptiontask is created instead to update the existing PR's description with latest changesChanges
Core Logic (
cmd/orchestrate.go)createPRTask()to check for existing PR tasks before creating new onescreateUpdatePRDescriptionTask()for updating existing PR descriptions after subsequent reviewsDatabase Layer
sql/queries/tasks.sql: AddedGetPRTaskForWorkquery to find PR tasks by work IDinternal/db/sqlc/: Regenerated SQLC codeinternal/db/task.go: AddedGetPRTaskForWork()wrapper returning*TaskornilTests
internal/db/task_test.go: Unit tests for the new database functioncmd/orchestrate_test.go: Integration tests for PR task creation flowIssues Resolved
Test Plan
GetPRTaskForWorkdatabase functionco work reviewmultiple times on a work with an existing PR🤖 Generated with Claude Code