Skip to content

feat(issue-desk): reuse existing PR for an issue instead of opening duplicates#2122

Merged
larryro merged 1 commit into
mainfrom
feat/issue-desk-dedupe-existing-prs
Jun 24, 2026
Merged

feat(issue-desk): reuse existing PR for an issue instead of opening duplicates#2122
larryro merged 1 commit into
mainfrom
feat/issue-desk-dedupe-existing-prs

Conversation

@larryro

@larryro larryro commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

The same issue can spawn several duplicate PRs (e.g. #2095#2099 / #2118 / #2120). Root cause: the implementer only checks whether the tale/<task._id> branch has a PR, never whether the issue is already being fixed by some other PR — so every desk run opens a fresh competing PR.

Changes (config/instructions only, no code)

builtin-configs/apps/issue-desk/:

implement step — dedupe before branching:

  • Discover open PRs resolving the issue — GitHub closing-reference link (GraphQL closedByPullRequestsReferences) + title/body fallback (#num) + tale/* branches.
  • Decide & set $BRANCH: our branch already has a PR → normal rework; exactly one other PR → adopt it and push onto its branch (no new PR); several → keep the furthest-along as canonical and gh pr close the redundant duplicates (with a "Superseded by #N" comment; conservative guardrails: never delete a human's branch, keep + flag any PR carrying unique work).
  • All downstream git/gh calls use $BRANCH; new PRs include Closes #num so later runs can resolve them by link.

review step:

  • Resolves the same canonical PR via the issue→PR link and checks out its head branch (was a hardcoded tale/<task._id> checkout). The PR's headRefName is the branch the implementer pushed to, so the reviewer always reviews the implementer's work.

Bumped 1.2.0 → 1.3.0; updated the workflow / app / implementer-agent descriptions.

Known limitations

  • Cross-step code is carried by the remote git branch + PR (sandboxes don't share state); both steps use the same link query so they converge on the same PR.
  • Does not handle two desks operating on the same task concurrently — that needs dedup at task-creation time (platform code), out of scope for this app.

…licates

In the issue-desk app, before branching the implementer now discovers open
PRs already resolving the issue (GitHub closing-reference link + title/body
fallback). If one exists it pushes onto that PR's branch; if several do it
keeps the furthest-along as canonical and closes the redundant duplicates.
The reviewer resolves the same canonical PR by issue link and checks out its
head branch, so it always reviews the branch the implementer pushed to.
@larryro larryro force-pushed the feat/issue-desk-dedupe-existing-prs branch from 4200d10 to 06d3ca8 Compare June 24, 2026 15:09
@larryro larryro merged commit a03e25e into main Jun 24, 2026
3 checks passed
@larryro larryro deleted the feat/issue-desk-dedupe-existing-prs branch June 24, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant