Skip to content

Commit fe60b11

Browse files
Update src/core/tools/contextValidator.ts
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
1 parent 0e0bd6c commit fe60b11

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/tools/contextValidator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async function getContextInfo(cline: Task): Promise<ContextInfo> {
5757
const currentlyUsed = currentContextTokens || 0
5858
const remainingContext = contextWindow - currentlyUsed
5959
const usableRemainingContext = Math.floor(remainingContext * (1 - FILE_READ_BUFFER_PERCENTAGE))
60-
const reservedForResponse = maxResponseTokens || 0
60+
const reservedForResponse = Math.min(maxResponseTokens || 0, usableRemainingContext)
6161
const availableTokensForFile = usableRemainingContext - reservedForResponse
6262
const targetTokenLimit = Math.floor(availableTokensForFile * 0.9)
6363

0 commit comments

Comments
 (0)