You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the compaction starts, it automatically stops saying "Bad Request" but only for Claude Opus 4.5 (I'm using github copilot integration).
And now that we are here, any idea why I can't use Opus 4.6 with my github copilot integration? It's enabled for my github enterprise integration.
Any idea why?
Plugins
oh-my-opencode
OpenCode version
1.1.65
Steps to reproduce
Start opencode
Write a prompt
Automatically starts the compaction
Bad Request
Screenshot and/or share link
Operating System
macOS 26
Terminal
Warp
Reacted by Daniel Riedl, Matthias Nguyen and Philipp Hoffmann
I keep getting this after a compaction, maybe the same issue. No logs tell me why and it is getting quite frustrating as it leaves the session unrecoverable.
Update:
Spent hours on this, trying older versions, even pulled the code and tried to get more insight. Got nowhere. I'm not even over quota...
I'm starting to think it's on the GH side at this stage.
Update 2:
I think there may be two issues here. @danriedl is showing a workaround to a >100% context usage issue, where it appears compaction overflows the models context window. My situation is different as I'm around 80% context usage and hitting errors.
I have managed to step past my issue by setting the compact agent to a non Anthropic model, GPT-5.2, which would suggest there is something in the way Claude models are called. I'm using GitHub Copilot Enterprise, specificity the GHE.com version.
I need to verify but some AI assisted analysis seems to point to packages/opencode/src/provider/transform.ts and specifically the code used to set the headers etc for Claude models, with GH rejecting with a 400.
Reacted by Daniel Riedl, Till Krischer and Tiago de Paula
I do have the exact same issue. Was deleting .local/share/opencode but did not help.
Im on the newest release 1.2.17
Only way around this is to export the session after the context exceeded and compaction failed and continue in a new session.
Problem exists since 3 weeks, as @vmagalhaes also described.
Is it something hardcoded when the session should be compacted and it might changed?
Update:
This is what Opus4.6 reported for the opencode repository itself:
The Actual Bug in opencode
There are two bugs in the codebase:
compaction.ts sends all messages without checking if they fit the compaction model's context window. It should either truncate older messages or use a smarter strategy (e.g., summarize in chunks).
isOverflow doesn't apply the reserved buffer when limit.input is undefined (packages/opencode/src/session/compaction.ts:44-46). The else branch should be context - maxOutputTokens - reserved to ensure there's enough headroom for the compaction call itself.
Temporary Fix:
In your opencode.json, configure the compaction agent to use a smaller/cheaper model with a large context window:
Having the same issue with GHE on v1.2.24 and Claude Opus 4.6. Switching to GPT-5.4 works and it does the compaction after saying "continue". Probably could then switch back to Opus 4.6 after compaction.
I'm closing the issue, looks like a common issue, for GHE it's preferred to use Copilot CLI (mainly because opencode doesn't manage copilot requests, only tokens).
@vmagalhaes, opening an issue only to close it because you've ditched for another tool?
That's not how open source rolls. It's collaborative efforts and not a drive-by.
We've already nailed down the problem (check my response above), so this should stay open for someone with the guts to fix it.
@vmagalhaes, opening an issue only to close it because you've ditched for another tool? That's not how open source rolls. It's collaborative efforts and not a drive-by. We've already nailed down the problem (check my response above), so this should stay open for someone with the guts to fix it.
@vmagalhaes, opening an issue only to close it because you've ditched for another tool? That's not how open source rolls. It's collaborative efforts and not a drive-by. We've already nailed down the problem (check my response above), so this should stay open for someone with the guts to fix it.
I closed it because that are already open issues with the same discussion. But then I’m reopening this one and you can discuss in here too.
Activity
georgeharker commentedon Feb 14, 2026
Still occurring? I was having compaction related issues yesterday that appear to have been resolved on github's end: #13444
vmagalhaes commentedon Feb 14, 2026
Yes, the issue still persist, at least until 2h ago.
dotned commentedon Mar 5, 2026
I keep getting this after a compaction, maybe the same issue. No logs tell me why and it is getting quite frustrating as it leaves the session unrecoverable.
Update:
Spent hours on this, trying older versions, even pulled the code and tried to get more insight. Got nowhere. I'm not even over quota...
I'm starting to think it's on the GH side at this stage.
Update 2:
I think there may be two issues here. @danriedl is showing a workaround to a >100% context usage issue, where it appears compaction overflows the models context window. My situation is different as I'm around 80% context usage and hitting errors.
I have managed to step past my issue by setting the compact agent to a non Anthropic model, GPT-5.2, which would suggest there is something in the way Claude models are called. I'm using GitHub Copilot Enterprise, specificity the GHE.com version.
I need to verify but some AI assisted analysis seems to point to packages/opencode/src/provider/transform.ts and specifically the code used to set the headers etc for Claude models, with GH rejecting with a 400.
danriedl commentedon Mar 5, 2026
I do have the exact same issue. Was deleting
.local/share/opencodebut did not help.Im on the newest release
1.2.17Only way around this is to export the session after the context exceeded and compaction failed and continue in a new session.
Problem exists since 3 weeks, as @vmagalhaes also described.
Is it something hardcoded when the session should be compacted and it might changed?
Update:
This is what Opus4.6 reported for the opencode repository itself:
Temporary Fix:
In your opencode.json, configure the compaction agent to use a smaller/cheaper model with a large context window:
{ "agent": { "compaction": { "model": "github-copilot-enterprise/claude-sonnet-4" } } }BleTib commentedon Mar 10, 2026
I also have the same issue with GHE on v1.2.22
zwarag commentedon Mar 11, 2026
i also run into this issue
I'm using with
github-copilot-enterprise/gpt-5.2-codexfor compaction because I had the same issue with sonnet.tlaukkanen commentedon Mar 11, 2026
Having the same issue with GHE on v1.2.24 and Claude Opus 4.6. Switching to GPT-5.4 works and it does the compaction after saying "continue". Probably could then switch back to Opus 4.6 after compaction.
vmagalhaes commentedon Mar 11, 2026
I'm closing the issue, looks like a common issue, for GHE it's preferred to use Copilot CLI (mainly because opencode doesn't manage copilot requests, only tokens).
danriedl commentedon Mar 11, 2026
@vmagalhaes, opening an issue only to close it because you've ditched for another tool?
That's not how open source rolls. It's collaborative efforts and not a drive-by.
We've already nailed down the problem (check my response above), so this should stay open for someone with the guts to fix it.
BleTib commentedon Mar 11, 2026
agree
the workaround from above seems to work with gpt.
in ~/.config/opencode/opencode.json
georgeharker commentedon Mar 11, 2026
That helps but you still pay a premium request on resuming after compaction
vmagalhaes commentedon Mar 12, 2026
I closed it because that are already open issues with the same discussion. But then I’m reopening this one and you can discuss in here too.
dezren39 commentedon Mar 31, 2026
in the mean time i fixed this another way..
https://github.com/developing-today/opencode-auto-continue
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.