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

feat: PR narrative synthesis from job data, diffs, and reports

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

Description

When a plan completes and a PR is created (either via mc_pr or the orchestrator's auto-PR), the PR body is minimal — just a list of job names. It doesn't leverage the rich data MC already has: job prompts, agent reports, timing data, diffs, and merge results.

Use Case

A well-crafted PR description saves reviewer time and provides audit context. MC has all the raw data to generate a rich PR narrative automatically.

Current Implementation

// src/lib/orchestrator.ts:893
const body = `Automated PR from Mission Control plan: ${plan.name}\n\nJobs:\n${plan.jobs.map((j) => `- ${j.name}`).join('\n')}`;

For standalone jobs via mc_pr:

// src/tools/pr.ts:61
const prTitle = args.title || job.prompt;
// No auto-generated body at all

Proposed Solution

Generate a structured PR body that includes:

## Plan: {plan.name}
**Mode:** {plan.mode} | **Duration:** {total duration} | **Jobs:** {count}

### Changes
| Job | Status | Duration | Files Changed |
|-----|--------|----------|---------------|
| schema-update | ✅ merged | 3m 22s | 4 |
| api-endpoints | ✅ merged | 8m 15s | 12 |

### Job Details
#### schema-update
> {truncated prompt}

**Agent Report:** {last mc_report message}
**Merge:** clean, tests passed

#### api-endpoints
> {truncated prompt}

**Agent Report:** {last mc_report message}  
**Merge:** clean, tests passed

Data sources (all already available):

  • plan.jobs[].prompt — what each job was asked to do
  • plan.jobs[].status — outcome
  • Job state timing (createdAt, completedAt)
  • Agent reports from reports.ts
  • git diff --stat per job branch
  • Merge train results from merge-train.ts

Files Involved

  • src/lib/orchestrator.ts:893 — plan auto-PR body generation
  • src/tools/pr.ts — standalone PR creation (no body)
  • src/lib/reports.ts — agent report storage
  • New: src/lib/pr-narrative.ts — PR body generator

Additional Context

From audit report Section 9 Phase 2: "PR narrative synthesis (from job prompts, diffs, reports, timing)."

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