From 4e932fbef22f48bebed57d9d37da6f9fc8a070b0 Mon Sep 17 00:00:00 2001 From: Matt Pua Date: Tue, 28 Jul 2026 13:58:24 -0400 Subject: [PATCH 1/2] fix: include PR titles in generated task names Generated-By: PostHog Code Task-Id: 0c226c8d-1b4d-4527-8d8c-2c0819279f10 --- .../sessions/titleGeneratorService.test.ts | 20 +++++++++++++++++++ .../src/sessions/titleGeneratorService.ts | 2 ++ 2 files changed, 22 insertions(+) diff --git a/packages/core/src/sessions/titleGeneratorService.test.ts b/packages/core/src/sessions/titleGeneratorService.test.ts index 956fd897ac..5252680a94 100644 --- a/packages/core/src/sessions/titleGeneratorService.test.ts +++ b/packages/core/src/sessions/titleGeneratorService.test.ts @@ -220,6 +220,26 @@ describe("generateTitleAndSummary", () => { expect(result?.title).toBe("Fix login bug"); }); + it("instructs the model to include existing GitHub PR titles", async () => { + prompt.mockResolvedValue({ + content: + "TITLE: Review PR #123: Fix login redirect\nSUMMARY: Reviewing the existing pull request.", + }); + + await makeService().generateTitleAndSummary( + '', + ); + + expect(prompt).toHaveBeenCalledWith( + expect.anything(), + expect.objectContaining({ + system: expect.stringContaining( + "the generated TITLE MUST include both the PR number and the PR title verbatim", + ), + }), + ); + }); + it("returns null on error", async () => { prompt.mockRejectedValue(new Error("network error")); const result = await makeService().generateTitleAndSummary("some content"); diff --git a/packages/core/src/sessions/titleGeneratorService.ts b/packages/core/src/sessions/titleGeneratorService.ts index 537317fb02..67a66f3043 100644 --- a/packages/core/src/sessions/titleGeneratorService.ts +++ b/packages/core/src/sessions/titleGeneratorService.ts @@ -40,6 +40,7 @@ Title rules: - Remove: the, this, my, a, an - If possible, start with action verbs (Fix, Implement, Analyze, Debug, Update, Research, Review) - Keep exact: technical terms, numbers, filenames, HTTP codes, PR numbers +- GitHub PR rule: If the content contains a 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. - Never assume tech stack - Only output "Untitled" if the input is completely null/missing, not just unclear - 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: - "Update user documentation for new API endpoints" → Update API documentation - "Research competitor pricing strategies for our product" → Research competitor pricing - "Review pull request #123" → Review pull request #123 +- "" → Review PR #123: Fix login redirect - "debug 500 errors in production" → Debug production 500 errors - "why is the payment flow failing" → Analyze payment flow failure - "So how about that weather huh" → Weather chat From 6267549242864df6682f7f7b8f37bbfe4a0c1dfc Mon Sep 17 00:00:00 2001 From: Matt Pua Date: Tue, 28 Jul 2026 15:34:54 -0400 Subject: [PATCH 2/2] fix: anchor generated summary parsing Generated-By: PostHog Code Task-Id: 511823aa-fc4e-4f54-8064-cc1cecf38807 --- .../src/sessions/titleGeneratorService.test.ts | 16 ++++++++++++++++ .../core/src/sessions/titleGeneratorService.ts | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/core/src/sessions/titleGeneratorService.test.ts b/packages/core/src/sessions/titleGeneratorService.test.ts index 5252680a94..dfa5829191 100644 --- a/packages/core/src/sessions/titleGeneratorService.test.ts +++ b/packages/core/src/sessions/titleGeneratorService.test.ts @@ -220,6 +220,22 @@ describe("generateTitleAndSummary", () => { expect(result?.title).toBe("Fix login bug"); }); + it("does not parse SUMMARY in a PR title as the summary", async () => { + prompt.mockResolvedValue({ + content: + "TITLE: Review PR #123: Fix SUMMARY: parsing\nSUMMARY: Fixing title and summary parsing.", + }); + + const result = await makeService().generateTitleAndSummary( + '', + ); + + expect(result).toEqual({ + title: "Review PR #123: Fix SUMMARY: parsing", + summary: "Fixing title and summary parsing.", + }); + }); + it("instructs the model to include existing GitHub PR titles", async () => { prompt.mockResolvedValue({ content: diff --git a/packages/core/src/sessions/titleGeneratorService.ts b/packages/core/src/sessions/titleGeneratorService.ts index 67a66f3043..7913c2f64b 100644 --- a/packages/core/src/sessions/titleGeneratorService.ts +++ b/packages/core/src/sessions/titleGeneratorService.ts @@ -175,7 +175,7 @@ export class TitleGeneratorService { const text = result.content.trim(); const titleMatch = text.match(/^TITLE:\s*(.+?)(?:\n|$)/m); - const summaryMatch = text.match(/SUMMARY:\s*([\s\S]+)$/m); + const summaryMatch = text.match(/^SUMMARY:\s*([\s\S]+)$/m); const title = titleMatch?.[1]