Skip to content

Commit 4b25738

Browse files
fix: generate session and thread titles in sentence case
Generated titles came back in Title Case because none of the title prompts stated a capitalization style; asked for a "title" with no case rule, models default to Title Case and nothing downstream corrects it. The tool-call purpose titles already ask for sentence case, so session titles, Discord auto-thread titles, and Telegram DM topic labels were the outliers. Sets sentence case in each title prompt rather than post-processing: the titles follow the user's language, and sentence-case rules are language-specific, so a mechanical normalizer would mangle German nouns and proper nouns like OpenClaw or GitHub.
1 parent 20be26c commit 4b25738

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎extensions/discord/src/monitor/thread-title.generate.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe("generateThreadTitle", () => {
7272
userMessage:
7373
"Channel: release-status\n\nChannel description: Deploy updates and incident notes\n\nMessage:\nSummarize deployment blockers and owner follow-ups.",
7474
prompt:
75-
"Generate a concise Discord thread title (3-6 words). Return only the title. Use channel context when provided and avoid redundant channel-name words unless needed for clarity.",
75+
"Generate a concise Discord thread title (3-6 words) in sentence case: capitalize only the first word and words that are always capitalized. Return only the title. Use channel context when provided and avoid redundant channel-name words unless needed for clarity.",
7676
modelRef: "openai/gpt-4.1-mini@local",
7777
timeoutMs: 60_000,
7878
maxLength: 600,

‎extensions/discord/src/monitor/thread-title.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const MAX_THREAD_TITLE_SOURCE_CHARS = 600;
99
const MAX_THREAD_TITLE_CHANNEL_NAME_CHARS = 120;
1010
const MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS = 320;
1111
const DISCORD_THREAD_TITLE_SYSTEM_PROMPT =
12-
"Generate a concise Discord thread title (3-6 words). Return only the title. Use channel context when provided and avoid redundant channel-name words unless needed for clarity.";
12+
"Generate a concise Discord thread title (3-6 words) in sentence case: capitalize only the first word and words that are always capitalized. Return only the title. Use channel context when provided and avoid redundant channel-name words unless needed for clarity.";
1313

1414
export async function generateThreadTitle(params: {
1515
cfg: OpenClawConfig;

‎extensions/telegram/src/auto-topic-label-config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
} from "openclaw/plugin-sdk/config-contracts";
66

77
const AUTO_TOPIC_LABEL_DEFAULT_PROMPT =
8-
"Generate a very short topic label (2-4 words, max 25 chars) for a chat conversation based on the user's first message below. No emoji. Use the same language as the message. Be concise and descriptive. Return ONLY the topic name, nothing else.";
8+
"Generate a very short topic label (2-4 words, max 25 chars) for a chat conversation based on the user's first message below. No emoji. Use the same language as the message, in sentence case: capitalize only the first word and words that language always capitalizes. Be concise and descriptive. Return ONLY the topic name, nothing else.";
99

1010
export function resolveAutoTopicLabelConfig(
1111
directConfig?: TelegramDirectConfig["autoTopicLabel"],

‎extensions/telegram/src/auto-topic-label.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { resolveAutoTopicLabelConfig } from "./auto-topic-label-config.js";
1111
import { generateTelegramTopicLabel } from "./auto-topic-label.js";
1212

1313
const EXPECTED_DEFAULT_PROMPT =
14-
"Generate a very short topic label (2-4 words, max 25 chars) for a chat conversation based on the user's first message below. No emoji. Use the same language as the message. Be concise and descriptive. Return ONLY the topic name, nothing else.";
14+
"Generate a very short topic label (2-4 words, max 25 chars) for a chat conversation based on the user's first message below. No emoji. Use the same language as the message, in sentence case: capitalize only the first word and words that language always capitalizes. Be concise and descriptive. Return ONLY the topic name, nothing else.";
1515

1616
describe("resolveAutoTopicLabelConfig", () => {
1717
it("returns enabled with default prompt when configs are undefined", () => {

‎src/gateway/dashboard-session-title.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("maybeGenerateDashboardSessionTitle", () => {
7575
expect(generateConversationLabelWithFallback).toHaveBeenCalledWith({
7676
userMessage: "Help me plan the release",
7777
prompt:
78-
"Generate a concise session title (3-6 words, max 60 characters) from the user's first message. Use the same language as the message. No emoji. Return only the title.",
78+
"Generate a concise session title (3-6 words, max 60 characters) from the user's first message. Use the same language as the message, in sentence case: capitalize only the first word and words that language always capitalizes. No emoji. Return only the title.",
7979
cfg,
8080
agentId: "main",
8181
utilityModelRef: "openai/gpt-5.6-luna",

‎src/gateway/dashboard-session-title.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type DashboardSessionTitleModelEntry = Pick<
3030
const DASHBOARD_SESSION_TITLE_MAX_CHARS = 60;
3131
const DASHBOARD_SESSION_TITLE_SOURCE_MAX_CHARS = 1_000;
3232
const DASHBOARD_SESSION_TITLE_PROMPT =
33-
"Generate a concise session title (3-6 words, max 60 characters) from the user's first message. Use the same language as the message. No emoji. Return only the title.";
33+
"Generate a concise session title (3-6 words, max 60 characters) from the user's first message. Use the same language as the message, in sentence case: capitalize only the first word and words that language always capitalizes. No emoji. Return only the title.";
3434

3535
// One title request per session generation. Concurrent triggers cannot race duplicate model
3636
// calls or metadata writes; late callers receive the in-flight promise so they

0 commit comments

Comments
 (0)