Skip to content

Commit 3f70b0d

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 #54401 (minutes of tokens) in seconds while leaving a typical budget room to finish.
1 parent 843746d commit 3f70b0d

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
@@ -49,8 +49,9 @@ const OUTPUT_TOKEN_FALLBACK = 32_000
4949
// No reply needs more, however much the model allows.
5050
const OUTPUT_TOKEN_MAX = 256_000
5151
// A title never needs more; without a bound a local thinking model can reason in circles
52-
// for minutes on the background title request while the user waits (#54401).
53-
const TITLE_OUTPUT_MAX = 512
52+
// for minutes on the background title request while the user waits (#54401). Sized to leave
53+
// room for a small thinking budget, so budget-aware providers don't reject the request.
54+
const TITLE_OUTPUT_MAX = 4_096
5455
// Prompt text is estimated at about 4 characters per token, which can run low on dense text such as code.
5556
const ESTIMATE_ERROR = 0.15
5657
// Never ask for less; only reachable with automatic compaction off, since it keeps the window from filling this far.

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

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

0 commit comments

Comments
 (0)