anomalyco / anomalyco/opencode
compaction: automatic compaction can fail with provider invalid_prompt
@kitlangton is already working on this.
Since Sep 8, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Automatic compaction can fail because OpenAI rejects the generated compaction prompt as potentially violating usage policy. The raw provider error interrupts session draining instead of recovering gracefully.
Environment
- opencode version:
0.0.0-beta-19296 - OS: Windows 10.0.26200.9168
- Terminal:
TERM=xterm-256color; terminal program unavailable - Shell:
C:\WINDOWS\system32\cmd.exe - Install/channel: beta, reported as up to date
- Active plugins: none found in global or project configuration
Reproduction
- Continue a sufficiently long session until automatic compaction runs.
- Allow OpenCode to compact the existing conversation automatically.
- Observe the session fail with a raw
invalid_promptprovider error.
Reproduction is intermittent: one automatic compaction failed, while a later automatic compaction in the same session completed.
Expected Behavior
Automatic compaction should complete, retry safely, or surface a recoverable compaction-specific error without failing the session drain.
Actual Behavior
The automatic compaction record was marked failed with error type provider.invalid-request, and the server logged:
Failed to drain Session
The user-facing error was:
invalid_prompt: Invalid prompt: your prompt was flagged as potentially violating our usage policy. Please try again with a different prompt: https://platform.openai.com/docs/guides/reasoning#advice-on-prompting
Additional Context
- The failure occurred during automatic compaction.
- The failed record contained no summary or model metadata.
- A later automatic compaction completed with OpenAI
gpt-5.6-sol. - No prompt or conversation content is included here for privacy.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.