Repository navigation
Commit 2689383
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
0 commit comments