@devries-cameron20 / t3code-1 / commits / 14f15cfed4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

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

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

Theo Browne committed Sep 2, 2026 at 01:03 UTC 14f15cfed48bc7519e8e5eeac03f483f4b11ef3a
2 files changed +24 -2
apps/server/src/textGeneration/TextGenerationPrompts.test.ts
+18
@@ -188,6 +188,24 @@ describe("buildThreadTitlePrompt", () => {
188 expect(result.prompt).toContain("67890 bytes");
189 });
190
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 +
209 it("regenerates from recent thread contents and identifies the previous title", () => {
210 const result = buildThreadTitlePrompt({
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 - Do not copy and truncate the user's message.
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.
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.`;
244
245 function regenerateThreadTitlePrompt(previousTitle: string): string {
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:
267 - Do not copy and truncate a thread message.
268 - Avoid project names already visible in the UI, PR numbers, quotes, labels, filler, and trailing punctuation.
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.
273 - Return a meaningfully improved title, not a cosmetic paraphrase of the previous title.
274
275 Examples of the distinction: