anomalyco / anomalyco/opencode
Context compression loses initial user question and reasoning chain, model responds with hallucinated content
@nexxeln is already working on this.
Since Aug 11, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
markdown
Bug Description
After context compression kicks in, the model loses awareness of the original user question and its own prior reasoning chain. It then responds with plausible-looking but factually incorrect content that bears no relation to the actual task.
This is a significant usability issue — the model effectively "forgets" what it was working on after compression, making long-running tasks unreliable.
Concrete Example
The user asked: "该项目存在哪些EMB_REVIEW_MODE=auto_mode类似这种的环境变量?? 分别是在哪传入的, 使用地点又在哪里??"
This is a specific codebase analysis question about environment variable injection points, whitelist definitions, and consumption sites in a CI/CD pipeline project.
After context compression, the model:
- Lost the original question entirely
- Lost its own multi-step reasoning chain (which had already parsed engine.groovy, nodes/init.py, directives.py, etc.)
- Started responding with a completely fabricated summary about git commits and "feat(006)" — none of which was asked about
- The response was internally coherent but completely wrong as an answer to the original question
Root Cause
Context compression discards the early conversation turns (initial user message + model's initial reasoning) while preserving only the most recent tool call results and model responses. When the model has no access to the original question, it falls back to pattern-matching on whatever is still in context — typically the last few tool outputs — and generates a plausible-sounding but unrelated answer.
Expected Behavior
- The original user question should be preserved through compression, either by being retained verbatim or by being summarized in a "task context" section that survives compression
- The model's own prior reasoning chain should be preserved or at least summarized so it can continue coherent work
- If compression must discard early context, there should be a mechanism to re-inject the task goal into the prompt
Plugins
No response
OpenCode version
1.18.15
Steps to reproduce
This problem occurs whenever we perform a compatibility test.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
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.