Repository navigation
fix(discovery): attach a PR to the item that owns its branch instead of minting a duplicate item - #852
Merged
Conversation
…of minting a duplicate item An agent that opens its own PR on its item's task/<seq>-<slug> branch never writes metadata.pr, so number-only tracking called the PR untracked and created a second item, which the supervisor then dispatched repairs against and which collided with the owner's worktree. Agentflare-Agent: claude-code Agentflare-Branch: task/337-pr-discovery-mints-a-duplicate-item-for Agentflare-Item: 337 Agentflare-Session: 10553a88-a912-4153-97c7-8d172ee44d92
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 52 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Your 51 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (1)
Comment |
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.
Stops PR discovery from minting a duplicate item for a PR whose branch a live item already owns, for item #337 . This is part 1 of that item; parts 2 and 3 are split out (see the end).
What happened (PR #849, items #330 and #334)
Item #330's agent opened its own PR with
gh pr createon itstask/330-…branch. That path never writesmetadata.pr.number, sodiscover_untracked_prs, which decides "already tracked" by PR number only, treated the PR as untracked and created a second item (#334) for it. The supervisor then dispatched CI and review repairs against #334; those jobs died in about a second becausetask/330-…is already checked out in #330's worktree, #334 gotneeds-manual-dispatch, and that label gates both the CodeRabbit repair and the merge, so a green PR sat unmerged.Change
src/worktree/discovery.rs:item_owning_branchfinds the item a PR's head branch belongs to:task/<seq>ortask/<seq>-<slug>for an item in the project, or a branch already recorded in an item'smetadata.pr.branch.attach_pr_to_itemrecords{number, branch}as that item's PR if it has none yet (through the existingmerge_item_metadata, which merges under a transaction), and discovery skips the PR: no second item, no claim comment.task/<seq>-…branch with no matching item still gets a tracking item, so another workstation's PRs are not swallowed.Tests
discover_untracked_prs_attaches_a_pr_to_the_item_that_owns_its_branchfailed first (metadata.pr.numberwasNull) and passes now.a_task_branch_with_no_matching_item_still_gets_a_tracking_itempins the other direction.-D warningsand fmt are clean.Not in this PR (follow-up item)
needs-manual-dispatch, and should route to the branch's owning item.needs-manual-dispatchshould notify instead of silently counting as skipped.Those touch the supervisor's repair-dispatch and orphan-reconcile paths and deserve their own review.
Authored for item #337 via agentflare.