Skip to content

Commit 1c92b93

Browse files
committed
fix(core): size the title cap to leave room for a thinking budget
512 rejected title requests outright on providers where max_completion_tokens must exceed the thinking budget (Claude budget, OpenRouter, Gemini). 4096 still cuts the circular-reasoning loop from anomalyco#54401 (minutes of tokens) in seconds while leaving a typical budget room to finish.
1 parent 48f4655 commit 1c92b93

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎packages/core/src/session/model-request.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ const OUTPUT_TOKEN_FALLBACK = 32_000
5656
// No reply needs more, however much the model allows.
5757
const OUTPUT_TOKEN_MAX = 256_000
5858
// A title never needs more; without a bound a local thinking model can reason in circles
59-
// for minutes on the background title request while the user waits (#54401).
60-
const TITLE_OUTPUT_MAX = 512
59+
// for minutes on the background title request while the user waits (#54401). Sized to leave
60+
// room for a small thinking budget, so budget-aware providers don't reject the request.
61+
const TITLE_OUTPUT_MAX = 4_096
6162
// Prompt text is estimated at about 4 characters per token, which can run low on dense text such as code.
6263
const ESTIMATE_ERROR = 0.15
6364
// Share of the window a turn leaves unused when its output limit is fitted to the room left. Providers count a few

‎packages/core/test/session-title.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,6 @@ it.effect("bounds the title request with a small output limit (#54401)", () =>
690690
expect(requests).toHaveLength(1)
691691
const maxTokens = requests[0]?.generation?.maxTokens
692692
expect(maxTokens).toBeDefined()
693-
expect(maxTokens!).toBeLessThanOrEqual(512)
693+
expect(maxTokens!).toBeLessThanOrEqual(4_096)
694694
}),
695695
)

0 commit comments

Comments
 (0)