authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-09-02 01:03:56-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-02 04:03:56-04:00
log14f15cfed48bc7519e8e5eeac03f483f4b11ef3a
tree48f13c73a8d9bca4de41ec29ffe6fc23b4139193
parentdd6879ffea24da9fc16cb62d7d6072d2c5b2bae3
signature Signed by PGP key B5690EEEBB952194

fix(server): stop titling linked PR threads from local git history (#9191)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

2 files changed, 24 insertions(+), 2 deletions(-)

apps/server/src/textGeneration/TextGenerationPrompts.test.ts+18
...@@ -188,6 +188,24 @@ describe("buildThreadTitlePrompt", () => {...@@ -188,6 +188,24 @@ describe("buildThreadTitlePrompt", () => {
188 expect(result.prompt).toContain("67890 bytes");188 expect(result.prompt).toContain("67890 bytes");
189 });189 });
190190
191 it.each([
192 { mode: "initial", previousTitle: undefined },
193 { mode: "regeneration", previousTitle: "Open Projects in Desktop App" },
194 ])(
195 "tells the $mode prompt not to title linked PRs from local git history",
196 ({ previousTitle }) => {
197 const result = buildThreadTitlePrompt({
198 message: "$takeover https://github.com/pingdotgg/t3code/pull/8588",
199 ...(previousTitle === undefined ? {} : { previousTitle }),
200 });
201
202 expect(result.prompt).toContain(
203 "Local git history is not evidence of what a linked PR or issue is about.",
204 );
205 expect(result.prompt).toContain('such as "Take Over PR 8588"');
206 },
207 );
208
191 it("regenerates from recent thread contents and identifies the previous title", () => {209 it("regenerates from recent thread contents and identifies the previous title", () => {
192 const result = buildThreadTitlePrompt({210 const result = buildThreadTitlePrompt({
193 message: `USER:\nInvestigate reconnect regressions\n\nASSISTANT:\nThe remaining issue is stale session state`,211 message: `USER:\nInvestigate reconnect regressions\n\nASSISTANT:\nThe remaining issue is stale session state`,
apps/server/src/textGeneration/TextGenerationPrompts.ts+6-2
...@@ -238,7 +238,9 @@ Editorial rules:...@@ -238,7 +238,9 @@ Editorial rules:
238- Do not copy and truncate the user's message.238- Do not copy and truncate the user's message.
239- Avoid project names already visible in the UI, quotes, labels, filler, and trailing punctuation.239- Avoid project names already visible in the UI, quotes, labels, filler, and trailing punctuation.
240- Use attached images as primary context for UI issues.240- Use attached images as primary context for UI issues.
241- When a URL or attachment is the only source of the subject, use available tools to inspect it. If it cannot be resolved, remain accurate rather than guessing.`;241- When a URL or attachment is the only source of the subject, use available tools to inspect it directly.
242- Local git history is not evidence of what a linked PR or issue is about. Never title the thread after branch names, commit messages, or merged commits found in the checkout.
243- If a linked PR or issue cannot be read, fall back to the user's stated action plus its number, such as "Take Over PR 8588". This is the one case where a PR or issue number belongs in the title.`;
242244
243function regenerateThreadTitlePrompt(previousTitle: string): string {245function regenerateThreadTitlePrompt(previousTitle: string): string {
244 return `Regenerate the title for an existing T3 Code thread so the user can recognize it weeks later.246 return `Regenerate the title for an existing T3 Code thread so the user can recognize it weeks later.
...@@ -265,7 +267,9 @@ Editorial rules:...@@ -265,7 +267,9 @@ Editorial rules:
265- Do not copy and truncate a thread message.267- Do not copy and truncate a thread message.
266- Avoid project names already visible in the UI, PR numbers, quotes, labels, filler, and trailing punctuation.268- Avoid project names already visible in the UI, PR numbers, quotes, labels, filler, and trailing punctuation.
267- Use attached images as primary context for UI issues.269- Use attached images as primary context for UI issues.
268- When a URL or attachment is the only source of the subject, use available tools to inspect it. If it cannot be resolved, remain accurate rather than guessing.270- When a URL or attachment is the only source of the subject, use available tools to inspect it directly.
271- Local git history is not evidence of what a linked PR or issue is about. Never title the thread after branch names, commit messages, or merged commits found in the checkout.
272- If a linked PR or issue cannot be read, fall back to the user's stated action plus its number, such as "Take Over PR 8588". This is the one case where a PR or issue number belongs in the title.
269- Return a meaningfully improved title, not a cosmetic paraphrase of the previous title.273- Return a meaningfully improved title, not a cosmetic paraphrase of the previous title.
270274
271Examples of the distinction:275Examples of the distinction: