Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 4e932fb

Browse files
committed
fix: include PR titles in generated task names
Generated-By: PostHog Code Task-Id: 0c226c8d-1b4d-4527-8d8c-2c0819279f10
1 parent 2a074aa commit 4e932fb

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

packages/core/src/sessions/titleGeneratorService.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,26 @@ describe("generateTitleAndSummary", () => {
220220
expect(result?.title).toBe("Fix login bug");
221221
});
222222

223+
it("instructs the model to include existing GitHub PR titles", async () => {
224+
prompt.mockResolvedValue({
225+
content:
226+
"TITLE: Review PR #123: Fix login redirect\nSUMMARY: Reviewing the existing pull request.",
227+
});
228+
229+
await makeService().generateTitleAndSummary(
230+
'<github_pr number="123" title="Fix login redirect" url="https://github.com/org/repo/pull/123" />',
231+
);
232+
233+
expect(prompt).toHaveBeenCalledWith(
234+
expect.anything(),
235+
expect.objectContaining({
236+
system: expect.stringContaining(
237+
"the generated TITLE MUST include both the PR number and the PR title verbatim",
238+
),
239+
}),
240+
);
241+
});
242+
223243
it("returns null on error", async () => {
224244
prompt.mockRejectedValue(new Error("network error"));
225245
const result = await makeService().generateTitleAndSummary("some content");

packages/core/src/sessions/titleGeneratorService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Title rules:
4040
- Remove: the, this, my, a, an
4141
- If possible, start with action verbs (Fix, Implement, Analyze, Debug, Update, Research, Review)
4242
- Keep exact: technical terms, numbers, filenames, HTTP codes, PR numbers
43+
- GitHub PR rule: If the content contains a <github_pr> with a non-empty title, the generated TITLE MUST include both the PR number and the PR title verbatim. This rule overrides the 6-word title limit. Never replace the PR title with a generic phrase. Before responding, verify that both values appear in TITLE.
4344
- Never assume tech stack
4445
- Only output "Untitled" if the input is completely null/missing, not just unclear
4546
- If the input is a URL (e.g. a GitHub issue link, PR link, or any web URL), generate a title based on what you can infer from the URL structure (repo name, issue/PR number, etc.). Never say you cannot access URLs or ask the user for more information.
@@ -58,6 +59,7 @@ Title examples:
5859
- "Update user documentation for new API endpoints" → Update API documentation
5960
- "Research competitor pricing strategies for our product" → Research competitor pricing
6061
- "Review pull request #123" → Review pull request #123
62+
- "<github_pr number="123" title="Fix login redirect" url="https://github.com/org/repo/pull/123" />" → Review PR #123: Fix login redirect
6163
- "debug 500 errors in production" → Debug production 500 errors
6264
- "why is the payment flow failing" → Analyze payment flow failure
6365
- "So how about that weather huh" → Weather chat

0 commit comments

Comments
 (0)