Skip to content

Commit 8c7b35a

Browse files
authored
tweak: compaction check (anomalyco#13214)
1 parent e2a33f7 commit 8c7b35a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/opencode/src/session/compaction.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export namespace SessionCompaction {
4141

4242
const reserved =
4343
config.compaction?.reserved ?? Math.min(COMPACTION_BUFFER, ProviderTransform.maxOutputTokens(input.model))
44-
const usable = input.model.limit.input ? input.model.limit.input - reserved : context - reserved
44+
const usable = input.model.limit.input
45+
? input.model.limit.input - reserved
46+
: context - ProviderTransform.maxOutputTokens(input.model)
4547
return count >= usable
4648
}
4749

0 commit comments

Comments
 (0)