The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 22:15 UTC
fix(server): generated thread titles leave out the project name (#33418)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Topfi committed
Nov 12, 2026 at 00:11 UTC
c092c6eb1e91772e93f0956a5fa6c855d62aa51e
8 files changed
+58
-7
apps/server/src/orchestration-v2/ThreadTitleRegenerationService.ts
+1
@@ -170,6 +170,7 @@ const make = Effect.gen(function* () {
170
const result = yield* textGeneration.generateThreadTitle({
171
cwd: worktreeExists ? worktreePath : project.value.workspaceRoot,
172
message: context.message,
173
+ projectTitle: project.value.title,
174
attachments: context.attachments,
175
...(input.kind.type === "regenerate" ? { previousTitle: projection.thread.title } : {}),
176
...(inherited === undefined ? {} : { forkSource: inherited }),
evals/thread-titles/README.md
+1
-1
@@ -16,4 +16,4 @@ pnpm thread-titles --model <codex model> --out runs/titles-new --baseline runs/t
16
17
## Add a case
18
19
-Add an entry to `cases.ts` with an `id`, a `source`, the thread `messages`, the `previousTitle`, and a `rubric` that says what a good title names.
19
+Add an entry to `cases.ts` with an `id`, a `source`, the thread `messages`, the `previousTitle`, an optional `projectTitle`, and a `rubric` that says what a good title names.
evals/thread-titles/cases.ts
+19
@@ -106,10 +106,29 @@ export const threadTitleEvaluationCases = [
106
],
107
rubric: "Keep title generation as the subject. Do not focus on filing the PR.",
108
},
109
+ {
110
+ id: "project-name",
111
+ source: "https://github.com/pingdotgg/t3code/pull/33418",
112
+ request: "Make hyperdrive init create a default config instead of crashing.",
113
+ projectTitle: "Hyperdrive",
114
+ previousTitle: "Hyperdrive Init Missing Config Crash",
115
+ messages: [
116
+ {
117
+ role: "user",
118
+ text: "hyperdrive init crashes when ~/.hyperdrive/config.toml is missing. Make hyperdrive create a default config instead of throwing.",
119
+ },
120
+ {
121
+ role: "assistant",
122
+ text: "Hyperdrive's loadConfig now writes a default config.toml when the file is absent.",
123
+ },
124
+ ],
125
+ rubric: "Name the default config on init. Leave out Hyperdrive, the project name.",
126
+ },
127
] satisfies ReadonlyArray<{
128
id: string;
129
source: string;
130
request: string;
131
+ projectTitle?: string;
132
previousTitle: string;
133
messages: ReadonlyArray<ThreadTitleMessage>;
134
rubric: string;
evals/thread-titles/run.ts
+1
@@ -95,6 +95,7 @@ await Effect.runPromise(
95
const generated = yield* generation.generateThreadTitle({
96
cwd,
97
message,
98
+ ...("projectTitle" in fixture ? { projectTitle: fixture.projectTitle } : {}),
99
previousTitle: values.initial ? undefined : fixture.previousTitle,
100
attachments,
101
linkedContext,
packages/provider-core/src/server/textGeneration.ts
+1
@@ -64,6 +64,7 @@ export interface ThreadTitleGenerationInput {
64
linkedContext?: string | undefined;
65
cwd: string;
66
message: string;
67
+ projectTitle?: string | undefined;
68
previousTitle?: string | undefined;
69
forkSource?: ThreadTitleForkSource | undefined;
70
attachments?: ReadonlyArray<ChatAttachment> | undefined;
packages/provider-core/src/server/textGenerationOperations.ts
+1
@@ -157,6 +157,7 @@ export function fromRunner(name: string, run: Runner): ProviderTextGeneration {
157
attachments: input.attachments,
158
...buildThreadTitlePrompt({
159
message: input.message,
160
+ projectTitle: input.projectTitle,
161
previousTitle: input.previousTitle,
162
forkSource: input.forkSource,
163
linkedContext: input.linkedContext,
packages/provider-core/src/server/textGenerationPrompts.test.ts
+14
@@ -1,5 +1,6 @@
1
import { describe, expect, it } from "vite-plus/test";
2
3
+import { buildThreadTitlePrompt } from "./textGenerationPrompts.ts";
4
import { normalizeCliError } from "./textGenerationUtils.ts";
5
6
describe("normalizeCliError", () => {
@@ -15,3 +16,16 @@ describe("normalizeCliError", () => {
16
expect(result.message).not.toContain("secret-token");
17
});
18
});
19
+
20
+describe("buildThreadTitlePrompt", () => {
21
+ it("names the project to leave out of initial and regenerated titles", () => {
22
+ for (const previousTitle of [undefined, "Hyperdrive Config Crash"]) {
23
+ const { prompt } = buildThreadTitlePrompt({
24
+ message: "hyperdrive init crashes without a config",
25
+ previousTitle,
26
+ projectTitle: "Hyperdrive",
27
+ });
28
+ expect(prompt).toContain('Never include the project name ("Hyperdrive")');
29
+ }
30
+ });
31
+});
packages/provider-core/src/server/textGenerationPrompts.ts
+20
-6
@@ -353,6 +353,7 @@ export function buildBranchNamePrompt(input: BranchNamePromptInput) {
353
export interface ThreadTitlePromptInput {
354
linkedContext?: string | undefined;
355
message: string;
356
+ projectTitle?: string | undefined;
357
previousTitle?: string | undefined;
358
forkSource?: ThreadTitleForkSource | undefined;
359
attachments?: ReadonlyArray<ChatAttachment> | undefined;
@@ -365,8 +366,17 @@ export interface ThreadTitleForkSource {
366
history: string;
367
}
368
369
+// The UI shows the project beside the title; naming it lets small models actually omit it.
370
+function avoidRule(projectTitle: string | undefined, others: string): string {
371
+ const name = projectTitle?.trim();
372
+ return name
373
+ ? `- Never include the project name (${JSON.stringify(name)}); the UI already shows it next to the title. Avoid ${others}.`
374
+ : `- Avoid project names already visible in the UI, ${others}.`;
375
+}
376
+
377
// Keep shared editorial rules in these two prompts in sync.
369
-const INITIAL_THREAD_TITLE_PROMPT = `Generate a title that will help the user recognize this T3 Code thread weeks later.
378
+function initialThreadTitlePrompt(projectTitle: string | undefined): string {
379
+ return `Generate a title that will help the user recognize this T3 Code thread weeks later.
380
Return JSON with keys title and needsRefinement.
381
Set needsRefinement to true only if the subject is still unknown, such as an unresolved link, "fix this", or an unexplained attachment. Otherwise set it to false.
382
@@ -387,13 +397,17 @@ Editorial rules:
397
- For research, name the question domain rather than the requested research process.
398
- Do not claim the work is complete.
399
- Do not copy and truncate the user's message.
390
-- Avoid project names already visible in the UI, quotes, labels, filler, and trailing punctuation.
400
+${avoidRule(projectTitle, "quotes, labels, filler, and trailing punctuation")}
401
- Use attached images as primary context for UI issues.
402
- When a URL or attachment is the only source of the subject, use available tools to inspect it directly.
403
- 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.
404
- 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.`;
405
+}
406
396
-function regenerateThreadTitlePrompt(previousTitle: string): string {
407
+function regenerateThreadTitlePrompt(
408
+ previousTitle: string,
409
+ projectTitle: string | undefined,
410
+): string {
411
return `Regenerate the title for an existing T3 Code thread so the user can recognize it weeks later.
412
The previous title was ${JSON.stringify(previousTitle)}.
413
Return JSON with keys title and needsRefinement. Set needsRefinement to false.
@@ -416,7 +430,7 @@ Editorial rules:
430
- For research, name the question domain rather than the research process.
431
- Do not claim the work is complete.
432
- Do not copy and truncate a thread message.
419
-- Avoid project names already visible in the UI, PR numbers, quotes, labels, filler, and trailing punctuation.
433
+${avoidRule(projectTitle, "PR numbers, quotes, labels, filler, and trailing punctuation")}
434
- Use attached images as primary context for UI issues.
435
- When a URL or attachment is the only source of the subject, use available tools to inspect it directly.
436
- 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.
@@ -472,12 +486,12 @@ export function buildThreadTitlePrompt(input: ThreadTitlePromptInput) {
486
if (input.previousTitle === undefined) {
487
const message = limitTitleMessage(input.message, 8_000);
488
const label = input.forkSource === undefined ? "User message" : "User message after the fork";
475
- prompt = `${INITIAL_THREAD_TITLE_PROMPT}${forkSourceSection(input.forkSource)}\n\n${label}:\n${message}${threadTitlePromptSuffix(input)}`;
489
+ prompt = `${initialThreadTitlePrompt(input.projectTitle)}${forkSourceSection(input.forkSource)}\n\n${label}:\n${message}${threadTitlePromptSuffix(input)}`;
490
} else {
491
const message = preserveMessageEnd(input.message);
492
const label =
493
input.forkSource === undefined ? "Thread contents" : "Thread contents after the fork";
480
- prompt = `${regenerateThreadTitlePrompt(input.previousTitle)}${forkSourceSection(input.forkSource)}\n\n${label}:\n${message}${threadTitlePromptSuffix(input)}`;
494
+ prompt = `${regenerateThreadTitlePrompt(input.previousTitle, input.projectTitle)}${forkSourceSection(input.forkSource)}\n\n${label}:\n${message}${threadTitlePromptSuffix(input)}`;
495
}
496
const outputSchema = Schema.Struct({
497
title: Schema.String,