mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 12:11:20 +00:00
fix(discord): raise thread title max tokens for reasoning models
When the simple-completion model selected for thread-title generation is a reasoning model (e.g. MiniMax M2, Claude thinking models, OpenAI o-series), the 24-token output budget is entirely consumed by the internal thinking block before any user-visible text is emitted. extractAssistantText then returns an empty string, generateThreadTitle returns null, and the auto-thread rename is silently skipped while the feature appears to do nothing. Raise DISCORD_THREAD_TITLE_MAX_TOKENS to 512 so there is enough headroom for a short thinking pass plus the 3-6 word title output. The generous ceiling only matters when the provider actually reasons; non-reasoning models still emit a short title and stop early at end-of-sequence. Verified live against a MiniMax M2 reasoning model served through an Anthropic-compatible API endpoint: before the fix, the rename never fired; after the fix, the thread is renamed with a concise generated title. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Peter Steinberger
parent
13821fd54b
commit
537479f5b0
@@ -172,7 +172,7 @@ describe("generateThreadTitle", () => {
|
||||
).toContain("Channel description: Deploy updates and incident notes");
|
||||
expect(completeWithPreparedSimpleCompletionModelMock.mock.calls[0]?.[0]?.options).toEqual(
|
||||
expect.objectContaining({
|
||||
maxTokens: 24,
|
||||
maxTokens: 512,
|
||||
}),
|
||||
);
|
||||
expect(
|
||||
|
||||
@@ -10,7 +10,12 @@ const DEFAULT_THREAD_TITLE_TIMEOUT_MS = 10_000;
|
||||
const MAX_THREAD_TITLE_SOURCE_CHARS = 600;
|
||||
const MAX_THREAD_TITLE_CHANNEL_NAME_CHARS = 120;
|
||||
const MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS = 320;
|
||||
const DISCORD_THREAD_TITLE_MAX_TOKENS = 24;
|
||||
// Budget generous enough to cover reasoning-model thinking tokens plus the
|
||||
// short text output. Lower values (e.g. 24) starve reasoning models of output
|
||||
// capacity: the entire budget is consumed by the thinking block before any
|
||||
// text is emitted, so extractAssistantText returns empty and the rename is
|
||||
// silently skipped.
|
||||
const DISCORD_THREAD_TITLE_MAX_TOKENS = 512;
|
||||
const DISCORD_THREAD_TITLE_SYSTEM_PROMPT =
|
||||
"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.";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user