Repository navigation
Conversation
… the issue A merged direct PR mapped the ticket to done, and done wakes nobody, so the author never got a run for the post-merge work: closing out the work-product record and the merge handover. A PR closed without merge was cancelled the same way, with nobody asked how the work continues. When every direct PR link is terminal and the deciding PR (a merged one, else a closed one) carries a valid followThroughAssigneeAgentId, sync moves the issue to in_progress, assigns it to that owner, and wakes them once with a reason that says the PR was merged, or a separate reason for closed-without-merge. The remote-action fingerprint marks the hand-off: while the outcome is unchanged sync leaves the issue's status and assignee alone, so the owner's own close sticks. An issue already done or cancelled when sync first sees the outcome stays closed, which also keeps tickets closed by the plain done mapping from reopening. Links without an owner and mapped-repository issues keep done/cancelled. reuseOrCreatePendingWake also matches on reason, so a hand-off wake does not reuse an older pending wake's text. New tests cover merged-with-owner, merged-without-owner, closed-with-owner and already-done outcomes, including no second wake and the owner's close sticking.
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
What breaks today. When every directly linked PR is terminal, sync maps the Paperclip issue to
done(any merged) orcancelled(all closed).donewakes nobody. A follow-through owner is set on the link precisely because that agent carries the PR to the end, but they never get a run after the merge. The post-merge work is left undone: closing out the work-product record, the merge handover to whoever asked for the change, follow-up tickets. For a PR closed without merge, nobody gets a run to decide whether to reopen, replace or drop the work, and the issue is silentlycancelled.Scenario. An engineer agent opens a PR through
create_pull_request, which records them asfollowThroughAssigneeAgentId. They hand the ticket to the product owner inin_review. A maintainer merges. On the next sync the ticket goes todone, still assigned to the product owner, and no one is told. The engineer's handover note is never written, and the product owner learns of the merge only by reading the board.What changes. This applies only when the PR that decides the outcome has a valid follow-through owner. That is a merged PR if any link merged, or else a closed one. Among several, the first in repository and number order that has an owner decides.
donemapping before this change.done/cancelledmapping.reuseOrCreatePendingWakealso matches on the wake reason, so a pending status-transition wake is not reused with the wrong text.Why change a default users rely on. The
merged → donemapping stays for every link without a follow-through owner. The owner field is opt-in:create_pull_request,link_github_item, the metric endpoint and the hosted link action set it only when asked to, and it means "this agent sees the PR through". Once that agent exists, closing the ticket over their head is the surprising behaviour. The cost to a user who preferred the old mapping is one extra run in which the owner closes the ticket.Opt-out, if you want one. A company-level advanced setting such as "Close the issue when its linked PR merges", on by default for existing installs, would skip the hand-off. It costs a boolean in the advanced settings, one check in the worker, and a toggle on the settings page, about 40 lines with a test. I can add it to this PR if you prefer the old default.
Evidence
All in
tests/plugin.spec.ts:sync.runNow hands a merged or closed direct PR to its follow-through owner instead of closing the issue.done/cancelledwith 0 wakes.After: as above.
pnpm typecheckandpnpm testpass on the branch.Merge Danger
Door: two-way
Nothing is migrated. Reverting restores
merged → donefor every link. Issues handed to an owner before a revert stayin_progressuntil someone closes them.Blast Radius: owned-PR closures
This affects only open issues whose deciding terminal PR link has a follow-through owner. Those issues get one
in_progressrun for the owner instead of an immediatedone/cancelled. Dashboards that countdoneon merge see the close one agent run later.