Add linked issue guidance and ELI5 sections to PR generation prompts (#12613)

* Add linked issue guidance and ELI5 sections to PR generation prompts

Include linked GitHub issues in PR descriptions with Fixes/Refs guidance, and require ELI5 Problem and Solution sections before implementation details. Tests verify linked issue substitution and prompt structure enforcement.

* Include linked issue details in PR description generation

- Fetch the linked GitHub/GitLab issue title and body so generated PRs reference real issue context instead of just a number
- Use provider-specific reference syntax (Fixes/Refs, Closes/Related to, AB#) and label the issue by the active provider
- Feed issue title and description into the generation prompt while treating them as untrusted context, never as instructions
- Fall back to a cached work-item title when the provider lookup fails, and skip cross-provider issue attachment
This commit is contained in:
Jinjing
2026-08-04 20:05:30 -07:00
committed by GitHub
parent 738f640428
commit fe72eeb75c
15 changed files with 454 additions and 27 deletions
@@ -19,6 +19,7 @@ const mocks = vi.hoisted(() => ({
generatePullRequestFieldsFromContext: vi.fn(),
resolveCommitMessageSettings: vi.fn(),
resolveHostedReviewBodyForGeneration: vi.fn(),
loadPullRequestLinkedIssue: vi.fn(),
getSshGitProvider: vi.fn(),
getStatus: vi.fn()
}))
@@ -60,6 +61,10 @@ vi.mock('../source-control/pull-request-template', () => ({
resolveHostedReviewBodyForGeneration: mocks.resolveHostedReviewBodyForGeneration
}))
vi.mock('../source-control/pull-request-linked-issue', () => ({
loadPullRequestLinkedIssue: mocks.loadPullRequestLinkedIssue
}))
const tempDirs: string[] = []
function makeWorktree(path: string, linkedIssue: number | null = null): ResolvedRuntimeGitWorktree {
@@ -101,6 +106,8 @@ describe('RuntimeGitCommands', () => {
mocks.resolveCommitMessageSettings.mockReset()
mocks.resolveHostedReviewBodyForGeneration.mockReset()
mocks.resolveHostedReviewBodyForGeneration.mockImplementation(async ({ body }) => body)
mocks.loadPullRequestLinkedIssue.mockReset()
mocks.loadPullRequestLinkedIssue.mockResolvedValue(null)
mocks.getSshGitProvider.mockReset()
mocks.getStatus.mockReset()
mocks.checkoutBranch.mockReset()