Skip to content

feat(agent): auto-match PRs to open GitHub Milestones (suggest-mode) #3183

Description

@JSONbored

Parent epic: #3180

Goal

Detect when a PR (even with no closing-keyword issue link) is likely part of an open GitHub Milestone, and post a bot-comment suggestion — never auto-apply in this phase.

Requirements

  • New tri-state setting autoProjectMilestoneMatch: "off" | "suggest" | "auto" (default "off"), mirroring the reviewCheckMode tri-state template (migrations/0107_repository_review_check_mode.sql, src/signals/focus-manifest.ts:1042-1057). Only "off"/"suggest" are meaningful until feat(agent): auto-match PRs to open GitHub Projects v2 (suggest-mode) #3184 lands.
  • List open milestones via GET /repos/{owner}/{repo}/milestones?state=open.
  • Match PR title/body tokens against milestone titles by reusing the existing collision-detection primitives in src/signals/engine.ts: tokenize (:5301), termOverlap (:5273) — use the same or a stricter threshold than the existing duplicate-PR gate (score >= 0.58 && shared >= 2, :865), since a wrong milestone attach corrupts tracked progress rather than just adding an advisory note.
  • Also detect a repo-configured branch-name short-code convention (e.g. <code>-<number>-<slug>) as a high-precision secondary signal — this mirrors the convention Linear's own GitHub integration already uses, so it doubles as prep for feat(agent): Linear adapter for project/milestone matching #3186 (Linear adapter).
  • In "suggest" mode: post a single bot comment naming the matched milestone and confidence; never call the milestone-set API.
  • Hook alongside the existing linked-issue evidence-gathering step (buildPullRequestAdvisory, src/queue/processors.ts:5239), not inside the hard-rule blocker path (src/review/linked-issue-hard-rules.ts:71,140) — a missed/wrong match must never fail the gate.
  • Define the ProjectTrackerAdapter interface (new file, e.g. src/integrations/project-tracker-adapter.ts) even though only the GitHub-milestone half is implemented here, so feat(agent): auto-match PRs to open GitHub Projects v2 (suggest-mode) #3184 (Projects v2) and feat(agent): Linear adapter for project/milestone matching #3186 (Linear) slot in without reshaping this code:
    interface ProjectTrackerAdapter {
      listOpenProjects(ctx): Promise<{ id: string; title: string }[]>;
      listOpenMilestones(ctx): Promise<{ id: string; title: string }[]>;
      attachToProject(ctx, prRef, projectId): Promise<AttachResult>;
      attachToMilestone(ctx, prRef, milestoneId): Promise<AttachResult>;
    }

Deliverables

  • ProjectTrackerAdapter interface + GitHubMilestonesAdapter (milestone half only).
  • Matching logic reusing engine.ts tokenize/termOverlap.
  • Suggest-mode bot comment.
  • Config: tri-state setting + .gittensory.yml parity + OpenAPI.
  • Tests: match / no-match / ambiguous-multi-match cases, both branches of the tri-state default fallback.

Expected outcome

Repos that opt in get a visible, non-blocking suggestion comment identifying which open milestone a PR probably belongs to, with zero risk of misfiled tracking data since nothing is auto-applied yet.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions