Skip to content

Commit 2689383

Browse files
authored
fix(opencode): bound the compaction head and mirror the PR-eval model params (#251)
The umbrella opencode config kept the models.dev generation default and the stock compaction tail budget. On a long session that combination wedges: select() budgets only the retained tail, whose default is min(15000, ...), so once the newest turn exceeds it the summarizer head becomes the ENTIRE serialized history (all reasoning text retained, tool output capped at 2k). Measured on session ses_f31022a99ffe1gLJ1RdyDnhlAh (opencode 1.18.32, ollama-cloud/deepseek-v4.1-flash, 1048576 context): - auto-compaction fired at a 666,763-token live context; - the summarizer prompt was 1,122,556 input tokens (logged) — reconstructing the head with the exact serialize() rules and measuring it through the real provider gives 1,128,448 (0.5% apart); - the provider rejected it ("The prompt is too long"), the session was wedged. The provider admits on INPUT tokens only (probed: 800k prompt + 393216 max_tokens accepted; 1.05M prompt rejected), so reserved/max_tokens do not size the request — the head does. Changes: - compaction.preserve_recent_tokens: 500000 — keeps a large verbatim tail so the summarized head shrinks. Reconstructed head drops from 1,128,448 to 634,064 real tokens. Stopgap until opencode drops oldest turns itself (anomalyco/opencode#48844, PR #51121). - model options: max_tokens 262144, reasoningEffort high, and the sampling set (temperature 1.0, top_p 0.95, frequency_penalty 0.5, presence_penalty 1.0) — exact parity with the org PR-eval engine and the vendor-recommended sampling for deepseek-v4.1-flash. Upstream: anomalyco/opencode#48844 (open) and anomalyco/opencode#51121 (open, "drop oldest turns when compaction head exceeds model context"). Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
1 parent 026bb98 commit 2689383

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎opencode.json‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"compaction": {
55
"auto": true,
66
"prune": true,
7-
"reserved": 384000
7+
"reserved": 384000,
8+
"preserve_recent_tokens": 500000
89
},
910
"skills": {
1011
"paths": ["marketplace"]
@@ -20,8 +21,12 @@
2021
"output": 384000
2122
},
2223
"options": {
23-
"max_tokens": 384000,
24-
"reasoningEffort": "high"
24+
"max_tokens": 262144,
25+
"reasoningEffort": "high",
26+
"temperature": 1.0,
27+
"top_p": 0.95,
28+
"frequency_penalty": 0.5,
29+
"presence_penalty": 1.0
2530
}
2631
}
2732
}

0 commit comments

Comments
 (0)