GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — feat(session): add custom compaction thresholds along with prevention of continuous compaction by saksham1341 · Pull Request #10123 · anomalyco/opencode Conversation
|
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate: I found one potentially related PR: PR #9656: feat(opencode): trigger compaction earlier and add multi-file read This PR appears to address compaction triggering behavior, which is related to the compaction threshold configuration being added in the current PR (#10123). However, it seems to focus on multi-file read functionality as well, so they may not be exact duplicates. You should review #9656 to ensure there's no overlap in the compaction logic implementation. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
EDITS: Correctly mentioned the issue being fixed. Reviewed the potentially related PR, this one focuses solely on customizing the early compaction threshold as per the user's need, while preventing infinite compaction loop. Meanwhile the related PR (#96956) is a hardcoded early compaction (at 90% of the context) fix along with multi-file read validation. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
@jeremyakers Just +1 on this PR! Custom compaction thresholds are critical for long-context models like Gemini/GPT that degrade quality at 30-50% context. The hardcoded 75% threshold causes severe performance issues in production workflows. Having per-model
This aligns perfectly with the 'auto-archive' mode you mentioned - both give users fine-grained control over when context gets compacted. Happy to test beta implementations! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@WietRob I have added a commit allowing model-specific threshold control, thank you for the suggestion! Here is a sample config. {
"$schema": "https://opencode.ai/config.json",
"compaction": {
"token_threshold": 100000,
"context_threshold": 0.30,
"models": {
"opencode/minimax-m2.1-free": {
"token_threshold": 50000,
"context_threshold": 0.10
}
}
}
}It would be great help if you could test it out as well. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@saksham1341 Tested this with opencode/minimax-m2.1-free using a 5% threshold in my config. It definitely works - I pushed context to ~24% and it triggered compaction immediately (and kept compacting as I stayed over the limit). The model-specific overrides are doing their job. Thanks for adding this! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you for implementing this! I have tested it with opencode 1.2.10. Working config format: {
"compaction": {
"token_threshold": 60000,
"context_threshold": 0.45,
"models": {
"google/antigravity-gemini-3-flash": {
"context_threshold": 0.30
},
"google/antigravity-gemini-3-pro-high": {
"context_threshold": 0.30
}
}
}
}Note: The following keys from my previous config are not supported in this implementation:
These should be removed. The supported keys are only:
Feature request: Would it be possible to add |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@WietRob how did you get this to work? I just updated my opencode to 1.2.12 and adjusted my opencode.json accordingly. Still, the auto compaction only kicks in at 75%.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
nudge! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@fea17e86 Sorry for the confusion! I just tested this myself and found the issue. Why it doesn't work for you: What I found when testing the PR branch:
To use these features now: git clone https://github.com/anomalyco/opencode.git cd opencode git fetch origin pull/10123/head:pr-10123 git checkout pr-10123 # Follow the build instructions in the repo Your config format is correct - it will work once this PR is merged and released. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Feature Request: Custom compaction threshold to trigger earlier
There was an error while loading. Please reload this page.