Compaction replay injects fake user message "What did we do so far?" causing unwanted summary generation #9459

Open
opened 2026-02-16 18:12:30 -05:00 by yindo · 0 comments
Owner

Originally created by @jdocker8 on GitHub (Feb 16, 2026).

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

  1. Start a session with significant context
  2. Run /compact (or let auto-compaction trigger)
  3. Continue the session — the model receives "What did we do so far?" as a user message
  4. 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
Originally created by @jdocker8 on GitHub (Feb 16, 2026). ## 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): ```js 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 1. Start a session with significant context 2. Run `/compact` (or let auto-compaction trigger) 3. Continue the session — the model receives `"What did we do so far?"` as a user message 4. 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9459