fix(ten-427): fall back to PR branch/title for TEN issue matching#16
Merged
lavie merged 1 commit intoMay 6, 2026
Merged
Conversation
When an agent opens a PR without backfilling the GitHub ref into the issue description, `findTenIssue`'s text search misses the parent issue and creates a spurious triage issue instead of waking the assignee. Add `extractTenIdentifierFromPR` to parse the PR's head branch name and title for a TEN-NNN identifier (e.g. `ten-334-exact-match` or `fix(ten-334): …`), and `findTenIssueByIdentifier` to look it up by exact identifier match. The fallback is tried only when the primary full-text search returns no result. Three new tests cover: branch-based match for pull_request_review, title-based match for pull_request.opened, and triage-issue creation when neither branch nor title contains a TEN identifier. Co-Authored-By: Paperclip <noreply@paperclip.ing>
lavie
approved these changes
May 6, 2026
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.
Why this change exists
When an agent opens a PR without backfilling the GitHub ref (e.g.
tensorleap/paperclip#15) into the issue description,findTenIssue's text search finds nothing and creates a spurious triage issue (like TEN-425) instead of waking the real assignee. This happened on Assaf's review of PR #15, which belongs to TEN-334 — the dispatcher couldn't connect the two and opened a triage issue.Tracked in TEN-427. Follow-up to #15.
How this PR fixes it
Two new functions are added in
worker.ts:extractTenIdentifierFromPR(payload)— scans the PR'shead.ref(branch name) and thentitlefor the pattern/\bten[_-](\d+)\b/iand returns the canonicalTEN-NNNstring. Branch is checked first because it's more structured.findTenIssueByIdentifier(ctx, companyId, identifier)— queries the issues API with the identifier asq, then filters for an exactidentifiermatch (case-insensitive) so broad text-search tokenization can't produce false positives.In
onWebhook, after the primaryfindTenIssuefull-text search returns null, the fallback fires: extract TEN identifier → look up by identifier → dispatch if found. The triage path is unchanged and still runs when the fallback also misses.Technical summary
packages/plugins/examples/plugin-github-webhook-dispatcher/src/worker.tsextractTenIdentifierFromPR(pure function, no async)findTenIssueByIdentifier(async, oneissues.listcall)onWebhookbetween primary search and triage creationtests/plugin.spec.tsPR branch/title fallbackdescribe blockVerification
New tests:
pull_request_review.submittedfor a PR with branchten-334-exact-match-issue-finderdispatches to TEN-334 (no ref in description)pull_request.openedwith titlefix(ten-334): …and non-matching branch dispatches to TEN-334chore/update-depsand titlechore: update deps(no TEN id) still creates triage issue