Repository navigation
Description
Description
OpenCode 2.2.6 reports provider.invalid-output: Invalid compaction response during native compaction, despite HTTP 200 and a nonempty encrypted checkpoint. Observed with Azure OpenAI; direct OpenAI has not been tested.
The returned window contains 3 developer messages injected by OpenCode: one Code Mode catalog update and two live AGENTS.md change notifications. The compaction validator accepts only user/assistant message roles and rejects the entire response.
Both OpenAI and Azure document passing the returned compacted window as-is. OpenAI’s response schema permits developer messages.
Rejected response shape below:
{
"id": "resp_redacted",
"object": "response.compaction",
"created_at": 1794448779,
"output": [
{
"id": "msg_redacted_1",
"type": "message",
"status": "completed",
"content": [
{
"type": "input_text",
"text": "[Code Mode tool-catalog update redacted]"
}
],
"role": "developer"
},
{
"id": "msg_redacted_2",
"type": "message",
"status": "completed",
"content": [
{
"type": "input_text",
"text": "[User message redacted]"
}
],
"role": "user"
},
{
"id": "cmp_redacted",
"type": "compaction",
"encrypted_content": "[redacted]"
}
],
"usage": {
"input_tokens": 231591,
"input_tokens_details": {
"cache_write_tokens": 0,
"cached_tokens": 231498
},
"output_tokens": 4393,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 235984
}
}Plugins
n/a
OpenCode version
2.2.6
Steps to reproduce
- Use OpenCode 2.2.6 with an Azure OpenAI Responses model and native compaction enabled.
- Edit
AGENTS.mdduring an active session so OpenCode injects an instruction-change notification. The observed session also received a Code Mode catalog update. - Continue until automatic compaction runs.
- When the endpoint returns retained
developermessages, OpenCode rejects the response withInvalid compaction response.
Native compaction previously worked in other sessions; these steps describe the observed failing conditions, not a verified minimal reproduction.
Screenshot
Operating System
Windows 11
Terminal
Chrome 157
Activity
opencodejr commentedon Nov 12, 2026
Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the detailed report. I reproduced this with a mock standing in for Azure OpenAI, since I don't have an Azure account here.
What I did:
compaction.type: "native", sent one prompt, then triggered compaction./responses/compactreturned the window shape from your report: adevelopermessage, ausermessage and acompactioncheckpoint.provider.invalid-output: Invalid compaction response(HTTP 200).developeritem, compaction succeeded. So the retained developer message alone causes the failure.The response validator in
packages/ai/src/protocols/utils/responses-compaction.tsonly acceptsuserandassistantmessages. This still happens on the latestdev(f5ca39a). The script below reproduces it, mock included.One limit: I didn't check that real Azure returns these developer items. That part comes from your report and the mock returns that shape.
Reproduction script (repro.sh)
Run it:
bash repro.shneriousy commentedon Nov 19, 2026
Fixed by #64542, which makes native compaction accept developer messages in the returned window instead of rejecting the whole response. If you still see this on the latest version, comment here and we'll reopen.