Skip to content

Commit 57b3051

Browse files
committed
fix agent getting caught in summary loop
1 parent ae5cf3c commit 57b3051

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

opencode.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"$schema": "https://opencode.ai/config.json",
33
"mcp": {},
4-
"provider": {}
4+
"provider": {
5+
"openrouter": {
6+
"npm": "@openrouter/ai-sdk-provider",
7+
"name": "OpenRouter",
8+
"models": {
9+
"anthropic/claude-sonnet-4": {}
10+
}
11+
}
12+
}
513
}

packages/opencode/src/session/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ export namespace Session {
210210
previous.metadata.assistant.tokens.cache.write +
211211
previous.metadata.assistant.tokens.output
212212
if (
213+
model.info.limit.context &&
213214
tokens >
214-
(model.info.limit.context - (model.info.limit.output ?? 0)) * 0.9
215+
(model.info.limit.context - (model.info.limit.output ?? 0)) * 0.9
215216
) {
216217
await summarize({
217218
sessionID: input.sessionID,

0 commit comments

Comments
 (0)