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
+6 -2
View File
@@ -111,11 +111,15 @@ describe('issue source operations', () => {
title: 'Use upstream issues',
state: 'open',
html_url: 'https://github.com/stablyai/orca/issues/923',
labels: []
labels: [],
body: 'The issue body'
})
})
await expect(getIssue('/repo-root', 923)).resolves.toMatchObject({ number: 923 })
await expect(getIssue('/repo-root', 923)).resolves.toMatchObject({
number: 923,
description: 'The issue body'
})
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(
['api', '--cache', '300s', 'repos/stablyai/orca/issues/923'],
{ cwd: '/repo-root', host: 'github.com' }
+1 -1
View File
@@ -87,7 +87,7 @@ export async function getIssue(
}
// Fallback for non-GitHub remotes
const { stdout } = await ghExecFileAsync(
['issue', 'view', String(issueNumber), '--json', 'number,title,state,url,labels'],
['issue', 'view', String(issueNumber), '--json', 'number,title,state,url,labels,body'],
ghOptions
)
const data = JSON.parse(stdout)
+3 -1
View File
@@ -133,13 +133,15 @@ export function mapIssueInfo(data: {
url?: string
html_url?: string
labels?: { name: string }[]
body?: string | null
}): IssueInfo {
return {
number: data.number,
title: data.title,
state: data.state?.toLowerCase() === 'open' ? 'open' : 'closed',
url: data.html_url ?? data.url ?? '',
labels: (data.labels || []).map((l) => l.name)
labels: (data.labels || []).map((l) => l.name),
...(typeof data.body === 'string' ? { description: data.body } : {})
}
}