Skip to content

The open source coding agent.

TypeScript

tweak: compaction check (#13214)

Aiden Cline8c7b35ad05c9
diff --git a/packages/opencode/src/session/compaction.ts b/packages/opencode/src/session/compaction.ts
index 5660ca97319..9245426057c 100644
--- a/packages/opencode/src/session/compaction.ts
+++ b/packages/opencode/src/session/compaction.ts
@@ -41,7 +41,9 @@ export namespace SessionCompaction {
const reserved =
config.compaction?.reserved ?? Math.min(COMPACTION_BUFFER, ProviderTransform.maxOutputTokens(input.model))
- const usable = input.model.limit.input ? input.model.limit.input - reserved : context - reserved
+ const usable = input.model.limit.input
+ ? input.model.limit.input - reserved
+ : context - ProviderTransform.maxOutputTokens(input.model)
return count >= usable
}