-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Description
Description
When a session is compacted (via /compact or auto-compaction), resuming the session injects a synthetic user message "What did we do so far?" into the conversation. This causes the model to treat it as a real user request and generate a long summary/recap — even when the user's rules explicitly prohibit summaries.
Root cause
Found via strings on the compiled binary (v1.2.5):
if (part.type === "compaction") {
userMessage.parts.push({
type: "text",
text: "What did we do so far?"
});
}This string appears twice in the binary (likely two code paths for provider-specific message formatting).
Steps to reproduce
- Start a session with significant context
- Run
/compact(or let auto-compaction trigger) - Continue the session — the model receives
"What did we do so far?"as a user message - The model responds with a full summary, even if the user didn't ask for one
Impact
- Wastes tokens on an unwanted summary response
- Violates user-defined rules (e.g. "no summaries or recaps" in AGENTS.md)
- Confusing UX — the user sees a response to a question they never asked
- The model may reference this fake message in reasoning ("the user asked what we did so far")
Suggested fix
Instead of injecting a fake user prompt, the compaction summary could be:
- Injected as a system message (not a user message)
- Use a more neutral framing like
"[Session context restored from compaction]"that doesn't prompt the model to generate a response - Or simply replay the compaction content as an assistant message without a corresponding user message
Environment
- OpenCode v1.2.5
- macOS arm64
- Model: claude-opus-4.6 via github-copilot
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels