We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e0bd6c commit fe60b11Copy full SHA for fe60b11
src/core/tools/contextValidator.ts
@@ -57,7 +57,7 @@ async function getContextInfo(cline: Task): Promise<ContextInfo> {
57
const currentlyUsed = currentContextTokens || 0
58
const remainingContext = contextWindow - currentlyUsed
59
const usableRemainingContext = Math.floor(remainingContext * (1 - FILE_READ_BUFFER_PERCENTAGE))
60
- const reservedForResponse = maxResponseTokens || 0
+ const reservedForResponse = Math.min(maxResponseTokens || 0, usableRemainingContext)
61
const availableTokensForFile = usableRemainingContext - reservedForResponse
62
const targetTokenLimit = Math.floor(availableTokensForFile * 0.9)
63
0 commit comments