opencode-mission-control icon indicating copy to clipboard operation
opencode-mission-control copied to clipboard

feat: Auto-link GitHub issues in PRs created by mc_pr and plan orchestrator

Open nigel-dev opened this issue 9 months ago • 0 comments

Description

PRs created by Mission Control — both standalone (mc_pr) and plan (createPR()) — have no way to automatically close related GitHub issues. Users must manually edit the PR body to add Closes #N after creation.

This is a gap because:

  • Plans are often created to address specific issues (we just ran a 3-job plan for #39, #16, #36 and had to manually edit the PR to add closing refs)
  • The AI agent calling mc_pr often knows which issue it's fixing but has no parameter to express that
  • Without closing refs, issues stay open after the PR merges

Proposed Solution

mc_pr (standalone)

Add an issues parameter:

args: {
  // ... existing args
  issues: tool.schema
    .array(tool.schema.number())
    .optional()
    .describe('GitHub issue numbers to close when this PR is merged'),
}

When provided, append closing refs to the PR body:

Closes #39, closes #16, closes #36

mc_plan

Add an issues field to the plan spec:

// Top-level plan config
mc_plan(name: "recovery", issues: [39, 16, 36], jobs: [...])

Or per-job:

mc_plan(name: "recovery", jobs: [
  { name: "graceful-retry", issues: [39], ... },
  { name: "touchset-gate", issues: [16], ... },
])

The orchestrator's createPR() collects all issue numbers and adds closing refs to the PR body.

Implementation

Both approaches are straightforward:

  1. Collect issue numbers (from param or plan spec)
  2. Generate Closes #N line
  3. Insert after ## Summary in the PR body

Per-job issues could also be shown in the job status table:

| Job | Status | Issues | Merged At |
|-----|--------|--------|-----------|
| graceful-retry | ✅ merged | #39 | 2026-02-12 |
| touchset-gate | ✅ merged | #16 | 2026-02-12 |

Files

  • src/tools/pr.ts — add issues param, append closing refs to body
  • src/lib/orchestrator.ts — collect issues from plan/jobs, append to createPR() body
  • src/lib/plan-types.ts — add issues field to PlanSpec and/or JobSpec
  • src/lib/schemas.ts — add issues to plan schema

Related

  • #42 (PR template loading) — both improve PR body quality

nigel-dev avatar Feb 12 '26 12:02 nigel-dev